x cd /mscdc/metadata/stf803; %let pgm=dnzips; filename pgm "&pgm..sas"; *--take the old stf903b d1, d2, ,, d9 subdirs and create a single uszips dataset sorted by zip and indexed by new variable zip3--; libname stf803 '/mscdc/data/stf803'; libname tempstf3 '/SAS_temp/dnzips'; options msglevel=i noovp LINESIZE=112; title 'dnzips.sas: Combine the 9 1980 stf3b d1/zips .. d9/zips sets ' 'to single stf803.uszips + views'; %macro unzip; *--takes each of the zipped district-grouped datasets and unzips and renames them.--; %do i=1 %to 9; x unzip -j -qq /mscdc/zip3/stf803b.d&i -d /SAS_temp/dnzips; proc datasets library=tempstf3 %if &i>1 and &i<9 %then nolist; ; change zips=d&i.zips; run; %notify(&i) %end; %mend unzip; options mprint; *--macro will generate the 9 datasets on tempstf3; *****unzip ****commented out...already ran; /* *<===================comment out...already ran================ *--and now sort and store permanent version--; data allzips/view=allzips; *<--this is just input to sort; retain zip3 ' '; length county $3 stab $2 smsa $4 areaname $24 split 3; set tempstf3.d1zips tempstf3.d2zips tempstf3.d3zips tempstf3.d4zips tempstf3.d5zips tempstf3.d6zips tempstf3.d7zips tempstf3.d8zips tempstf3.d9zips; zip3=substr(zip,1,3); stab=put(state,$fipstab.); %include sascode(labs803); format split supflg01-supflg27 2.; run; proc sort data=allzips out=stf803.uszips(index=(zip3)); by zip3; *****************; run; ========================end comment======================= */ *<--step failed on original run because we left sumrylvl off keep list-; proc freq data=stf803.uszips(keep=sumrylvl zip3 state stab); where sumrylvl='35'; table zip3*state*stab/list; title2 'Freq Report (sumrylvl=35 fileter applied)'; run; *--create a 2nd index - by state. To go with zip3--; proc datasets library=stf803 nolist; modify uszips; index create state ; run; proc sql; *--create views for the Missouri, Ilinois and Kansas subsets--; create view stf803.mozips as select * from stf803.uszips where state='29'; create view stf803.ilzips as select * from stf803.uszips where state='17'; create view stf803.kszips as select * from stf803.uszips where state='20'; quit; proc contents data=stf803._all_ details nods; run; proc print data=stf803.mozips(obs=40); var _character_ split t1i1; title2 'Sample Obs From (view) stf803.mozips'; run;