x cd /pub/data/acs2005/Tools; %let pgm=misc_metadata; filename pgm "&pgm..sas"; *----Various utility tasks related to viewing, editing and analyzing the acs2005 metadata created from the Census Bureau xls files. ----*; %let year=2005; %let rawdata=%str(/pub/data/acs&year/rawdata); libname acs&year "/pub/data/acs&year"; libname acs (acs&year); *<---create alias name---; libname profiles "/pub/data/acs&year/profiles"; libname user '/SAS_temp/userb'; *------------Examine the base tables metadata, Waves 1 and 2, to get a hanlde on how many variables we have for each table grouping, including the subject groupings based on the table numbers. ---------------*; proc format; value tabtopic 01 = Age and Sex 02 = Race 03 = Hispanic or Latino Origin 04 = Ancestry 05 = 'Foreign Born; Citizenship' 06 = Place of Birth 07 = 'Residence Last Year; Migration' 08 = 'Journey to Work; Workers Characteristics' 09 = 'Children; Relationship' 10 = 'Grandparents; Age of household members' 11 = 'Households; Families' 12 = Marital status 13 = Fertility 14 = School enrollment 15 = Educational attainment 16 = Language spoken at home 17 = Poverty 18 = Disability 19 = 'Income (Households and families)' 20 = 'Earnings (Individuals)' 21 = Veteran status 22 = 'Transfer Programs; Food Stamps' 23 = Employment status 24 = 'Industry; Occupation; Class of Worker' 25 = 'Housing (Financial and Physical Characteristics)' 99 = Imputation table for any subject ; run; data varswave1and2; set acs2005.tablevars acs2005.tablevars2(in=in2); if in2 then do; tableid=Table_Id; Name=trim(lowcase(tableid))||'i'||left(put(line_number,4.)); type=substr(tableid,1,1); wave='2'; end; else wave='1'; length TableNo TableTop 4 TableSfx $2; TableNo=substr(tableid,2,5); format tableno z5.; TableSfx=substr(tableid,7); if tablesfx ne ' ' then substr(name,7,1)=tableSfx; *<--replace lower case suffix with uppercase--; tableTop=substr(tableid,2,2); format tabletop tabtopic.; label tabletop='Table Topic'; run; proc sort; by wave tabletop tableno type tablesfx line_number; run; options nodate ; title 'Report Showing All Variables on Waves 1 and 2'; title2 'Sorted by Table Topic, Table Number and Table Type'; title3 'Tables With Alpha Suffixes Not Shown Here'; ods listing close; /* =======================Begin comment================ ods html file="../basetable_variables.html" style=minimal; proc print data=varswave1and2 n; by wave tabletop; where tablesfx=' '; id type tableno ; var line_number Name stub; format stub $char90.; run; ods html close; ======================End comment================== */ ods html file="../basetable_variable_counts.html" style=minimal; proc tabulate data=varswave1and2 ; by wave; class tabletop type; tables all tabletop, all type; title 'Counts of Variables by Table Topic and Wave Categories'; title2 'Variables in Tables with Alpha Suffixes ARE Included Here'; run; ods html close;