x cd /pub/data/acspums/Tools; %let pgm=acs2004_2007_reconvert; filename pgm "&pgm..sas"; *--- In Novermber 2010 the Bureau started re-releasing many PUMS files with minor corrections. This setup takes the downloaded and unzipped SAS data sets (renamed interactively so that the names include the year) and converts them to acspums data sets. Same names as before, but slightly updated data. jgb, 11-11-10 ---*; libname acspums '/pub/data/acspums'; libname dwnlds '/pub/data/acspums/updatedownloads2008'; *options mlogic symbolgen; options compress=char; %macro doit(yr); %local asfx bsfx; %*---Need to alter logic for 2006 and later since that is when they went to a and b sets--; %if &yr ge 06 %then %do; data acspums.usprecs&yr.b(index=(st)); set dwnlds.psam_pusb&yr; run; data acspums.ushrecs&yr.b(index=(st)); set dwnlds.psam_husb&yr; run; %let bsfx=b; %let asfx=a; %end; options mprint; %if &yr=04 %then %do; data acspums.usprecs&yr; set dwnlds.psam_pus&yr; run cancel; *<===already ran ok===; data acspums.ushrecs&yr; set dwnlds.psam_hus&yr; run; data acspums.mohrecs&yr.; set acspums.ushrecs&yr; where st='29'; run; data acspums.moprecs&yr.; merge acspums.usprecs&yr acspums.mohrecs04(keep=serialno st in=inmo); by serialno; *where st='29'; if inmo; run cancel; *<===did not work. The usprecs04 set is not sorted by serialno---; %end; %else %do; data acspums.usprecs&yr(index=(st)); set dwnlds.psam_pus&asfx.&yr; run; data acspums.ushrecs&yr(index=(st)); set dwnlds.psam_hus&asfx.&yr; run; data acspums.mohrecs&yr.; set acspums.ushrecs&yr.&bsfx; where st='29'; run ; data acspums.moprecs&yr.; set acspums.usprecs&yr.&bsfx; where st='29'; run %end; %mend doit; %*doit(04); %doit(05); %doit(06); *---what about 2007 data??? Appears not to have been updated (yet) ---;