x cd /pub/data/acs2007/Tools; %let pgm=cnvt_census_to_sas; filename pgm "&pgm..sas"; /*--- This is the one you are probably looking for. This creates acs2007.usmcdcprofiles / .usmcdcprofiles3yr. You must run it twice to create the two data sets, changing the value of the period global parm. It can have a value of null or 3yr . After we create uscensusprofiles and basetables, we need to merge these two datasets together and create our own mcdc dataset. 9/18/2008 - bce Rerunning conversion after some variables fixes, 7-15-09, jgb. And again 8-10-09-- (3yr in batch and 1yr in DM mode) ; ---*/ %let period=; *<===================comment out this stmt to get 3yr period conversions====; %let year=2007; *<=====; %*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; /* =======================Begin comment================ data dups; set basetbls.ustabs00_07(keep=geoid sumlev areaname); by geoid; if not (first.geoid and last.geoid); obsno=_n_; run cancel; *<---special step used to diagnose problem with duplicate geoids on these sets---; 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 cancel; *---- merge uscensusprofiles and summary data sets together-----; data merged1. *<==============================reference to variable list b01001m: in ustabs00_07_moes&period removed for now because those variables do not exist on that data set! -----------------------------------------; merge profiles.uscensusprofiles&period(in=inprofiles) basetbls.ustabs00_07&period basetbls.ustabs00_07_moes&period(keep=geoid b01001m: ) basetbls.ustabs09_16&period basetbls.ustabs09_16_moes&period(keep=geoid b09016m: b14001m1 ) basetbls.ustabs17_20&period basetbls.ustabs17_20_moes&period(keep=geoid c17001m: b19325m: ) basetbls.ustabs25_26&period basetbls.ustabs25_26_moes&period(keep=geoid b25004m: c25033m: ) acs2007.allgeos&period(in=ingeos); *<--------------Notice that we do not reference basetbls.ustabs08 . No need to since we are not using any b08 tables--; by geoid; * if x=1; * if z=1; if inprofiles and ingeos; if first.geoid; *<====to get around a (temporary?) glitch involving region-level geographic component summaries--; run; ======================End comment================== */ %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 dvmode; %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. by geoid; if first.geoid; *<=================================; *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; ods listing; %end; %mend cnvtmeta; %*cnvtmeta(meta) ; options nosource2; %cnvtmeta(data) ; run; /* proc datasets library=acs2007 nolist; *--left over from when we had an embargo on these data--; modify usmcdcprofiles&period(read=budweisr); quit; */