x cd /pub/data/sf12010x/Tools; %let pgm=create_usmetros; filename pgm "&pgm..sas"; *----Generate the sf12010x.usmetros data set. jgb, 3-7-12.8-25-11. ---; libname sf12010x '/pub/data/sf12010x'; title "Create the sf1x.usmetros Data Set"; %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--; %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. --*; %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; %macro doit; %if &csvfiles = 1 %then %goto csvfile; data sf12010x.usmetros(label="US metro areas: CBSAs, CSAs, MetroDivs and NECTAs"); set sf1.usmetros; where sumlev in ( '310','311','314','315','330','331','335','336','350','351'); where also geocomp='00'; if PartFlag=" " then _curname=areaname; else if PartFlag='P' then Areaname=trim(_curname)||' (' || stab ||' portion)'; retain _curname; %include 'invoke_dovars.sas'/NOsource2; keep esriid geocode sumlev areaname logrecno state stab cbsa csa metdiv necta nectadiv cbsasc; keep IntPtLon IntPtLat AreaSQMI LandSQMI LSADC CNECTA PartFlag; keep TotPop Male -- AvgSizeRenter; *<---which means we drop totpop00 totpop2k popchange and pctPopChange since we do not have; drop _: ; run; %csvfile: %if &csvfiles ne 0 %then %do; filename dlmout "/pub/data/temp/sf1xusmetros.csv"; %cnvtdlm( setin=sf12010x.usmetros,lrecl=2048,names=0,quotes=0) run; %end; %endmac: %mend doit; %doit ;