The code below returns an error of option over() not allowed. How can this be fixed?
Best,
Nader
Best,
Nader
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte age str2 category_num str1 gender float(Underweight Healthy Overweight Obese TLE) str3 profile str14 birth_place str20 race float(percent1 percent2 percent3 percent4) 50 "01" "F" .6815519 9.853015 10.017346 10.48322 31.035133 "F01" "1.US-born" "0.non-Hispanic White" 2.2 31.7 32.3 33.8 50 "02" "F" .8893277 12.3277 10.886005 9.213534 33.316566 "F02" "2.Foreign-born" "0.non-Hispanic White" 2.7 37 32.7 27.7 50 "11" "F" .3959603 4.651466 8.812572 14.597174 28.45717 "F11" "1.US-born" "1.non-Hispanic Black" 1.4 16.3 31 51.3 50 "12" "F" .5641846 6.300639 10.17347 13.738186 30.77648 "F12" "2.Foreign-born" "1.non-Hispanic Black" 1.8 20.5 33.1 44.6 50 "21" "F" .487384 7.625911 11.330256 12.928034 32.371586 "F21" "1.US-born" "2.Hispanic" 1.5 23.6 35 39.9 50 "22" "F" .6501698 9.679329 12.451668 11.706597 34.487762 "F22" "2.Foreign-born" "2.Hispanic" 1.9 28.1 36.1 33.9 50 "31" "F" .7672865 10.38339 9.695418 9.867319 30.713415 "F31" "1.US-born" "3.non-Hispanic other" 2.5 33.8 31.6 32.1 50 "32" "F" .9929502 13.045523 10.563076 8.598753 33.200302 "F32" "2.Foreign-born" "3.non-Hispanic other" 3 39.3 31.8 25.9 end
rename (PUWLE PHWLE POWLE POBLE sex sample_ ) (percent1 percent2 percent3 percent4 gender category_num)
reshape long percent, i(gender category_num) j(which)
label def which 1 "Underweight" 2 "Healthy" 3 "Overweight" 4 "Obese"
label val which which
*gen toshow = string(percent, "%2.1f") + "%"
egen category = concat (gender category_num which), punct("")
gen toshow = string(percent, "%2.1f") + "%"
replace toshow= string(percent, "%2.1f") if toshow==""
replace gender="Female" if gender=="F"
replace gender="Male" if gender=="M"
tabplot category_num which [iw=percent], height(0.63) over(birth_place) over(race) by(gender , note("")) separate(which) bar1(blcolor(blue) bfcolor(blue*0)) bar2(blcolor(blue) bfcolor(blue*0.1)) bar3(bcolor(blue)bfcolor(blue*0.2)) bar4(bcolor(blue)bfcolor(blue*0.3)) showval (toshow, offset(0.10)) horizontal ytitle("") xtitle("") xscale(r(0.7 1 3.4)) subtitle(, fcolor(none)) name(G1, replace) xlabel(, labsize(small))
reshape long percent, i(gender category_num) j(which)
label def which 1 "Underweight" 2 "Healthy" 3 "Overweight" 4 "Obese"
label val which which
*gen toshow = string(percent, "%2.1f") + "%"
egen category = concat (gender category_num which), punct("")
gen toshow = string(percent, "%2.1f") + "%"
replace toshow= string(percent, "%2.1f") if toshow==""
replace gender="Female" if gender=="F"
replace gender="Male" if gender=="M"
tabplot category_num which [iw=percent], height(0.63) over(birth_place) over(race) by(gender , note("")) separate(which) bar1(blcolor(blue) bfcolor(blue*0)) bar2(blcolor(blue) bfcolor(blue*0.1)) bar3(bcolor(blue)bfcolor(blue*0.2)) bar4(bcolor(blue)bfcolor(blue*0.3)) showval (toshow, offset(0.10)) horizontal ytitle("") xtitle("") xscale(r(0.7 1 3.4)) subtitle(, fcolor(none)) name(G1, replace) xlabel(, labsize(small))
Comment