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

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;

HF_clin_0-1651231406140.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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.

View solution in original post

9 REPLIES 9
Ksharp
Super User
proc sgplot data=sashelp.class;
vline sex / response=weight group=age
groupdisplay=cluster clusterwidth=0.5 lineattrs=(thickness=0) stat=mean limitstat=CLM;
run;
HF_clin
Fluorite | Level 6

Tried that but no mean mark or box on the Mean and the box below does not show colors of OD and OS

HF_clin_0-1651239129427.png

 

DanH_sas
SAS Super FREQ

Also add the MARKERS option to the VLINE statement.

Ksharp
Super User
As DanH said:

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;
Rick_SAS
SAS Super FREQ

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

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.)

HF_clin_0-1651241742526.png

 

DanH_sas
SAS Super FREQ

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.

HF_clin
Fluorite | Level 6
Thanks that works well. But I was thinking maybe bars with different fills
DanH_sas
SAS Super FREQ

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1107 views
  • 4 likes
  • 4 in conversation