x cd /pub/data/acs2007/Tools; %let pgm=cnvt_census_to_sas; filename pgm "&pgm..sas"; /*--- After we create uscensusprofiles and basetables, we need to merge these two datasets together and create our own mcdc dataset. 9/18/2008 - bce ---*/ %let period=3yr; %let year=2005 to 2007; *libname user '/SAS_temp/user'; libname acs2007 '/pub/data/acs2007'; libname profiles '/pub/data/acs2007/profiles'; libname basetbls '/pub/data/acs2007/basetbls'; *libname libsum '/pub/data/acs2007/summary'; options obs=max; options compress=binary; * compresses all the datasets; proc sort force data=acs2007.allgeos. by geoid; run; proc sort data=profiles.uscensusprofiles. by geoid; run; /* proc sort data=basetbls.basetables. by geoid; run; */ * merge uscensusprofiles and summary data sets together; data merged1; merge profiles.uscensusprofiles&period(in=x) basetbls.ustabs00_07&period basetbls.ustabs09_16&period basetbls.ustabs17_20&period basetbls.ustabs25_26&period acs2007.allgeos&period(in=z); by geoid; if x=1; if z=1; run; %let dvmode=meta; %*--the "dovar mode" global parm controls what kind of output is generated by the dovar macro. The values are data or meta, which cause it to either generate actual conversion data step code or code to create metadata set Variables. The value is also looked at by smaller macros which generate the start and end of the data steps during which the dovar macro invocations take place. --*; title "&pgm: Create acs2007 profiles and profilevars datasets"; %global pctof table curtable curtabno dvmode display; %let curtabno=0; %let display=1; %let REFTABLES=; %macro cnvtmeta(mode); %global setin dvmode; %let setout=&setin; *--by default we use the input set name base as name of output set--; %let dvmode=&mode; %if &dvmode = %str(data) %then %do; *---------Here is the conversion data step-------------*; data acs2007.usmcdcprofiles. length default=5; * Obs 5 esriid $16; length years $12 period $3; set merged1; *label esriid='Id field to link to ESRI map files'; %if &period eq %then %do; Period="1yr"; %end; %else %do; Period="&period"; %end; Years="&year"; %end; %else %if &dvmode=%str(meta) %then %do; *------Here is the data step that generate sf3x.Variables when dvmode=meta-----------; data acs2007.Variables(label="Meta data describing the variables on profiles datasets"); attrib Name label='Variable Name' length=$32 Label length=$80 format=$char. Definition length=$200 label='Definition - Code used to derive' Comment length=$400 Format length=$16 TypeLen length=$8 label='Variable type and length' Universe length=$64 UnivVar length=$32 label='Universe Variable' WtVar length=$32 label='Weight Variable' Lvl length=3 label="Data Indent Level" Display length=3 label="Display in std report?" PctFlag length=3 label='Pct Variable Flag' Table length=$80 TableNo length=3 label='Table #' Keywords length=$80 Year length=$4 Source length=$40 RefTables length=$40 label='Related Table(s)' ; retain Year '2007'; retain Source '2007 ACS Profiles, US Census Bureau'; %end; %else %put ***** dvmode parm value not recognized: value= &dvmode ; options NOmprint; %include 'invoke_dovars.sas'; %*<----this module does the work of assigning the global parms and invoking the dovars parm for each variable on the dataset. Which means this module (cnvtsf3x.sas) does not really define what sf32000x is, it is this included module that really does it. ----; %if &dvmode=%str(data) %then %do; keep geoid areaname years period sumlev state geocomp geocomp_name; keep county placefp cbsa metrodiv logrecno; keep TotPop -- DateCreated; drop _:; drop moe:; drop b0: b1: b2:; run; %end; %else %if &dvmode=%str(meta) %then %do; *-----meta processing-----------------------------; run; options nonumber nodate orientation=landscape nocenter; ods printer pdf file="../Variables.pdf" ; ****orient=landscape; ods html file="../Variables.html" contents="../VariablesContent.html" style=osedablue; ods listing close; proc print data=acs2007.Variables label; where pctflag=0 or UnivVar=' '; *<--do not show the Pct variables unless they are stand-alone--; by table notsorted universe notsorted; id name; var label--comment UnivVar WtVar; format label $char.; title 'Metadata for the acs2007 profiles (Partial listing of Variables dataset)'; footnote 'Note: Universe Variable is denominator used to create corresponding Pct Variable'; title2 "Revised as of &sysdate &systime"; run; ods printer close; ods html close; %end; %mend cnvtmeta; %cnvtmeta(meta) ; options nosource2; %cnvtmeta(data) ; run; /* proc datasets library=acs2007 nolist; modify usmcdcprofiles&period(read=budweisr); quit; */