Previous Page | Next Page

Using SAS/IML Software to Generate SAS/IML Statements

Macro Interface

The pushed text is scanned by the macro processor; therefore, the text can contain macro instructions. For example, here is an all-purpose routine that shows what the expansion of any macro is, assuming that it does not have embedded double quotes:

       /* function: y = macxpand(x);                         */
       /* macro-processes the text in x                      */
       /* and returns the expanded text in the result.       */
       /* Do not use double quotes in the argument.          */
       /*                                                    */
   start macxpand(x);
      call execute('Y="',x,'";');
      return(y);
   finish;

Consider the following statements:

   %macro verify(index);
       data _null_;
          infile junk&index;
          file print;
          input;
          put _infile_;
       run;
   %mend;
   y = macxpand('%verify(1)');
   print y;

The output produced is as follows:

       Y

       DATA _NULL_;      INFILE JUNK1;      FILE PRINT;      INPUT;
       PUT _INFILE_;      RUN;
Previous Page | Next Page | Top of Page