Hello everyone,
I am back for a little bit of help creating four way histograms. The data I am working with is two different datasets which have been appended, and a dummy variable (0-1) has been added to indicate which dataset the respondents belong to. So far, I have been using the following code:
twoway (histogram year_born if dataset==0, percent start(1980) width(1) color(navy)) ///
(histogram year_born if dataset==1, percent start(1980) width(1) ///
fcolor(maroon) lcolor(black)), legend(order(1 "UA data" 2 "ESS" )) ///
title("Year born")
However, the research director has asked me to add two more categories, based on a categorical varibale found in dataset 1, essentially making this a four-way graph. In essense, I will need a histogram that shows:
1. Year_born for dataset0
2. Year_born for dataset1
3. Year_born for students in dataset1
4. Year_born for non-students in dataset1.
Preferably I would show this in percentages (as seen in the above code), and using lines not bars.
I am at a loss on how to do this, and all of the options I've looked at so far don't seem to be working. Does anyone have any ideas?
I am back for a little bit of help creating four way histograms. The data I am working with is two different datasets which have been appended, and a dummy variable (0-1) has been added to indicate which dataset the respondents belong to. So far, I have been using the following code:
twoway (histogram year_born if dataset==0, percent start(1980) width(1) color(navy)) ///
(histogram year_born if dataset==1, percent start(1980) width(1) ///
fcolor(maroon) lcolor(black)), legend(order(1 "UA data" 2 "ESS" )) ///
title("Year born")
However, the research director has asked me to add two more categories, based on a categorical varibale found in dataset 1, essentially making this a four-way graph. In essense, I will need a histogram that shows:
1. Year_born for dataset0
2. Year_born for dataset1
3. Year_born for students in dataset1
4. Year_born for non-students in dataset1.
Preferably I would show this in percentages (as seen in the above code), and using lines not bars.
I am at a loss on how to do this, and all of the options I've looked at so far don't seem to be working. Does anyone have any ideas?
Comment