*---------/mscdc/data/stf903/Tools/slvl140.sas----------*; x cd /mscdc/data/stf903/Tools; options mprint; %pgm(slvl140) options nomprint; /* This program copies the ciesin 3xp/tract zipped STF3 sas xport files via the FTP access method on the filename statement and a copy data step to a temporary zip archive. The archive is unzipped via use of the pnod pipe and input to proc copy which restores the state level sas dataset via the xport engine. NOTE: Problems with method used here, job failed severals times in progress and had to be restarted eg. fork function failed, too many processes. JWS 7/97 */ libname slvl140 '/mscdc/data/stf903/slvl140.bystate'; %macro slvl140(stfips=,user=,pass=,host=); %*<----2-digit state-------------; %local err; %let err=0; %if %length(&stfips) ne 2 %then %let err=1; %let stab=%stcnvt(&stfips); %if &stfips=01 %then %let state=Alabama; %else %if &stfips=02 %then %let state=Alaska; %else %if &stfips=04 %then %let state=Arizona; %else %if &stfips=05 %then %let state=Arkansas; %else %if &stfips=06 %then %let state=California; %else %if &stfips=08 %then %let state=Colorado; %else %if &stfips=09 %then %let state=Connecticut; %else %if &stfips=10 %then %let state=Delaware; %else %if &stfips=11 %then %let state=Washington DC; %else %if &stfips=12 %then %let state=Florida; %else %if &stfips=13 %then %let state=Georgia; %else %if &stfips=15 %then %let state=Hawaii; %else %if &stfips=16 %then %let state=Idaho; %else %if &stfips=17 %then %let state=Illinois; %else %if &stfips=18 %then %let state=Indiana; %else %if &stfips=19 %then %let state=Iowa; %else %if &stfips=20 %then %let state=Kansas; %else %if &stfips=21 %then %let state=Kentucky; %else %if &stfips=22 %then %let state=Louisiana; %else %if &stfips=23 %then %let state=Maine; %else %if &stfips=24 %then %let state=Maryland; %else %if &stfips=25 %then %let state=Massachusetts; %else %if &stfips=26 %then %let state=Michigan; %else %if &stfips=27 %then %let state=Minnesota; %else %if &stfips=28 %then %let state=Mississippi; %else %if &stfips=29 %then %let state=Missouri; %else %if &stfips=30 %then %let state=Montana; %else %if &stfips=31 %then %let state=Nebraska; %else %if &stfips=32 %then %let state=Nevada; %else %if &stfips=33 %then %let state=New Hampshire; %else %if &stfips=34 %then %let state=New Jersey; %else %if &stfips=35 %then %let state=New Mexico; %else %if &stfips=36 %then %let state=New York; %else %if &stfips=37 %then %let state=North Carolina; %else %if &stfips=38 %then %let state=North Dakota; %else %if &stfips=39 %then %let state=Ohio; %else %if &stfips=40 %then %let state=Oklahoma; %else %if &stfips=41 %then %let state=Oregon; %else %if &stfips=42 %then %let state=Pennsylvania; %else %if &stfips=44 %then %let state=Rhode Island; %else %if &stfips=45 %then %let state=South Carolina; %else %if &stfips=46 %then %let state=South Dakota; %else %if &stfips=47 %then %let state=Tennessee; %else %if &stfips=48 %then %let state=Texas; %else %if &stfips=49 %then %let state=Utah; %else %if &stfips=50 %then %let state=Vermont; %else %if &stfips=51 %then %let state=Virginia; %else %if &stfips=53 %then %let state=Washinton; %else %if &stfips=54 %then %let state=West Virginia; %else %if &stfips=55 %then %let state=Wisconsin; %else %if &stfips=56 %then %let state=Wyoming; %else %let err=1; %if &err %then %do; %put ***Required stfips parameter must be a valid FIPS; %put state code. Value specified is not: stfips=&stfips ; %put Macro aborting..... ; %goto endmac; %end; %else %put ***Processing tracts for &state....; filename in ftp "/pub/census/usa/stf/us/3xpt/tract/&stab.tract.zip" recfm=s user="&user" pass="&pass" host="&host" debug; filename zipout "/SAS_temp/&stab.tract.zip"; data _null_;nb=-1; infile in recfm=s nbyte=nb; file zipout recfm=f lrecl=256; input; put _infile_; run; %let jobpid=&stab.tract.xpt; x "mknod &jobpid p"; x "ls -l &jobpid"; x "(unset noclobber; unzip -cqq /SAS_temp/&stab.tract.zip > &jobpid &)"; x "ls -l &jobpid"; libname zipin xport "&jobpid"; *---end of mknod libname allocation requiring unix power tools---*; proc copy in=zipin out=slvl140; run; proc datasets library=slvl140 nolist; change &stab.tract=&stab.tracts; run; filename zipin clear; filename zipout clear; x "rm /SAS_temp/&stab.tract.zip"; x "rm &jobpid"; quit; %put ...&state processing completed***; %endmac: %mend slvl140; *slvl140(stfips=01,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=02,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=04,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=05,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=06,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=08,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); %slvl140(stfips=09,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=10,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=11,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=12,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); %slvl140(stfips=13,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=15,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=16,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=17,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=18,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=19,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=20,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=21,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=22,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); %slvl140(stfips=23,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=24,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=25,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=26,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=27,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=28,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=29,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=30,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=31,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=32,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=33,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=34,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=35,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); %slvl140(stfips=36,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=37,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=38,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=39,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=40,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=41,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=42,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=44,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); %slvl140(stfips=45,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=46,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=47,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=48,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=49,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=50,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=51,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=53,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=54,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=55,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); *slvl140(stfips=56,user=anonymous,pass=c1921b@umslvma,host=ftp.ciesin.org); RUN; run;