Hello,

I would like to plot two variables in overlaid bars that have the same 7 categories (pre_occupqual1 and pre_occupqual2) by subgroup (camp). So far I have only been able to do it with twoway histogram. My code is:
Code:
twoway histogram pre_occupqual1, by(camp) discrete color(gray) ///
 ||  histogram pre_occupqual2, by(camp) discrete fcolor(none) lcolor(black) ///
 legend( order(1 "Camp occupations" 2 "Pre-camp occupations"))
This is the closest version with twoway histogram. Ideally, I would have code numbers and a second legend to describe each category below as the labels are too long:
Array
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(pre_occupqual1 pre_occupqual2) str15 camp
. . "Gila River"    
. . "Tule Lake"     
. . "Tule Lake"     
. . "Tule Lake"     
4 . "Gila River"    
3 . "Tule Lake"     
2 . "Tule Lake"     
. . "Rohwer"        
3 4 "Gila River"    
. . "Tule Lake"     
4 . "Tule Lake"     
. . "Gila River"    
. . "Tule Lake"     
. . "Tule Lake"     
4 . "Tule Lake"     
. . "Rohwer"        
4 . "Tule Lake"     
. . "Tule Lake"     
. . "Gila River"    
. . "Tule Lake"     
. . "Tule Lake"     
. . "Rohwer"        
. . "Tule Lake"     
4 6 "Tule Lake"     
4 6 "Tule Lake"     
4 3 "Tule Lake"     
. . "Gila River"    
2 . "Topaz"         
. . "Heart Mountain"
. . "Tule Lake"     
3 4 "Tule Lake"     
. . "Tule Lake"     
. . "Rohwer"        
7 . "Heart Mountain"
. . "Rohwer"        
. . "Tule Lake"     
. . "Tule Lake"     
. . "Tule Lake"     
3 6 "Tule Lake"     
4 2 "Gila River"    
. . "Rohwer"        
. . "Tule Lake"     
. . "Rohwer"        
4 . "Tule Lake"     
4 4 "Tule Lake"     
. . "Tule Lake"     
. . "Heart Mountain"
. . "Tule Lake"     
. . "Tule Lake"     
2 . "Rohwer"        
. . "Tule Lake"     
3 . "Tule Lake"     
3 . "Heart Mountain"
2 5 "Tule Lake"     
5 . "Tule Lake"     
2 . "Rohwer"        
. . "Tule Lake"     
. . "Tule Lake"     
. . "Gila River"    
3 4 "Heart Mountain"
4 . "Topaz"         
. . "Tule Lake"     
6 4 "Rohwer"        
4 . "Tule Lake"     
5 . "Tule Lake"     
. . "Tule Lake"     
2 . "Tule Lake"     
. . "Gila River"    
4 . "Tule Lake"     
1 . "Tule Lake"     
4 . "Topaz"         
. . "Rohwer"        
. . "Tule Lake"     
3 . "Tule Lake"     
4 6 "Tule Lake"     
4 4 "Tule Lake"     
2 7 "Tule Lake"     
. . "Rohwer"        
. . "Rohwer"        
2 1 "Tule Lake"     
. . "Tule Lake"     
6 4 "Gila River"    
4 5 "Tule Lake"     
3 . "Gila River"    
4 3 "Tule Lake"     
4 . "Heart Mountain"
4 . "Gila River"    
4 . "Heart Mountain"
. . "Tule Lake"     
4 6 "Amache"        
. . "Tule Lake"     
4 . "Rohwer"        
4 6 "Tule Lake"     
5 . "Tule Lake"     
4 . "Tule Lake"     
4 4 "Tule Lake"     
3 . "Tule Lake"     
3 . "Gila River"    
4 . "Rohwer"        
2 4 "Gila River"    
end
label values pre_occupqual1 occ_label
label values pre_occupqual2 occ_label
label def occ_label 1 "Professional or managerial", modify
label def occ_label 2 "Clerical, sales", modify
label def occ_label 3 "Service", modify
label def occ_label 4 "Agricultural, fishery & forestry", modify
label def occ_label 5 "Skilled", modify
label def occ_label 6 "Semiskilled", modify
label def occ_label 7 "Unskilled", modify