%include goptions; goptions hsize=7in vsize=6in horigin=1in vorigin=2in; goptions htext=1.9 htitle=2; *---------- Personality Test and Improvement in Therapy ------------; Title 'Simple Regression: 95% Confidence Limits'; data THERAPY; input NAME $ SEX $ PERSTEST THERAPY ; label PERSTEST = Personality Test Score THERAPY = Improvement in Therapy ; datalines; John M 26 32 Susan F 24 40 Mary F 22 44 Paul M 33 44 Jenny F 27 48 Rick M 36 52 Cathy F 30 56 Robert M 38 56 Lisa F 30 60 Tina F 34 68 ; proc reg data=therapy; model therapy = perstest / P CLI CLM; plot therapy * perstest /* p. * perstest / overlay */ ; id name; symbol1 v=dot h=1.7; symbol2 v=+ i=rl ; /* The calculated values can also be saved to an output data set */ output out=RESULTS /* produce an output dataset */ P = pred R=resid /* with PREDicted & RESIDuals*/ L95M=l95m U95M=u95m /* & 95% CI for E(yhat) */ L95 =l95 U95 =u95 ; /* & 95% CI for yhat(new) */ data anno; set results; where (perstest=36); retain xsys ysys '2'; function = 'LABEL'; position='6'; x = perstest; y = pred; text = put(y,5.1); output; y = l95; text = put(y,5.1); output; y = u95; text = put(y,5.1); output; y = l95m; text = put(y,5.1); output; y = u95m; text = put(y,5.1); output; data anno2; set results; where (perstest=22); retain xsys ysys '2'; function = 'LABEL'; position='6'; x = perstest; color ='green'; y = l95; text = 'CLI'; output; y = u95; text = 'CLI'; output; color ='red'; y = l95m; text = 'CLM'; output; y = u95m; text = 'CLM'; output; data anno; set anno anno2; run; proc gplot data=RESULTS; plot therapy * perstest=1 therapy * perstest=2 / overlay vaxis=axis1 haxis=axis2 href=36 lhref=33 chref=black anno=anno; symbol1 v=dot h=1.7 i=rlclm cv=black ci=blue co=red w=3; symbol2 v=none i=rlcli cv=black ci=blue co=green; axis1 order=(20 to 90 by 10) label=(a=90 r=0) ; axis2 order=(20 to 40 by 2) ;