Previous Page | Next Page

Using SAS/IML Software to Generate SAS/IML Statements

Making Operands More Flexible

Suppose that you want to write a program that prompts a user for the name of a data set. Unfortunately the USE, EDIT, and CREATE commands expect the data set name as a hardcoded operand rather than an indirect one. However, you can construct and execute a function that prompts the user for the data set name for a USE statement. Here is the code:

   /* prompt the user to give dsname for use statement */
   start flexible;
      file log;
      put 'What data set shall I use?';
      infile cards;
      input dsname $;
     call execute('use', dsname, ';');
   finish;
   run flexible;

If you enter USER.A, the program generates and executes the following line:

   use user.a;
Previous Page | Next Page | Top of Page