0

I have this graph in Stata 14:

wrong chart

built with this data:

data columns

I used two commands to generate the last two variables to build the graph I want:

// Command 1
gen mayores_65=0 if Edad>=65 & ID !=.
replace mayores_65=1 if Edad<65
label values mayores_65 dSíNo
label define dSíNo 0 "No" 1 "Sí"
label values mayores_65 dSíNo

// Command 2
gen Estatus=0 if Nivel_social==0
replace Estatus=1 if Nivel_social==1
replace Estatus=2 if Nivel_social==2 | Nivel_social==3 | Nivel_social==4 | Nivel_social==5

And then I generate the graph (first image) with:

graph bar (percent), over(Estatus) over(mayores_65)

Is there any possibility to obtain this graph?

expected chart

Nick Cox
  • 35,529
  • 6
  • 31
  • 47

1 Answers1

0

You may find this sequence helpful:

sysuse auto, clear 

graph bar (percent) ,  over(rep78) over(foreign)

graph bar (percent) ,  over(rep78) over(foreign) asyvars 
Nick Cox
  • 35,529
  • 6
  • 31
  • 47