- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-18-2021 01:57 PM
(1102 views)
Hello,
I have multiple univariate histograms that I would like to set next to each other and I can't for the life of me find a way to do so. Attached is the code I am using for an example along with the graphs it creates. I've tried proc sgpanel but I keep getting the same problem.
The goal is ultimately to have a 2x2 set of graphs with the same class variable on the left.
- Tags:
- Histograms
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In your code, you have one binary categorical variable (Married=0|1) and two continuous variables. Are you saying that you want a panel that have each continuous variable in a separate column, and the rows are the levels of Married?
If so, convert the data from wide to long and use PROC SGPANEL:
data BWeightLong;
set Sashelp.BWeight(keep=Married Weight MomWtGain);
VarName = "Weight "; Value = Weight; output;
VarName = "MonWtGain"; Value = MomWtGain; output;
keep Married VarName Value;
run;
proc sgpanel data=BWeightLong;
panelBy VarName Married / layout=lattice uniscale=row;
histogram Value;
density Value;
run;