BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Stefy67
Calcite | Level 5

I want to produce a forest plot from my dataset here enclosed. 

Stefy67_0-1620031714146.png

I write this code:

proc sgplot data=plot;
scatter x=pmr_max y=atc81chr1 / group=causa
xerrorlower=pmr_inf_max xerrorupper=pmr_sup_max
markerattrs=or (symbol=CircleFilled size=8 color=red) ;

run;

 

and this the result

 

Stefy67_1-1620031809367.png

I want to ask: 

1. how can I have different colors for each causa

2. I would like to have the different PMR_max for each ATC81chr1 in column and not on the same line (see the last line 'Costruzioni navali'). 

Thanks for you help

Stefania  

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Answer is yes. Or run twice proc sgplot ,one for Male, another for Female.

 

proc summary data=sashelp.heart nway;
class sex Smoking_Status status;
var weight;
output out=have mean=mean lclm=lclm uclm=uclm;
run;
ods graphics/attrpriority=none;
proc sgpanel data=have;
panelby sex/layout=columnlattice novarname;
styleattrs datasymbols=(circlefilled diamondfilled) datacontrastcolors=(green purple);
scatter x=mean y=Smoking_Status/group=status groupdisplay=cluster xerrorlower=lclm xerrorupper=uclm;
rowaxis colorbands=odd;
run;

SGPanel3.png

 

 

View solution in original post

6 REPLIES 6
Ksharp
Super User

You want this ?

 

proc summary data=sashelp.heart nway;
class Smoking_Status status;
var weight;
output out=have mean=mean lclm=lclm uclm=uclm;
run;
ods graphics/attrpriority=none;
proc sgplot data=have;
styleattrs datasymbols=(circlefilled diamondfilled) ;
scatter x=mean y=Smoking_Status/group=status groupdisplay=cluster xerrorlower=lclm xerrorupper=uclm;
yaxis colorbands=odd;
run;

SGPlot8.png

Stefy67
Calcite | Level 5
Yes. Thanks.
May I choose colors for 'Status' ?


Ksharp
Super User
proc summary data=sashelp.heart nway;
class Smoking_Status status;
var weight;
output out=have mean=mean lclm=lclm uclm=uclm;
run;
ods graphics/attrpriority=none;
proc sgplot data=have;
styleattrs datasymbols=(circlefilled diamondfilled) datacontrastcolors=(green purple);
scatter x=mean y=Smoking_Status/group=status groupdisplay=cluster xerrorlower=lclm xerrorupper=uclm;
yaxis colorbands=odd;
run;

Sure. Try this.

Stefy67
Calcite | Level 5

Yes, it works. Thanks a lot.  

Last question: to produce this same graph for men and women should I use proc sgpanel? 

Which option do you advise me?

Ksharp
Super User

Answer is yes. Or run twice proc sgplot ,one for Male, another for Female.

 

proc summary data=sashelp.heart nway;
class sex Smoking_Status status;
var weight;
output out=have mean=mean lclm=lclm uclm=uclm;
run;
ods graphics/attrpriority=none;
proc sgpanel data=have;
panelby sex/layout=columnlattice novarname;
styleattrs datasymbols=(circlefilled diamondfilled) datacontrastcolors=(green purple);
scatter x=mean y=Smoking_Status/group=status groupdisplay=cluster xerrorlower=lclm xerrorupper=uclm;
rowaxis colorbands=odd;
run;

SGPanel3.png

 

 

Stefy67
Calcite | Level 5
Thanks again.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1500 views
  • 2 likes
  • 2 in conversation