options linesize=80 nodate nonumber; libname fu '../../sdata'; data work1; set fu.kidney; if age=2 then a2 = 1; else a2 = 0; if age=3 then a3 = 1; else a3 = 0; data nset2; input a2 a3 neph; datalines; 0 0 1 1 0 1 0 1 1 ; proc phreg data=work1; model survt*censor(0)=a2 a3 neph / covb risklimits; baseline covariates=nset2 out=pred2 survival=S lower=S_lower upper=S_upper /nomean; data temp2; set pred2; if a2 = 0 and a3 = 0 and neph = 1 then pattern=1; else if a2 = 1 and a3 = 0 and neph = 1 then pattern=2; else if a2 = 0 and a3 = 1 and neph = 1 then pattern=3; filename gsasfile 'kidney2.gsf'; goptions reset = all gunit = pct border ftext=swissb htitle=6 htext=2.5 gaccess=gsasfile ROTATE=LANDSCAPE gsfmode=replace device=ps; /* position is the location of legend value. Compare it with ex312.sas */ legend2 down = 3 label=none shape=line(5) position=(top center inside) value=(f=swiss h=1.2 'age < 60 with a nephrectomy' 'age between 60 and 70 with a nephrectomy' 'age > 70 with a nephrectomy'); axis1 label=(h=1 f=swiss a=90) minor=(n=1); axis2 label=(h=1 f=swiss 'Survival Time') minor=(n=4); title 'Expected survival by age group'; proc gplot data=temp2; plot S*survt=Pattern / legend=legend2 vaxis=axis1 haxis=axis2 cframe=white; symbol1 interpol=stepLJ h=1 l=1 v=square c=black; symbol2 interpol=stepLJ h=1 l=2 v=diamond c=black; symbol3 interpol=stepLJ h=1 l=3 v=diamond c=black; note f=swiss h=1.5 j=c 'Hypernephroma Study'; run;