x cd /mscdc/data/stf903/Tools; %let pgm=njcnvt; filename pgm "&pgm..sas"; %put &pgm; title 'stf903/Tools/njcnvt: convert stf3a for New Jersey to SAS Dsets'; filename in '/tmp/gaussian/stf903a.nj.dat' lrecl=7925 recfm=f; *<===; libname stf903i xport '/tmp/gaussian/stf903a.nji.xpt'; libname stf903h xport '/tmp/gaussian/stf903a.njh.xpt'; libname temp '/tmp/gaussian'; *--define the "exit macro" used to pre-filter any "H'(ierarchal) level summaries - we process those separately in next step--; %macro filterh; _keep=0; *--in the stf903c macro we specify "end=lastrec" on infile; do until(_keep ); if lastrec then stop; input slvl $11-13 @; if slvl in ('070','080','090') then do; _keep=0; input; *--release rec; end; else _keep=1; *--leave loop and get on with reading rec; end; %mend filterh; *--invoke the conversion macro for the Inventory summaries-; %stf903c(setout=stf903i.nji, prefiltr=filterh, pad=, /* for recfm=f */ obs=400,/* ************** */ attribs=1, /* *** */ cnvtmls=1) run; *---------------now do the H summaries-----------------------*; %macro filteri; _keep=0; do until(_keep ); if lastrec then stop; input slvl $11-13 @; if not (slvl in ('070','080','090')) then do; _keep=0; input; *--release rec; end; else _keep=1; *--leave loop and get on with reading rec; end; %mend filteri; *--invoke the conversion macro for the Hierarchal summaries-; %stf903c(setout=stf903h.njh, prefiltr=filteri, pad=, /* when recfm=f */ obs=400,/* ************** */ attribs=1, /* *** */ cnvtmls=1) run; *--capture samples for on-line browsing later--; data temp.nji; set stf903i.nji(obs=20); run; proc print data=temp.nji(keep=_char_ p1i1 xcentrm ycentrm); title3 'sample nji'; run; data temp.njh; set stf903h.njh(obs=20); run; proc print data=temp.njh(keep=_char_ p1i1 ); title3 'sample njh'; run;