Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Using SAS/IML Software to Generate 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);                         */
       /* will macro-process the text in x,                  */
       /* and return 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 shown below:
       Y

       DATA _NULL_;      INFILE JUNK1;      FILE PRINT;      INPUT;
       PUT _INFILE_;      RUN;

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.