Saturday, May 3, 2014

SAS in Mainframes(z/Os) Tutorial : Use of symbolic parameter in SAS

Having completed SAS part 1and SAS part 2 , we will see the use of Symbolic in SAS
With the help of symbolic parameters, we can substitute the values dynamically in any place we want to. Say for example we are building the date, or reading the date from one input file and want to use it as a header in title or to use it in any calculation down the flow of the program while doing the condition checks like  <=,>= checks. In these cases the use of symbolic fits the best.
Say like below
DATA DATE;                     
  INFILE DATEIN;               
  INPUT @01  LOWDTE   $CHAR08.  
        @01  HEADER   $CHAR06.  
        @10  HIGHDTE   $CHAR08.  
        ;                      
  PUT "L-DATE >>>>>>>> " LOWDTE;
  PUT "H-DATE >>>>>>>> " HIGHDTE;
                               
   CALL SYMPUT('HEADR',HEADR); 

........
DATA PROCESS1;
 ...
TITLE ' test Heading' "&HEADR" ;
Here.. we are reading the input file, for the Dates and assigning the variables in INFILE DATEIN.
After that there may be several processes occurring in the program.Once done we now want to print the title taking the date read above in INFILE step.  The SYMPUT parameter is used for invoking symbolic parameter in sas. Later down the line we use  &variable-name as used in JCL for the value substitution.
Now ,lets see how we can use this value in sas comprison .
DATA DATA1;  
INFILE IMFL08;
RETAIN CUDATE;   <= Need to declare this variable as RETAIN
INPUT          

  @01   ANO $CHAR 01
  @02   BNO $CHAR02.
.........
CUDATE = "&RUNDATE"; <<== We are assigning the symbolics here
IF EFFDATE LE CUDATE <<= Use symbolic paramter in condition check
    THEN OUTPUT;    

3 comments:

  1. Nice article i was really impressed by seeing this article, it was very intresting and it is very useful for SAS Training Learners.. We are Providing best ccna online training in worldwide.

    ReplyDelete
  2. Great Information admin thanks For Your Information and Any body wants
    learn sas through Online for Details Please go through the Link http://bit.ly/1B9ohro

    ReplyDelete