I want to do draw the frequency distribution of a categorical variable and want the bars to be arranged in a particular order. My categorical variable is "FirstLangOne", and as given in the sub-topic "Putting the bars in a pre-specified order" in the remarks section of the stata manual on the command "graph bar", I created the "order" variable as given below. Following are the commands that I used:
Code:
generate order = 1 if FirstLangOne=="A+"
replace order = 2 if FirstLangOne=="A"
replace order = 3 if FirstLangOne=="B+"
replace order = 4 if FirstLangOne=="B"
replace order = 5 if FirstLangOne=="C+"
replace order = 6 if FirstLangOne=="C"
replace order = 7 if FirstLangOne=="D+"
replace order = 8 if FirstLangOne=="F"
replace order = 9 if FirstLangOne=="Ab"

graph bar, over(FirstLangOne, sort(order))
But I get the error:
variable mean not found
r(111)

Can't figure out what is going wrong with the sort option. I am using Stata version 14.2. Kindly reply asap.