Data visualization with SAS programming

Dual axis bar chart with different categories

Accepted Solution Solved
Reply
Highlighted
Occasional Contributor
Posts: 11
Accepted Solution

Dual axis bar chart with different categories

I would like to know how I can create a dual axis bar chart with different categories using SAS commands. I am attaching an image that is an example of what I need to do. The example is very accurate, except that I do not need the line graph. Since I am using private data, I cannot upload the data set or my commands. I would truly appreciate any help. 


Accepted Solutions
Solution
3 weeks ago
SAS Super FREQ
Posts: 1,227

Re: Dual axis bar chart with different categories

Posted in reply to priscilabaddouh

All Replies
SAS Employee
Posts: 182

Re: Dual axis bar chart with different categories

Posted in reply to priscilabaddouh

Hi @priscilabaddouh

 

Did you have a look at Sample 41975: Annotate a right vertical axis on PROC GCHART output, it should help you.

This is the output of the sample.

image.png

And you can always use @RobertAllison_SAS page Robert Allison's SAS/Graph Examples! which has more examples that you can think of (or Graphics Samples Output Gallery).

 

Hope that helps.

 

Cheers,

Damo

Super User
Posts: 12,148

Re: Dual axis bar chart with different categories

Posted in reply to priscilabaddouh

priscilabaddouh wrote:

 I cannot upload the data set or my commands.


The data I agree can be sensitive. If you have sufficient information in program code to violate any sensitivity rules I would be very skeptical though. Or change the name of your data set from sensitivename to genericname (HAVE is frequently used on this forum for any existing data set) and similar for variable names.

SAS Super FREQ
Posts: 978

Re: Dual axis bar chart with different categories

Posted in reply to priscilabaddouh

This should work for you:

 

proc sgplot data=sashelp.class;
yaxis refticks=(label values);
vbar age / response=weight stat=sum group=sex;
run;

Thanks!

Dan

Solution
3 weeks ago
SAS Super FREQ
Posts: 1,227

Re: Dual axis bar chart with different categories

Posted in reply to priscilabaddouh

See new Graphically Speaking article inspired by your question.

https://blogs.sas.com/content/graphicallyspeaking/2018/02/05/dual-response-axis-bar-line-overlay-par...

 

Occasional Contributor
Posts: 11

Re: Dual axis bar chart with different categories

Posted in reply to Sanjay_SAS

Thank you so much. I could not be more thankful. Have an amazing day!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 177 views
  • 3 likes
  • 5 in conversation