options pagesize=47 linesize=64; filename grafout 'l07.ps'; goptions device=pslmono gsfname=grafout gsfmode=append; data larynx; infile 'larynx.dat'; input stage time age year status; year=year-74; stg2=0; stg3=0; stg4=0; if stage=2 then stg2=1; if stage=3 then stg3=1; if stage=4 then stg4=1; run; data smlar; set larynx; if age<60 then; else delete; run; proc phreg data=smlar; title1 'Small Data Set Example showing Infinite Estimate'; model time*status(0)=age year stg2 stg3 stg4; run; /* Calculate baseline hazard for individual 50 years old, in 1979. Note that year is defined as years since 1974. */ data friend; input age year; stg2=0; stg3=0; stg4=0; cards; 50 5 ; run; proc phreg data=larynx noprint; model time*status(0)=age year stg2 stg3 stg4; baseline out=baseout survival=s covariates=friend/nomean; run; proc gplot data=baseout; title1 'Baseline survival function'; symbol1 i=stepljs; plot s*time; run; /* Commands to do model selection .*/ proc phreg data=larynx; model time*status(0)=stg2 stg3 stg4 age year/ selection=score; run; /* To do model selection using AIC, we would have to fit all models separately: proc phreg data=larynx; model time*status(0)=stg2 stg3 stg4 ; run; proc phreg data=larynx; model time*status(0)=age ; run; proc phreg data=larynx; model time*status(0)=year; run; proc phreg data=larynx; model time*status(0)=stg2 stg3 stg4 age ; run; proc phreg data=larynx; model time*status(0)=stg2 stg3 stg4 year; run; proc phreg data=larynx; model time*status(0)=age year; run; proc phreg data=larynx; model time*status(0)=stg2 stg3 stg4 age year; run;*/