Hi all,
I want to graph a scatter plot overlayed by 95%CI, 99%CI and mean value (all three are lines). My code is
goptions reset=all;
goptions device=sasemf xmax=15cm ymax=8cm xpixels=1600 ypixels=800 hsize=15cm vsize=8cm cback='00000000' ctext=black rotate=landscape;
symbol1 interpol=join colour=lightgreen width=3;
symbol2 interpol=join colour=orange width=3;
symbol3 interpol=join colour=red width=3;
symbol4 interpol=none value=dot colour=black width=3;
symbol5 interpol=none value=dot colour=blue width=3;
axis1 label=(C=black 'Total Number of Procedures' ) order=(50 to 650 by 50) ;
axis2 label=(a=90 r=0 C=black 'Standardised Proportion') order=(0 to 0.16 by 0.02) ;
legend1 order=('overall_rate' 'upper_95' 'upper_99') value=('Overall Proportion' '95% Confidence Limit' '99.5% Confidence Limit') label=none position=(top right inside) down=4 mode=protect ;
proc gplot data=graph;
plot (overall_rate upper_95 upper_99 rratio1 rratio2)*total / overlay legend=legend1 haxis=axis1 vaxis=axis2 noframe areas=1;
run;
quit;
total | overall_rate | upper_95 | upper_99 | rratio1 | rratio2 |
50 | 0.027924 | 0.073592 | 0.088038 | 0.042229 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0.080207 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0.038715 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0.038715 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0 | |
51 | 0.027924 | 0.073142 | 0.087446 | 0.021527 | |
52 | 0.027924 | 0.072706 | 0.086871 | 0.03728 | |
52 | 0.027924 | 0.072706 | 0.086871 | 0.03728 | |
52 | 0.027924 | 0.072706 | 0.086871 | 0.039238 | |
53 | 0.027924 | 0.072281 | 0.086312 | 0 | |
53 | 0.027924 | 0.072281 | 0.086312 | 0.019855 | |
53 | 0.027924 | 0.072281 | 0.086312 | 0.038966 | |
55 | 0.027924 | 0.071467 | 0.085241 | 0.036494 | |
55 | 0.027924 | 0.071467 | 0.085241 | 0.036494 | |
55 | 0.027924 | 0.071467 | 0.085241 | 0.018893 | |
55 | 0.027924 | 0.071467 | 0.085241 | 0.018893 | |
56 | 0.027924 | 0.071077 | 0.084727 | 0.036774 | |
56 | 0.027924 | 0.071077 | 0.084727 | 0.110384 | |
56 | 0.027924 | 0.071077 | 0.084727 | 0.110384 | |
56 | 0.027924 | 0.071077 | 0.084727 | 0.018116 | |
58 | 0.027924 | 0.070326 | 0.083739 | 0 | |
58 | 0.027924 | 0.070326 | 0.083739 | 0.035404 | |
59 | 0.027924 | 0.069965 | 0.083264 | 0.018158 | |
60 | 0.027924 | 0.069613 | 0.082801 | 0 | |
60 | 0.027924 | 0.069613 | 0.082801 | 0.142068 | |
60 | 0.027924 | 0.069613 | 0.082801 | 0.050821 | |
61 | 0.027924 | 0.06927 | 0.082349 | 0.032482 |
It seems like only symbol1 statement does not work, other four are alright. Anyone know the problem?
Thanks,
Andrea
Its very hard to say. Have you tried changing those symbol things and seeing if the colors and such like actually change. Just thinking it may be using the defaults and looks like its working? Anyways, I would really suggest moving to sgplot/graph template language, you get a whole load more functionality and options. For instance, you can do 95% CI directly with one extract option. See:
http://blogs.sas.com/content/graphicallyspeaking/2012/01/12/custom-confidence-intervals/
For an example, and:
http://blogs.sas.com/content/graphicallyspeaking/
For a whole load of examples in various methoeds.
Hi Esteemed,
The mean value (symbol1) should be a straight line and it could not be covered by 95%CI or 99%CI lines, both of which are curve. I tried only define symbol1. It still comes out a purple box instead of a line.
95%CI and 99%CI is not directly from the data. It is calculated by expectations. So I have to keep it in a dataset and use gplot to graph them.
I will have a try sgplot later see if it works for my ideas.
By the way, COLOUR does work. 🙂
Andrea
Hi,
This correct answer is deleting area=1. Hope this is helful.
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!
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.