x cd /pub/data/stf903/Tools; %let pgm=compress_sets; filename pgm "&pgm..sas"; *---We downloaded dozens of these very large stf903 data sets from the oseda box. We now want to get most of them in compressed format. While we are making a new copy we will also create a sumlev variable (copy of slvl) and will create specified indices and specify sortedby specs. John Blodgett, Dec. 2001. ---*; libname stf903 '/pub/data/stf903'; *---run a sample before macro-fying--; %let set=ksstcnty; %let indices=county; %let sortedby=county; %macro doit(set,indices,sortedby,doover=0); %*--for doover to work you must first delete the &set and &set.c datasets using unix rm--; %if &doover %then %do; proc datasets nolist library=stf903; change &set.B=&set; quit; %end; data stf903.&set.C(compress=yes label='Kansas state and county summaries' %if %quote(&sortedby) ne %str() %then %str(sortedby=&sortedby); ); attrib SumLev label='Geo Summary Lvl' length=$3; set stf903.&set; SumLev=slvl; run; proc datasets library=stf903 nolist; modify &set.C; %if %quote(&indices) ne %str() %then %str(index create &indices;); change &set=&set.B; change &set.C=&set; quit; %mend doit; /*<=========================Comment out===================================== %doit(ari,sumlev,doover=1); %doit(arzips,doover=1) %doit(azzips) %doit(iai,sumlev) %doit(ilbg7040,county,county tract bg) %doit(ilbg9999,county,county tract bg) %doit(ilhnotsl,county) %doit(ilhstl,county) %doit(ilmcds,county) %doit(ilmetros) %doit(ilother) %doit(iltrbnas,county,county tract) %doit(ilzips,zip,zip) %doit(ksbg3760,county,county tract bg) %doit(ksmcds,county) %doit(ksmetros) %doit(ksplaces,,placefp) %doit(kssdunis) *doit(ksstcnty,county); %doit(kstrbnas,county tract,county) %doit(kszips,zip,zip) %doit(mobg1740,county,county tract bg) ===========================End commented out================================ */ %doit(mobg3710,county,county tract bg) %doit(mobg3760,county,county tract bg) %doit(mobg7000,county,county tract bg) %doit(mobg7040,county,county tract bg) %doit(mobg7920,county,county tract bg) %doit(mobg9999,county,county tract bg) %doit(momcds,county,county) %doit(mometros) %doit(moother) %doit(moplaces,placefp) %doit(mopumas) %doit(moschl94) %doit(mosl070,county,county) %doit(mosl080,county,county) %doit(mosl090,county,county) %doit(mostcnty,,county) %doit(motrbnas,county,county tract) %doit(mozips,zip,zip) %doit(newmsas) %doit(uscntys,state,state county) %doit(usmcds,state,state county) %doit(usmetros) %doit(usother) %doit(usplaces,state,state place) %doit(usregdiv) %doit(usstates,state,state) /*<=========================Comment out===================================== ===========================End commented out================================ */