Normally I am using VBAR from the SGPLOT Procedure to create single bar charts. Now I want to build a chart matrix with several plots using the SAS Graph template. Everything works fine except that I can not replicate some functionality from VBAR statement with the BARCHART Statement.
I want to order a stacked bar chart in a descending order, which means the bars should be ordered from the largest to the smallest, as well as each stacked bar should be ordered by the size of each categorical level.
VBAR provides the “CATEGORYORDER = RESPDESC” option which solves my problem, but the same option is not working with the BARCHART Statement. Does anyone knows a workaround which leads to the same solution?
The SGPLOT and SGPANEL procedures do some extra processing to support this feature. There is not a direct option in GTL to do it. To do this GTL, there four key items:
Let me know if you still have issues.
I solved my issue. I forgot to mention that my dataset contains two columns with data which need so be sorted independently first. @ DanH_sas your suggestion did not work completely for my problem but put me on the right track. Thanks for that! I solved my issue by following your logic with proc sql in advance.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.