x cd /pub/data/pums2000/Tools; %let pgm=regen_views; filename pgm "&pgm..sas"; *--Regenerate all of our data step views following migration to version 9 where they could not be migrated. jgb, 12-29-04. NOTE that this MUST be run under sasv9 or IT WILL NOT WORK!!!!! --*; %let pumspath=%str(/pub/data/pums2000); libname pums2000 '/pub/data/pums2000'; title "&pgm : Regenerate PUMS Data Step Views for V9"; options nosource2 nomprint; %macro doit(state,stab); data pums2000.&stab.5(label="View merging H and P 5% data for &stab")/view=pums2000.&stab.5; merge "&pumspath/&stab.hrecs5" "&pumspath/&stab.precs5"; by state puma1 puma5 serialno; run; *** proc contents data=pums2000.&stab.5 position; *** title2 "Contents Report for &stab View"; *** run; %mend doit; *--the dostates macro generates a series of invocations of doit, using the state fips codes to create the postal abbreviations and assigning the global var statenm--; %dostates(17 20 29,names=1); *--Illinois, Kansas, Missouri--; %dostates(01 02 04 05 06 08 09 10 11 12 13 15 16,names=1); *--Alabama to Idaho--; %dostates(18 19 21 22 23 24 25 26 27 28,names=1); *--Indiana to Mississippi--; %dostates(30 31 32 33 34 35 36 37 38 39 40,names=1); *--Nebraska to Oklahoma--; %dostates(41 42 44 45 46 47 48 49 50 51 53 54 55 56 72,names=1); *--Oregon to Wyoming + PR--; %macro doit1(state,stab); data pums2000.&stab.1(label="View merging H and P 1% data for &stab")/view=pums2000.&stab.1; merge "&pumspath/&stab.hrecs1" "&pumspath/&stab.precs1"; by state puma1 serialno; run; %mend doit1; %dostates(17 20 29,mac=doit1); *============this is basically just a total rerun of the union_all_states setup===========*; %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; /*<=========================Comment out===================================== 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; ===========================End commented out================================ */