x cd /pub/data/pums2000/Tools; %let pgm=union_all_states; filename pgm "&pgm..sas"; *----Define the SQL views ushrecs5 and usprecs5 as the union of all the individual state files. These will be too large for most dexter access but we can use it in-house and we can retrieve subsets for users. jgb, 3-23-04. ----*; libname pums2000 "/pub/data/pums2000"; libname pumsw '/pub/data2/pums2000_temp' outrep=windows_32 ; options mprint; %macro doit(state,stab); pums2000.&stab.hrecs5 %mend doit; data pums2000.ushrecs5/view=pums2000.ushrecs5; set %dostates open=defer; run; %macro doit(state,stab); pums2000.&stab.precs5 %mend doit; data pums2000.usprecs5/view=pums2000.usprecs5 ; set %dostates open=defer; run; data pums2000.us5/view=pums2000.us5; merge pums2000.ushrecs5 pums2000.usprecs5; by state puma1 puma5 serialno; run; proc print data=pums2000.ushrecs5(keep=state puma1 puma5 serialno obs=100); title2 'First 100 Obs on pums2000.ushrecs5'; by state; run; options fullstimer msglevel=i; proc freq data=pums2000.ushrecs5; table state*puma1/list; format state $state.; run ; proc freq data=pums2000.us5; table state*puma1/list; format state $state.; run; /* <==========================ABANDONED ATTEMPT .... these datasets are too large - precs is over 2G limit=========== *------Part 2: 7-31-06: Create actual SAS datasets in Windows format for the entire US that we can zip up and make available as a downloadable file. Note: Tried defining an index (state) for these datasets but it does not work with non-native engine (outrep). -----------*; data pumsw.ushrecs(label='Household records for entire US, 5 Pct Sample' compress=yes); set pums2000.ushrecs5; run; data pumsw.usprecs(label='Person records for entire US, 5 Pct Sample' compress=yes); set pums2000.usprecs5; run; *---create test code to merge the 2 together----*; data test; merge pumsw.ushrecs(in=inhrecs) pumsw.usprecs(in=inprecs); by state puma1 puma5 serialno; if state gt '02' then stop; run; proc freq data=test; table state*( puma1 puma5); run; x cd /pub/data2/pums2000_temp'; x zip -9 uspums5w.zip ushrecs.sas7bdat usprecs.sas7bdat; ======================End comment================== */