x cd /pub/data/stf903/Tools; %let pgm=cnvtstf3d; filename pgm "&pgm..sas"; /* ------Convert the raw stf3d (103rd Cong District summary, 1990 file for all states. This setup being coded 7/09. Borrowing from earlier cnvtnj.sas setup, and using the same stf903c conversion macro that we have been using for over 10 years to convert these files. John Blodgett, OSEDA, U. of Missouri Outreach & Extension under a contract with the Missouri Census Data Center. ------*/ libname stf903 '/pub/data/stf903'; options nosource2; title "&pgm: Convert 1990 STF903 Files"; filename in "/pub/datastf903/rawfiles/0612-00*" ; *** "unzip -p /pub/data/stf903/rawfiles/icpsr9782.zip 5038028/ICPSR_09782/DS00&state._Part_&state._&statenm/09782-00&state.-Data.txt"; options compress=binary; options mprint; %macro filter; _keep=0; drop _keep; *--in the stf903c macro we specify "end=lastrec" on infile; do until(_keep ); if lastrec then stop; *---keep only the CD summary and the county-within-cd summaries---; if slvl in ('501','510') and geocomp='00' then _keep=1; else do; _keep=0; input; if _keep; end; end; drop cousub: place: tract bg uasc aian: urbanrur urbarea xci anrc artli sac: ; %mend filter; *--invoke the conversion macro for the Inventory summaries-; %stf903c(setout=stf903.uscds103, obs=max, subfile=D, filein=%str("/pub/data/stf903/rawfiles/06012-00*"), geofiltr=filter, attribs=1, cnvtmls=0) if sac7 ne ' ' and cd=' ' then cd=sac7; if slvl='510' then areaname=trim(areaname)||' portion of District '||cd; run; proc datasets library=stf903 nolist; modify uscds103; index create state; quit;