/* Method 1: Open Code with PUT and %INCLUDE Statements  */

   /* Step 1: Read in the parameter file and create the  */
   /* variable filename                                  */
data _null_;
   set pfile;
   filename=compress(strand||grade||form);

/* Step 2: Write the code that processes the data into   */
/* an external file                                      */
      file dd(tempcode);
      put 'data ' filename ';'/
          '  infile dd (' filename ');' /
          '  input @' mstart '(m1-m' mnum ') ($1.)'/
          '  @' ostart '(o1-o' onum ') ($1.);'//
          'proc freq;'/
          '  tables m1-m' mnum ' o1-o' onum ';'/;
 run;

________________________________________________________________________

data m411;
   infile dd(m411);
   input @9 (m1-m19) (1.)
   @29 (o1-o3 ) ($1.) ;

proc freq;
   tables m1-m19 o1-o3;

   /* Step 3: Execute the code generated in step 2  */
%include dd(tempcode);