Hi,
In proc sgplot with either hbar or vbar statement, how to bring information from two variables to one bar. For eg. var1=5 and var2=10. Other obs could be var1=2 and var2=5. The plot should show one bar for each obs and each representaive bar should show informaion from both var1 (red) and var2 (blue). The group won't work here.
If you want the bars stacked change GROUPDISPLAY from CLUSTER to STACK.
You'll need to restructure you data into how SAS expects it to be for a stacked bar chart.
This means combining the variables and included a new variable to denote the source/group.
You mean create a new variable by adding var1+var2. But in the vbar statement, what will be go in response=?? and group= combined?? groupdisplay=stack? Thanks.
If you want sample code post sample data.
Hi:
Restructuring the data will get you want you want. You just need to make 2 observations for every observation in the input data.
cynthia
If you want the bars stacked change GROUPDISPLAY from CLUSTER to STACK.
Thanks Reeza and Cynthia..! Did not get the restructuing part, it is clear now.
The correct answer should be Cynthia's post.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.