x cd /pub/data/sf12010x/Tools; %let pgm=ustracts080; filename pgm "&pgm..sas"; *----Create the ustracts080 national data set for hierarchal level 080: tract within cousub and place. Will be used for providing the sf1 data for the acsXXXX.ustractsh data set, which will be used in the caps10acs web app. jgb, OSEDA, MCDC . Begin coding June 1, 2013. ----*; title "&pgm: Create sf12010x.ustracts080 Dataset"; %global csvfiles; %let csvfiles=0; %*---Has 3 values: 0 means no CSV files be generated. 1 means only CSV files, no conversion. and 2 meaning do conversions AND CSV files . ----; *--csvfiles and blockonly do not really pertain, But we keep them because its easier---; %let csvfiles=0; *--for the rerun 2/12 to add geos to the blocks dataset--; %let blocksonly=0; *--new global flag to specify that you only want to convert the block level sets. Set to 0 normally---; libname sf12010 "/pub/data/sf12010" access=readonly; libname sf1 (sf12010); *--alternate libref--; libname sf12010x '/pub/data/sf12010x'; libname sf1x (sf12010x); *--alternate libref--; libname user '/SAS_temp/userb'; *----permanent temps in case something goes wrong during the concatenation step-; %let moe_default=; *--referenced by the dovar macro--; %let dvmode=data; %*--this "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. --*; %global pctflag; *---used by invoke_dovars to conditionally generate code depending on whehter PCT tables are available for the level; %global pctof table curtable curtabno dvmode; %let dvmode=data; %let curtabno=0; %macro doit(state,stab); %let ustab=%upcase(&stab); %let pctflag=1; data &stab.tracts080; length SumLev $3 esriid $21; set sf1.&stab.hierarchal; where sumlev='080'; %include 'invoke_dovars.sas'/source2; keep esriid geocode sumlev logrecno state stab county tract cousubfp placefp cbsa metdiv csa ; keep IntPtLon IntPtLat AreaSQMI LandSQMI ; keep TotPop -- AvgSizeRenter; drop TotPop00 PopChange PctPopChange totpop2k ; drop _: ; format landsqmi areasqmi 9.2; run; proc sort; by esriid; run; %endmac: %mend doit; options NOmprint; *---run 8-18-11 to generate CSV files for all states---; %*dostates(10,names=1); %dostates(n=51,names=1); %macro setref(state,stab); &stab.tracts080 %mend setref; data sf12010x.ustracts080(label='Std Extract for Hierarchal (level 080) Tracts' index=(state) compress=Yes); set %dostates(n=51,mac=setref) open=defer; run;