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

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
Fluorite | Level 6
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
Fluorite | Level 6

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
Fluorite | Level 6
Thanks again.