/******************************************************************** * NAME: stp28c2 SYSTEM: MSCDC PGMR: BLODGETT * * FUNCTION: Converts Special Tab Product 28 (STP28 -co-2-co mig) * * files as stored on CIESIN archive to SAS datasets. Works with * * tf, p1 and p2. Assumes input in formed of .zip files downloaded * * from ftp.ciesin.org:/pub/census/usa/stp/----- * * NOTES: * ********************************************************************/ %GLOBAL REVDATE; %LET REVDATE=22SEP95; *<----DATE OF LAST REVISION; /* Update history: 9-22-95: Creating formal macro. Was using an in-line copy prior to this (in $MD/stp/Tools/cnvtjob.sas). Removing index=(county) spec from data statement. The index files were far too large to justify their existence. */ /********************************************************************/ /* BEGIN MACRO DEFINITION */ /********************************************************************/ %macro stp28c2 (ss=,files=TF P1 P2,inpath=%quote(/tmp/gaussian/stp28)); %*--stp28 conversion macro for use with zipped files obtained from ciesin archive. Parms are: ss: 2-digit fips state code. files: specifies which of the 3 possible filetypes you want to read and convert. Default is all 3. inpath: complete pathname for where the .zip files obtained from ciesin archive, /pub/census/usa/stp/xx/xxstpss.zip, where xx is the file type (tf, p1 or p2) and ss is the state fips code. The macro uses unzip pipe to access the input data. jgb, Missouri State Census Data Center, 2-3-95----------------------; %PUT %STR( ); %PUT ***************************************************************; %put * stp28c2 macro Rev &revdate begin execution *; %put * Missouri State Census Data Center *; %PUT ***************************************************************; %PUT %STR( ); %let files=%upcase(&files); filename tfin pipe "unzip -p &inpath/tfstp&ss..zip"; filename p1in pipe "unzip -p &inpath/p1stp&ss..zip"; filename p2in pipe "unzip -p &inpath/p2stp&ss..zip"; %if %index(&files,TF) %then %do; data stp28.tf&ss; infile tfin; length state $2 county $5 state2 $2 county2 $5 popin popout 5; input county $5. county2 $5. popin popout; state=substr(county,1,2); state2=substr(county2,1,2); label popin='inmigration county2 to county, 85-90' popout='outmigration county to county2, 85-90' ; run; %end; %if %index(&files,P1) %then %do; data stp28.p1&ss(sortedby=county county2); infile p1in; length default=4 county $5 state $2 county2 $5 state2 $2; input county $5. county2 $5. race $1. sex $1. nativity $1. povstat $1. educ $1. age $2. popin popout; state=substr(county,1,2); state2=substr(county2,1,2); label popin='inmigration county2 to county, 85-90' popout='outmigration county to county2, 85-90' ; label povstat='poverty status' educ='educational attainment' age='age interval code'; run; %end; %if %index(&files,P2) %then %do; data stp28.p2&ss(index=(county) sortedby=county county2); infile p2in; length default=4 county $5 state $2 county2 $5 state2 $2; input county $5. county2 $5. spanish $1. sex $1. nativity $1. povstat $1. educ $1. age $2. popin popout; state=substr(county,1,2); state2=substr(county2,1,2); label popin='inmigration county2 to county, 85-90' popout='outmigration county to county2, 85-90' ; label spanish='Hispanic origin'; label povstat='poverty status' educ='educational attainment' age='age interval code'; run; %end; filename p1in clear; filename tfin clear; filename p2in clear; %mend stp28c2;