I need to create a graph like this (see attached) i.e. the mean including 95%CI using proc gplot:
I use in the SYMBOL statement i=hilot to join the lower and the upper limit but SAS always includes the "---" at the middle of the 2 values. Is that possible to do not have it? Or do you have an other method to create such output?
Thanks,
It would be helpful to post the code, at least the symbol statemenst and plot procedure code you are trying.
symbol1 interpol=join ^
c=black
line=1
width=2;
symbol2 interpol=hilot
c=black
cv=black
line=1
ci=black
width=2;
proc gplot data=final_;
plot mean2*Visn low_up2*Visn
/
overlay
haxis=axis1
vaxis=axis2
legend=legend1;
run;
quit;
In Mean2 variable I have the mean per timepoint
In Low_up2, I have lower and upper CI values (it means that for the same visit, I have 2 lines : 1 line is mean + lower CI and 1 line is mean + upper CI.
Thanks.
Try this:
drop the first symbol statment and change SYMBOL2 to SYMBOL1 so there is only one symbol statement
then in the PLOT statement drop the overlay and just plot the lower and upper - PLOT LOW_UP2 * VISN;
this should plot the lower and upper bound and the HILOTJ option will calculate the mean of the lower and upper and join it for each timepoint
Another option is to reshape the data so each time point has 3 observations - low, mean, high. Then plot that with one symbol statemement using HILOCTJ.
Read the documentation on HILO to understand all of the options.
Hope all that is clear. For some reason I can't paste SAS code here, otherwise I would paste a snippit for clarity.
Renee
hi ... I think that this is more or less what the other folks were suggesting that you try ...
* compute mean and 95% CI;
proc summary data=sashelp.class nway;
where age between 12 and 15;
class age;
var height;
output out=stats (drop=_:) lclm=low mean=mean uclm=high;
run;
* rearrange the data;
data stats (keep=age x1 x2);
set stats;
x1=mean; x2=low; output;
x1=.; x2=high; output;
run;
goptions reset=all gunit=pct ftext='calibri' htext=3;
* one symbol for the mean (dot), one symbol for the CI;
symbol1 f='wingdings' v='6c'x c=blue w=2 h=4;
symbol2 i=hilotj c=blue w=2;
axis1 minor=none offset=(5,5)pct label=('AGE');
axis2 label=(a=90 'HEIGHT');
proc gplot data=stats;
plot x1*age=1 x2*age=2 / overlay noframe haxis=axis1 vaxis=axis2;
run;
quit;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.