/* ncinfm.sas */ /* */ /* read infant mortality data */ /* */ options ls=80 ; data infm ; length county $12 ; ***** tab delimited ; infile 'ncinfmort.txt' dlm='09'x dsd firstobs=6 ; if( _n_ > 100 ) then stop ; * don't read footer ; input county totd totrate whd whrate mind minrate ; run ; /* */ /* read county economic data */ data econ ; length county $12 ; * long county names ; infile 'NCCounty03q4.txt' dlm='09'x firstobs=2 ; /* ***** skip some vars */ input fips county cpop cpopr x1-x7 hinc pcpi90 pcpi01 pov ; county = upcase(county) ; * same case as above ; drop x1-x7 ; run ; /* */ /* put them together */ /* but sort first */ proc sort data=infm ; by county ; run ; proc sort data=econ ; by county ; run ; data both ; merge infm econ ; by county ; * always merge by ; run ; /* */ /* now the regression analysis */ /* avoid the smallest counties but what */ /* about Wake & Mecklenburg ? */ proc reg data=both ; where ( 2 < cpopr < 76 ) ; model totrate = pcpi01 ; * per capita personal income ; title 'regression analysis of infant mortality on income' ; run ; /* may be useful later */ proc means data=both mean var css ; var pcpi01 ; run ; proc plot data=both ; plot totrate*pcpi01 ; run ; regression analysis of infant mortality on income 1 17:54 Sunday, August 30, 2009 The REG Procedure Model: MODEL1 Dependent Variable: totrate Number of Observations Read 73 Number of Observations Used 73 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 20.03609 20.03609 4.71 0.0333 Error 71 302.05652 4.25432 Corrected Total 72 322.09260 Root MSE 2.06260 R-Square 0.0622 Dependent Mean 8.86164 Adj R-Sq 0.0490 Coeff Var 23.27559 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 12.45565 1.67360 7.44 <.0001 pcpi01 1 -0.00015025 0.00006923 -2.17 0.0333 regression analysis of infant mortality on income 2 17:54 Sunday, August 30, 2009 The MEANS Procedure Analysis Variable : pcpi01 Mean Variance Corrected SS -------------------------------------------- 23520.36 16440859.85 1627645125 -------------------------------------------- regression analysis of infant mortality on income 3 17:54 Sunday, August 30, 2009 Plot of totrate*pcpi01. Legend: A = 1 obs, B = 2 obs, etc. totrate | 20 + | | | AA 18 + | | | A 16 + | | A | A A 14 + | A | A A | 12 + A B A A A | A | A A A A A | A AA A AA A 10 + A A A | A A | AAA A B A AA A A A A | AA A AA A A 8 + AA B A A | A B A B A A | A BA AA B B | A AB A A A A 6 + C A A A | A | A | A 4 + A | A A | | A 2 + | | A | 0 + A | ---+----------+----------+----------+----------+----------+----------+-- 10000 15000 20000 25000 30000 35000 40000 pcpi01