x cd /mscdc/data/popests/Tools; %let pgm=sc99ts.cnvt; filename pgm "&pgm..sas"; *--xx controls whether it is a Missouri only conversion or an entire-US convert--; *let xx=mo; %let xx=us; %let UXX=%upcase(&xx); %let year=1999; *---Convert 1999 Sub-county population estimates -- time series, 90-99. Store results as a single SAS dataseet - popests.sc99ts, = mo and us . Run twice - once for Missouri only and once for entire US . JGB, 10-00--; libname popests '/mscdc/data/popests'; libname corrlst '/mscdc/data/corrlst' access=readonly; filename usURLin URL "http://www.census.gov/population/estimates/metro-city/placebyst/SC99T7_US.txt"; filename usout "/mscdc/data/popests/usplace99.txt"; *---------this step reads the URL file of the US place estimates and copies the file for local processing--------*; data _null_; infile usURLin truncover; input fips $8.; if fips in ('01','56 86665') then put _all_; *--shows where 1st and last lines occur-; file usout; put _infile_; run cancel; ***************Ran already*************************************; filename usout clear; title "&pgm: Convert 1990-1999 Census Bureau Place-level Population Estimates"; *title2 "Source: U.S. Census Bureau, FSCPE -- " " Browser captured text from Census Bureau Web Site 10-00"; options linesize=132 pagesize=59 nodate; options center; %let sasout=popests.sc99ts&xx; *<====the name of sas output dataset; %macro gparms; %*-set global parms--; %global frstobs1 frstobs2 uxx ntop; %if &uxx=US %then %do; %let frstobs1=15; %let frstobs2=19477; %let ntop=100; *<===Needs to be edited!!=; filename in "/mscdc/data/popests/usplace99.txt"; %end; %else %do; %let frstobs1=15; %let frstobs2=976; %let ntop=50; *<==edited per perusal 10-17-00; filename in "/mscdc/data/popests/sct99_MO.txt"; %end; %mend gparms; %gparms ; %put **Parameters are: xx=&xx uxx=&uxx frstobs1=&frstobs1 frstobs2=&frstobs2; data block1(label="Sub-co (place) time series pop ests, &uxx"); infile in firstobs=&frstobs1; length state stab $2 placefp $5 areaname $40; length default=5 popc90 popjul90-popjul99 5 stab $2; *--Note that we are reading from a text file--*; input state $2. +1 placefp $5. +1 areaname $40. @55 (popjul99 popjul98 popjul97 popjul96 popjul95 popjul94 )(10.); label place='Place (census)' placefp='FIPS place code' popc90='Corrected 4-1-90 census pop' popjul90='Est pop 7-1-90' popjul91='Est pop 7-1-91' popjul92='Est pop 7-1-92' popjul93='Est pop 7-1-93' popjul94='Est pop 7-1-94' popjul95='Est pop 7-1-95' popjul96='Est pop 7-1-96' popjul97='Est pop 7-1-97' popjul98='Est pop 7-1-98' popjul99='Est pop 7-1-99' ; if _n_=1 then list; if state=' ' then stop; *--end of data for block 1---*; stab=put(state,$fipstab2.); format popc90--popjul99 comma7.; run; proc sort data=block1; by state placefp; run; data block2; infile in firstobs=&frstobs2; input state $2. +1 placefp $5. @55 (popjul93 popjul92 popjul91 popjul90 popc90)(10.); if _n_=1 then list; if state=' ' then stop; *--end of data for block 2---*; run; proc sort data=block2; by state placefp; run; data &sasout(index=(state) label="Place level estimates thru &year" index=(state)); merge block1 (in=in1) block2(in=in2) corrlst.uspl2co(in=inclist keep=state placefp county cntyname pflag where=(pflag)); by state placefp; label county='Primary County' pflag='2 means place in more than 1 co'; if inclist and not (in1 or in2) then delete; if not (in1 and in2) then do; put /'***Missing data for ' state= placefp= in1= in2=' ****' ; delete; end; chng9099=popjul99-popc90; if popc90 then pctc9099=100*chng9099/popc90; label chng9099='Change in pop 90-99' pctc9099='% Change in pop 90-99'; format chng9099 comma7. pctc9099 6.1; *--repeat calculation of change and pct change measures for most recent 2 yrs--; chng9799=popjul99-popjul97; if popjul97 then pctc9799=100*chng9799/popjul97; label chng9799='Change in pop over last 2 years (97-99)' pctc9799='% Change in pop 97-99'; format chng9799 comma7. pctc9799 6.1; run; proc contents data=&sasout position; title3 "Contents of &sasout"; run; proc print data=&sasout(obs=15); by state stab; title3 "First 15 Obs on &sasout"; run; x chmod 600 /mscdc/data/popests/sc99tsmo.ssd01; *<--not publicly readable yet-------; *--Do NOT run these steps until the embargo is lifted!!!!!!---------------------------*; /* *<=====================Comment Out======================== options pageno=1 nodate; proc printto print="/mscdc/reports/place_estimates_90-99_&uxx" new; title2 "Part 1a: &ntop Places in &UXX With Greatest Absolute Population Increase Since 1990"; title3 "(Long Term Population Growth)"; %rankrpt(setin=&sasout, rankvar=chng9099,order=D,n2list=&ntop,minmax=100, ids=placefp areaname state cntyname, othrvars=pctc9099 popc90 popjul94 popjul99, prntopts=label,ntitles=3) format popc90--popjul99 comma9.; run; title2 "Part 1b: &ntop Places in &UXX With Greatest Absolute Population Increase Last 2 Years"; title3 "(Short Term Population Growth)"; %rankrpt(setin=&sasout, rankvar=chng9799,order=D,n2list=&ntop,minmax=100, ids=placefp areaname state cntyname, othrvars=pctc9799 popjul97 popjul99 popc90 chng9099 pctc9099, prntopts=label,ntitles=3) format popc90--popjul99 comma9.; run; title2 "Part 2a: &ntop Places in &UXX With Greatest Absolute Population Loss Since 1990"; title3 "(Long Term Population Loss)"; %rankrpt(setin=&sasout, rankvar=chng9099,order=A,n2list=&ntop,minmax=0, ids=placefp areaname state, othrvars=pctc9099 popc90 popjul94 popjul99, prntopts=label,ntitles=3) format popc90--popjul99 comma9.; run; title2 "Part 2b: &ntop Places in &UXX With Greatest Absolute Population Loss Over Last 2 Years"; title3 "(Short Term Population Loss)"; %rankrpt(setin=&sasout, rankvar=chng9799,order=A,n2list=&ntop,minmax=0, ids=placefp areaname state, othrvars=pctc9799 popjul96 popjul99 popc90 chng9099 pctc9099, prntopts=label,ntitles=3) format popc90--popjul99 comma9.; run; ==========================End Comment========================*/