View Only

SAS tip: SET using stem file-value in DATA step code

  • 1.  SAS tip: SET using stem file-value in DATA step code

    Posted Oct 18, 2016 04:27 PM

    SAS tip:  Back in SAS 9.2 as I recall, SAS INSTITUTE enhanced the use of SET statement coding when you might want to consolidate several like SAS files (consider MICS cycles within a file / time-span).  Yes, MICS sites can use the %MFILE macro on a SET but still you must know how many cycles you want to select or use SAS OPTIONS NODSNFERR;    and code up to cycle "99" or something similar.


    If the objective is to select all available MICS DETAIL BATJOBnn cycles then consider this coding technique:


    SET  _BATX.BATJOB:   ;  /* trailing colon char selects all available cycles */


    The use of either _BATX. or &BATX..  with the MICSSHRx JCL PROC execution allows MICS to determine where the BATCH INFO AREA files in DETAIL reside -- in case your MICS unit may be "split".


    And remember to consider other SAS optimization coding techniques, such as using the WHERE statement instead of IF -- and depending on your needs consider adding the SET statement "dataset option"   (KEEP=<varlist>)   to reduce the SAS overhead with loading your input file(s) with the DATA STEP.




    Scott Barry

    SBBWorks, Inc.