Hi there. I am stuck with trying to create a bar graph for 3 categorical variables; quintile (1-3, 4 and 5), nsfasyn(yes, no) and gradind(yes, no). My proc freq statement is as follows:
proc freq data=project;
tables gradind;
format gradind newh.;
tables quintile;
format quintile new.;
tables nsfasyn;
format nsfasyn $newn.;
tables nsfasyn*quintile*gradind/ plots=freqplot (twoway=cluster scale=percent) out=graphs5;
run;
From this code I got the following graphs:
How do I combine these graphs into one bar graph? I was thinking of using proc sgplot but nothing has work so far as it only allows for 2 variables.
Please describe HOW want this combined into one graph. Do you want 4 groups of 3 bars side by side in one panel?
Stacked on top of each other? One set of values "behind" the other?
If you have an image of what you want that gives us a chance.
You will almost certainly have to use something other than Proc FREQ as that procedure has very few graphing control options and is more intended for data exploration than "camera ready" for report purposes.
It would be 4 groups(2 x dropout, 2 x graduates) with 3 bars (quintiles) for each of the groups. So it be be one whole graph with (1 x dropout, 1 x graduate and 3 bars for each) for nsfasyn=y and then (1 x dropout, 1 x graduate and 3 bars for each) for nsfasyn=n. So it basically combine the 2 graphs I posted all in one. I am stuck here
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.