x cd /pub/data/sf12010x/Tools; %let pgm=cnvt_sf12010x_special; filename pgm "&pgm..sas"; *----Create a series of standard extract data sets for special datasets. See also setup in cnvt_sf12010x.sas . jgb, OSEDA, MCDC . 12/2011. ----*; %global csvfiles; %let csvfiles=2; %*---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 . ----; libname sf12010 "/pub/data/sf12010" access=readonly; libname sf1 (sf12010); *--alternate libref--; libname sf12010x '/pub/data/sf12010x'; libname sf1x (sf12010x); *--alternate libref--; *---not doing any trends with totpop2k now---; libname sf1x2k '/pub/data/sf12000x' access=readonly; libname blkrel10 '/pub/data/blkrel10' access=readonly; %global temp; *--set this parm to a value of %str(/temp) when reading and writing from the temp subdir (embargoed)-; %let moe_default=; %let dvmode=data; %*--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 sf12010x Extract Datasets from sf12010 Datasets"; %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; /* ========================begin comment==================================== ==========================end comment====================================== */ %let dvmode=data; %let curtabno=0; %macro doit(state,stab,statenm); %let ustab=%upcase(&stab); %let pctflag=0; %if &csvfiles = 1 %then %goto csvblks; data sf1x.&stab.cdslds2012 (label="113th Congressional Districts and 2012 State Leg Districts for &statenm"); length SumLev $3 esriid $16 areaname $10 ; set sf1.&stab.cdslds2012; %include 'invoke_dovars.sas'/NOsource2; %*<----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 does not really define what sf12010x is, it is this included module that really does it. ----; keep esriid geocode sumlev areaname logrecno state stab cd113 House Senate county ; keep IntPtLon IntPtLat AreaSQMI LandSQMI ; keep TotPop -- AvgSizeRenter; %if &pctflag=0 %then %do; drop hawaiian--PctOtherAsian mexican--PctOtherHispanic unmarriedPartner--PctUnmarriedPartner unmPartnerHHs--PctSameSexPrtnrHHs ; %end; drop _: ; run; %csvblks: %if &csvfiles ne 0 %then %do; data csvout; set sf1x.&stab.cdslds2012; geocode=compress(geocode,'-.'); run; filename dlmout "/pub/data/temp/sf1x&stab.scdsslds2012.csv"; %cnvtdlm( lrecl=4096,names=1,quotes=0) ; run; %end; %endmac: %mend doit; %doit(29,mo,Missouri);