x cd /pub/data/sf32000x/Tools; %let pgm=cnvtsf3x_sl090; filename pgm "&pgm..sas"; /*---Access Census 2000 full sf3 datasets and create standard extract datasets and/or metadata (Variables) dataset. Input filetype is sf32000, output filetype is sf32000x. This setup reads summary level 090 ph state level datasets and writes sl090 sf3x datasets. The output sets are intended for use in caps web application. John Blodgett, OSEDA, U. of Missouri Outreach & Extension. Under contract with the Missouri Census Data Center. April, 2004 (rerunning May 2004 after a fix to variable under18 in the invoke_dovars module). ---*/ options ls=159 ps=120 nodate; title "&pgm: Create sf32000x Extract Datasets from sf32000 Datasets: Summary Level 090 Datasets"; libname sf3 "/pub/data/sf32000/xxsl090" access=readonly; libname sf3x "/pub/data/sf32000x/xxsl090"; %macro doit(state,stab); %let setin=&stab.ph; %let dvmode=data; *--required by dovar macro which is invoked dozens of times by the invoke_dovars module--; *----the dovar macro is where the work is actually done. Below, the cnvtmeta macro serves as the "driver" which invokes this macro one per variable. It gets run once in data more and once in meta mode--; *include '/pub/sasmacro/dovarsf3.sas'; *---contains the dovars macro-------------------; *----the dovar macro is where the work is actually done. Below, the included invoke_dovars.sas serves as the "driver" which invokes this macro once per variable. It gets run once in data mode only here---; options NOmprint; *---------Here is the conversion data step-------------*; data sf3x.&stab.sl090 ; length default=5 Areaname $22 ; set sf3.&setin ; * sf3.&setin.phct(in=inct); * by logrecno; %include 'invoke_dovars.sas'/NOsource2; *<---------here is where the data is defined---; grcid=compress(geocode,'-.'); *<--just for a placeholder so the keep stmt still works.--; keep geocode sumlev State county cousub: place: tract bg msacmsa pmsa necma ua uatype urbanrur areaname; keep IntPtLon IntPtLat AreaSQMI LandSQMI lsadc; keep TotPop -- grcid; drop PCT19: P8i3; *---Note that certain variables in Tables 8 and 11 will always be missing because we have no phct tables-; run; run; proc print data=sf3x.&stab.sl090(obs=10); title2 "First 10 Obs from sf3x.&stab.sl090"; by State SumLev; id geocode; var geocode grcid county cousubfp placefp urbanrur areaname totpop; run; %mend doit; %*dostates(29,names=1); %dostates(01 02 04 05 06 09 11 12,names=1,msgs=1); %dostates(10 17 20 26 27) ; %dostates(08 13 15 16 18 19 21 22 23 24,names=1,msgs=1); %dostates(30 31 32 33 34 35 36,names=1,msgs=1); %dostates(37 39 40 41 42 44 45 46 47 51 53 54 55 56 72,names=1,msgs=1) ; %dostates(25 28 38 48 49 50,names=1,msgs=1);