x cd /pub/data/pums2000/Tools; %let pgm=gen_Valfmats; filename pgm "&pgm..sas"; *----Generate the pums2000 value label formats. Using input from xls files provided by the Census Bureau via Roy Williams, MISER. John Blodgett, OSEDA, U. of Missouri Outreach & Extension Under contract with the Missouri Census Data Center. Oct. 2003 ----*; title "&pgm : Generate Value Labels Dataset and SAS Formats"; filename inp "pumsrecdiffsp.csv" ; filename inh "pumsrecdiffsh.csv" ; libname pums2000 '/pub/data/pums2000'; libname user '/SAS_temp/user'; title "&pgm: Generate pums2000 Values Labels metadata set and SAS Format Modules"; *---There are two separate files: 1 for the H recs and 1 for the P recs. We run the same program for reading each. --; %macro dofile(rt); data &rt; infile in&rt dsd missover firstobs=7; length rt $1 beg end $3 len $2 an $1 varname $8 varlabel $96 dum1-dum4 $1 code5 code5high $8 label5 $96 code1 code1high $8 label1 $96 note $96; input rt -- note; if rt ne ' '; if index(varlabel,'Allocation Flag')=0; *--skip these--; name=varname; if code1 ne ' ' and code1high=' ' then do; codeval=code1; vallabel=label1; if code5=code1 and code5high=' ' and label1=label5 then do; sample='b'; output; end; else do; *---its a 1 pct sample value only--; sample='1'; output; if code5 ne ' ' and code5high=' ' then do; sample='5'; codeval=code5; vallabel=label5; output; end; end; end; else if code5 ne ' ' and code5high=' ' then do; *---its a 5 pct sample value only--; codeval=code5; vallabel=label5; sample='5'; output; return; end; else delete; drop rt--note; *<---all input variables--; *--we keep name, codeval,m vallabel, sample --; run; proc print data=&rt (obs=300); by name notsorted; id name; title2 "Partial listing if &rt"; run; %mend dofile; %dofile(p); %dofile(h);