/* turkey.sas */ options ls=72 ps=60; data turkey; infile 'turkey.dat'; input state $ age weight; geo = (state = 'GA'); vir = (state = 'VA'); wis = (state = 'WI'); gage = age*geo; vage = age*vir; wage = age*wis; south = geo+vir; sage = age*south; x0=1; proc print data=turkey; var geo gage vir vage wis wage south sage weight; title 'turkey growth variables'; proc plot data=turkey; plot weight*age=state; title 'plot of weight versus age'; proc glm data=turkey; model weight=geo gage vir vage wis wage / noint ss1 ss2; contrast 'parallel lines' gage 1 vage -1, vage 1 wage -1; output out=new1 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title '3 separate lines: georgia, virginia, wisconsin'; proc print data=new1; var state weight age clml clmu clpl clpu yhat resid; proc plot data=new1; plot resid*age=state / vref=0; proc glm data=turkey; model weight=geo vir wis age/noint ss1 ss2; estimate '2 lines south:wisc' geo 1 vir -1; output out=new2 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title '3 parallel lines: georgia, virginia, wisconsin'; proc print data=new2; var state weight age clml clmu clpl clpu yhat resid; proc plot data=new2; plot resid*age=state / vref=0; proc glm data=turkey; model weight=south wis age/noint ss1 ss2 clparm; estimate '1 line (south-wisc)' south 1 wis -1; output out=new3 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title '2 parallel lines: south, wisconsin'; proc print data=new3; var state weight age clml clmu clpl clpu yhat resid; proc plot data=new3; plot resid*age=state / vref=0; proc univariate data=new3 plot normal; var resid; proc rank data=new3 normal=blom out=new3a; var resid; ranks nscore; proc plot data=new3a; plot nscore*resid; proc glm data=turkey; model weight= x0 age/noint p ss1 ss2; output out=new4 r=resid p=yhat; title 'one line'; proc plot data=new4; plot resid*age=state / vref=0; run;