BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
xxformat_com
Barite | Level 11

Hi,

SAS published the booklet: How to solve the data science skills shortage

in which a few bar charts are displayed.

I was wondering how to reproduce some of the style using SAS

 

1. In this graph, there are two subgraphs with subtitles

graph1.JPG

2. In this graph both title, and legend are aligned with the y-axis.

3. The bars are rounded at their end and statistics within the bars are rounded.

graph2.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
proc sql;
create table have as
select sex,status,bp_status,sum(weight) as weight
 from sashelp.heart(obs=50)
  group by sex,status,bp_status;
quit;

proc sgpanel data=have ;
title 'XXXXXXXXXXXXXXXX';
panelby sex/spacing=20 columns=1 noborder noheader;
inset sex/nolabel position=nw textattrs=(size=20) ;
scatter y=status x=weight/group=bp_status markerattrs=(symbol=circlefilled size=28 ) 
                          groupdisplay=cluster transparency=0.3;

hbarparm category=status response=weight/group=bp_status groupdisplay=cluster 
                                         barwidth=0.8 nooutline name='a';

scatter y=status x=weight/group=bp_status markerattrs=(symbol=circlefilled size=28 color=graydd) 
                          groupdisplay=cluster transparency=0.3 ;

scatter y=status x=weight/group=bp_status markerchar=weight  groupdisplay=cluster 
                          markercharattrs=(color=black weight=bold);

rowaxis offsetmin=0.4;
colaxis display=none;
keylegend 'a' /position=top noborder;
run;

Ksharp_0-1672749320146.png

 

View solution in original post

1 REPLY 1
Ksharp
Super User
proc sql;
create table have as
select sex,status,bp_status,sum(weight) as weight
 from sashelp.heart(obs=50)
  group by sex,status,bp_status;
quit;

proc sgpanel data=have ;
title 'XXXXXXXXXXXXXXXX';
panelby sex/spacing=20 columns=1 noborder noheader;
inset sex/nolabel position=nw textattrs=(size=20) ;
scatter y=status x=weight/group=bp_status markerattrs=(symbol=circlefilled size=28 ) 
                          groupdisplay=cluster transparency=0.3;

hbarparm category=status response=weight/group=bp_status groupdisplay=cluster 
                                         barwidth=0.8 nooutline name='a';

scatter y=status x=weight/group=bp_status markerattrs=(symbol=circlefilled size=28 color=graydd) 
                          groupdisplay=cluster transparency=0.3 ;

scatter y=status x=weight/group=bp_status markerchar=weight  groupdisplay=cluster 
                          markercharattrs=(color=black weight=bold);

rowaxis offsetmin=0.4;
colaxis display=none;
keylegend 'a' /position=top noborder;
run;

Ksharp_0-1672749320146.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 736 views
  • 2 likes
  • 2 in conversation