- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't want the connecting lines between the mean (this is no time series) but can't see how to remove them and still keep the rest. Plus I would like a small black box to represent the mean. Vbar has nicer bars than these tiny ones from vline but it does not display the statistics I want. Any idees? Thanks
proc sgplot data=k;* NOAUTOLEGEND;
vline treat / response=ODOS group=POS groupdisplay=cluster clusterwidth=0.5 lineattrs=(thickness=1) stat=mean limitstat=CLM;
xaxis offsetmin=0.2 offsetmax=0.2;
yaxis label='Mean SRT with 95% CI' max=550;
format treat treat. pos pos.;
label treat='Risk group' pos='Eye';
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use LIMITATTRS=(thickness=3) (or more) to make the limit lines thicker. and you can use MARKERSATTRS=(size=11) to make the markers bigger to compensate for the thicker lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sgplot data=sashelp.class; vline sex / response=weight group=age groupdisplay=cluster clusterwidth=0.5 lineattrs=(thickness=0) stat=mean limitstat=CLM; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Tried that but no mean mark or box on the Mean and the box below does not show colors of OD and OS
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Also add the MARKERS option to the VLINE statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sgplot data=sashelp.class;
vline sex / response=weight group=age markers
groupdisplay=cluster clusterwidth=0.5 lineattrs=(thickness=0) stat=mean limitstat=CLM;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you don't want a line, then don't use the VLINE statement.
You can use the DOT statement if you are willing to have a horizontal display instead of a vertical display:
proc sgplot data=k;
dot treat / response=ODOS group=POS groupdisplay=cluster
clusterwidth=0.5 stat=mean limitstat=CLM;
xaxis offsetmin=0.2 offsetmax=0.2;
yaxis label='Mean SRT with 95% CI' max=550;
label treat='Risk group' pos='Eye';
run;
I have argued that there are very good reasons to prefer a horizontal chart for categorical data.
If you insist on a vertical display, you can also generate the summary statistics by using PROC MEANS and then use a SCATTER statement with the YERRORLOWER= and YERRORUPPR= options. I don't have your data, but I think the analysis would looks something like this (untested):
proc means data=k mean LCLM UCLM;
class POS Treat;
var ODOS;
output out=MeansOut mean=Mean LCLM=LCLM UCLM=UCLM;
run;
proc sgplot data=MeansOut;
where _TYPE_=3;
scatter x=treat y=Mean / yerrorlower=LCLM yerrorupper=UCLM group=POS groupdisplay=cluster;
xaxis offsetmin=0.2 offsetmax=0.2;
yaxis label='Mean SRT with 95% CI' max=550;
label treat='Risk group' pos='Eye';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Added this to get the fill I wanted: lineattrs=(thickness=0) markerattrs=(symbol=squarefilled) markers. Is ok but ususally like thicker bars than this. The ex with means and scatter nned some more work (it thinks x is not discrete even after adding format (numbers used a 1 2 3), it shows 1, 1.5, 2 ,..) + filledsquare needed so this here is easier.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use LIMITATTRS=(thickness=3) (or more) to make the limit lines thicker. and you can use MARKERSATTRS=(size=11) to make the markers bigger to compensate for the thicker lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use a HIGHLOW plot with TYPE=BAR to create that type of display. However, you wouldl need to precompute your data using PROC SUMMARY or PROC MEANS.