Search code examples
graphstata

Plot of dummy variable with percentages for only one category


My Stata dataset looks like the following:

Gender Age readsk
Male 14 1
Male 7 0
Female 7 1
Female 9 1

I want to be able to plot the share of women who have reading skill (readsk) which is the results obtained for readsk==1 on using:

tab readsk gender [aw=fsweight], col

In this case that would be 100% for females an 50% for males

I have tried

tabplot readsk gender [aw=fsweight] , percent(gender) showval

But I do not want the plots for when the value is 0. I don't want those graph bars. Is there a way to do that?


Solution

  • graph bar readsk [aw=fsweight], over(gender) yla(0 .25 "25" .5 "50" .75 "75" 1 "100") ytitle("Percent whatever")