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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.