Plotting multiple variables next to each other

#1
Hi,

Sorry if this is a really basic question. I have 4 dichotomous variables, each of which that can take on the values of 0 or 1. I want to have a graph that indicates the percentages 0s and 1s for each variable. I know for a single variable I can just use the histogram function. However, I need all four variables next to each other. So basically it would look like 4 histograms separated by small spaces, and I need the y-axis to indicate percentages, not frequencies. Any suggestions would be greatly appreciated!
 

bukharin

RoboStataRaptor
#2
It's not a basic question - bar graphs in Stata can be a bit tricky. I would suggest something like this:
Code:
graph bar (mean) var1 var2 var3 var4, ylab(0 .2 "20" .4 "40" .6 "60" .8 "80" 1 "100") ytitle(%) ascategory nolabel
Note that this only graphs the percent of 1's. This makes sense - what is the value in plotting both the % of 0's and the % of 1's? (Answer: none). If you really want to do that then you need to create additional variables indicating negative responses, eg:
gen notvar1=1-var1

Then add them to the plot.