/* sinfm3.sas */ /* */ /* compute power of test to detect trend */ /* of infant mortality and income */ /* */ options ls=80 ; /* read county economic data */ data econ replicate ; length county $12 ; drop x1-x7 ; infile 'NCCounty03q4.txt' dlm='09'x firstobs=2 ; /* ***** skip some vars */ input fips county cpop cpopr x1-x7 hinc pcpi90 pcpi01 pov ; /* now just the bigger counties */ /* but avoid the two biggest: Wake & Mecklenburg */ if( cpopr < 3 ) then delete ; if( cpopr > 75 ) then delete ; output econ ; * old econ dataset ; /* generate some new y's */ do rep = 1 to 100 ; * 100 reps ; totrate = 12.5 - 0.0001*pcpi01 + 2*rannor(5151917) ; * new y ; /* ****** small slope */ output replicate ; end ; run ; /* should have 73*100 obs */ proc sort data=replicate ; by rep ; run ; /* take a look */ proc print data=replicate (obs=5) ; title 'top of replicate dataset' ; run ; proc print data=replicate (firstobs=7295) ; title 'bottom of replicate dataset' ; run ; /* now regression analysis */ /* */ /* */ /* ******* close means turn off usual destination(listing) */ ods listing close ; proc reg data=replicate ; * no need for noprint ; model totrate = pcpi01 ; * income ; ods output ParameterEstimates=pe ; * put info into dataset pe ; title 'regression analysis of infant mortality on income' ; by rep ; * BY variable ; run ; ods listing ; /* ******* go back to usual printing */ proc print data=pe (obs=10) ; title 'top of pe dataset created by ODS' ; run ; proc print data=pe (firstobs=190) ; title 'bottom of pe dataset created by ODS' ; run ;