x cd /pub/data/popests/Tools; %let pgm=uscomNST; filename pgm "&pgm..sas"; *----Setup to read Census Bureau/FSCPE estimates of cumulative components of change for the Nation and States ONLY. This dataset will be replaced each year, when and if the Bureau releases comparable data. There is no indication that they will be consistent, however. Being coded 12/04 to access data cumulative for 2000 to 2004. The input file did not include a base pop and current estimate so we are merging with some sf12000 data to add these variables. NOTE: Data is for the nation and states ONLY (no counties). Initial coding, 12/2004 by John Blodgett, Missouri Census Data Center. ----; %let year=2004; *<=================EDIT EACH TIME=============; %let yr=%substr(&year,3,2); filename csvin "/pub/data/popests/uscomnst&yr..csv"; *<--from Census. In 04 came as an xls file attached to e-mail from CLO. We exported and uploaded the CSV file.---; libname popests "/pub/data/popests"; title "uscomNST.sas: US Nation and State Estimates with Cumulative Components of Change Since 2000 Census"; title2 "For &year"; options MPRINT; *---get the base pops from previous year estimates at county level (for now)--; data basepops; set popests.uscom03(keep=sumlev state stab reg div popcen2k pop00C areaname); *<===; where sumlev in ('010','040'); rename areaname=areanameck; run; data popests.uscomnst(label="Pop Ests w Components of change, 2000-&year, for US and States"); *--Attribute statement(s) generated by genattr macro, then edited--; Attrib State LENGTH=$2 Label="FIPS state" Stab length=$2 Label="State Postal Abb" AreaName LENGTH=$40 Reg length=$1 label="Region" Div length=$1 label="Division" SumLev LENGTH=$3 Label="Geographic summary level" format=$3. Popcen2k length=5 label='Unadjusted Census 2k pop' format=comma11. Pop00C LENGTH= 5 Label="4/1/2000 resident pop (estimates base) " format=comma11. Popest LENGTH= 5 Label="Latest Total pop Est. - 7/&yr" format=comma11. PopChang LENGTH= 5 Label="Net change in pop 4/00(c)-7/&yr" format=comma10. PctChang LENGTH=4 Label="% Change in Pop 4/00-7/&yr" format=f5.1 Births length=5 Label="Total Births, 4/00 to 7/&yr" format=comma10. Deaths length=5 Label="Total Deaths, 4/00 to 7/&yr" format=comma10. NatrlInc length=4 Label="Natural Increase, 4/00 to 7/&yr" format=comma9. NetMig length=4 Label="Net Migration, 4/00 to 7/&yr" format=comma10. DomMig length=4 Label="Net Domestic Mig 4/00 to 7/&yr" format=comma9. IntMig length=4 Label="Net International Mig 4/00 to 7/&yr" format=comma9. ; infile csvin dsd dlm="," lrecl=280 firstobs=5 missover; informat popchang natrlinc births deaths netmig intmig dommig comma.; input areaname PopChang NatrlInc Births Deaths NetMig IntMig DomMig; if _n_ gt 1 then Areaname=substr(areaname,2); *--remove the leading dot--; *---They did not use FIPS state codes on the files be we rely on the basepops dataset to be in 1-to-1 correspondence.---; set basepops; if areaname ne areanameck then do; put '******Data out of sync between CSV file and basepops....aborting the run****** ' / _all_; abort abend; end; drop areanameck; PopEst=pop00c + PopChang; PctChang=100*PopChang/pop00C; output; if areaname='Wyoming' then stop; *--avoid reading footnote lines--; run; proc print data=popests.uscomnst; id state stab areaname; by sumlev; sum _numeric_; run;