I want to produce a forest plot from my dataset here enclosed.
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
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
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;
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;
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.
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?
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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.