x cd /pub/data/acspums/Tools; %let pgm=acs20xx; filename pgm "&pgm..sas"; *---Access Unix sas datasets for the 20&yr pums for Mo & US. As downloaded from Census Bureau FTP site, http://www2.census.gov/acs2013_XXX/pums/ (substitute year for 2013 and 1yr/3yr/5yr for XXX). -or- http://www2.census.gov/programs-surveys/acs/data/pums/// . 10-27-14, jgb. The original .zip files were downloaded to the downloads subdir of acspums and we then extracted the 4 "psam" data sets used in this setup (2 Precs and 2 Hrecs sets - the data were split in 2). They will be deleted once we are sure the conversion worked. 03-02-15: Orignal setup was acs20xx1yr.sas and only processed the single year acspums data. Setup will now process any or all periods for the &year vintage. The Bureau issued a recall on the 2013 acspums data - both 1 and 3yr periods - in Feb 2015. We re-downloaded the us and mo files (3yr only for mo for now) and have modified this setup so that the unzipping is done as part of this setup in the unzipem macro. We added the period suffix ("3yr") to the .zip files so we could have them 1 and 3yr .zip files in the same downloads dir. Not much conversion going on here. We are mostly just copying and compressing to save space. We are also adding vintage and period variables for the first time, (vintage 2013 data). ---*; libname acspums '/pub/data/acspums'; libname dwnlds '/pub/data/acspums/downloads'; libname tempsas '/SAS_temp/userb'; %let year=2013; %let yr=%substr(&year,3,2); *<=======================!!!!!Change This Each Year!!!!!!!!!!!!!!!!!!!!!!!!!!!===; %let yearm2=%eval(&year-2); %let yearm4=%eval(&year-4); options compress=binary; *---We only get about 25% reduction. Better than nothing.---; x cd /pub/data/acspums/downloads; *<----so we can unzip the zip files with the sas data sets inside---; %macro unzipem(state); %*--state is us or a state abbrev. period is blank or 3yr or 5yr--; x unzip unix_h&state.&psfx -d /SAS_temp/userb ; x unzip unix_p&state.&psfx -d /SAS_temp/userb ; %mend unzipem; %let psfx=; *---for 1yr data---; %unzipem(us); %unzipem(mo); *-----------------------------------Single Year Data--------------------------------------------*; data acspums.usprecs&yr(label="&year Person data Alabama thru Mississippi"); retain vintage "&year" period "1"; set tempsas.psam_pusa; run; data acspums.ushrecs&yr(label="&year Housing Unit data Alabama thru Mississippi"); retain vintage "&year" period "1"; set tempsas.psam_husa; run; proc freq data=acspums.ushrecs&yr; table st; title2 "ushrecs&yr"; run; data acspums.usprecs&yr.b(label="&year Person data Missouri thru Wyoming"); ; retain vintage "&year" period "1"; set tempsas.psam_pusb; run; data acspums.ushrecs&yr.b(label="&year Housing Unit data Missouri thru Wyoming"); retain vintage "&year" period "1"; set tempsas.psam_husb; run; proc freq data=acspums.ushrecs&yr.b; table st; title2 "ushrecs&yr.b"; run; data acspums.mohrecs&yr.; retain vintage "&year" period "1"; set tempsas.psam_h29; *---delete the dwnlds data set after convert--; *where st='29'; run; data acspums.moprecs&yr.; retain vintage "&year" period "1"; set tempsas.psam_p29; *where st='29'; run; *-----------------------------------3yr data--------------------------------------------*; %let psfx=3yr; *---for 3yr data---; %unzipem(mo); %*--unzipem(us); *<===Not now. Check to see how many alpha sets there are for the various state intervals. ==; /*<=========================Comment out===================================== data acspums.usprecs&yr&psfx(label="%yearm2 - &year 3yr Person data Alabama thru Mississippi"); retain vintage "&year" period "3"; set tempsas.psam_pusa; run; data acspums.ushrecs&yr&psfx(label="&yearm2 - &year 3yr Housing Unit data Alabama thru Mississippi"); retain vintage "&year" period "3"; set tempsas.psam_husa; run; proc freq data=acspums.ushrecs&yr&psfx; table st; title2 "ushrecs&yr&psfx"; run; data acspums.usprecs&yr.&psfx.b(label="&yearm2 - &year 3yr Person data Missouri thru Wyoming"); ; retain vintage "&year" period "3"; set tempsas.psam_pusb; run; data acspums.ushrecs&yr&psfx..b(label="&yearm2 - &year 3yr Housing Unit data Missouri thru Wyoming"); retain vintage "&year" period "3"; set tempsas.psam_husb; run; proc freq data=acspums.ushrecs&yr&psfx.b; table st; title2 "ushrecs&yr&psfx.b"; run; ===========================End commented out================================ */ data acspums.mohrecs&yr.&psfx(label="&yearm2 - &year 3yr Housing Unit data for MO"); retain vintage "&year" period "3"; set tempsas.psam_h29; *---delete the dwnlds data set after convert--; *where st='29'; run; data acspums.moprecs&yr&psfx.(label="&yearm2 - &year 3yr Person data for MO"); retain vintage "&year" period "3"; set tempsas.psam_p29; *where st='29'; run;