Deal All,
I need to make a two-way bar graph and to label the x-axis with names coming from a string variable. I found that I can do that by encoding the string variable and using the value label, with this code:
twoway (rcap upper lower c3, lcolor(black)) || (scatter coef c3, lcolor(black) mcolor(black)) legend(off) yscale(range(-0.3 .3)) ylabel(-.3 -.15 .15 .3) xscale(range(1 2)) xlabel(#12, valuelabel angle(45) labsize(small)) graphregion(color(white) ilcolor(black)) plotregion(lcolor(black))
However, I would like the names not being sorted alphabetically. Is there a way to encode a string variable based on the numeric value of another variable? Or to label the x-axis with a string variable?
Thanks a lot for your help!
I need to make a two-way bar graph and to label the x-axis with names coming from a string variable. I found that I can do that by encoding the string variable and using the value label, with this code:
twoway (rcap upper lower c3, lcolor(black)) || (scatter coef c3, lcolor(black) mcolor(black)) legend(off) yscale(range(-0.3 .3)) ylabel(-.3 -.15 .15 .3) xscale(range(1 2)) xlabel(#12, valuelabel angle(45) labsize(small)) graphregion(color(white) ilcolor(black)) plotregion(lcolor(black))
However, I would like the names not being sorted alphabetically. Is there a way to encode a string variable based on the numeric value of another variable? Or to label the x-axis with a string variable?
Thanks a lot for your help!
Comment