*
;

%macro cat2gsf( first, last, gcat, base, gdev);

  /* SAS-Macro to generate graphic stream files out of a SAS-catalog       */

  /* Original cat2cgm from Bob Snyder (rsnyder@lobby.ti.com)               */
  /* Modified by Carina Ortseifen (carina.ortseifen@urz.uni-heidelberg.de) */
  /* Date: 07.09.1995                                                      */

  /* first  | The first graph to replay.                                   */
  /* last   | The last graph to replay.                                    */
  /* gcat   | The graphics catalog to replay from.                         */
  /* base   | The base output file name to which the                       */
  /*        | catalog entry number will be appended.                       */
  /* gdev   | The graphics device such as "cgmwpwa".                       */

  /* Example                                                               */
  /*
     data test;
        input x c g @@;
        cards;
     1 10 1 2 10 1 3 10 1
     1 20 2 2 20 2 3 20 2
     1 30 3 2 30 3 3 30 3
     ;
     goptions hsize=6 cm vsize=6 cm;
     axis1 order=0 to 50 by 10;
     proc gchart data=test gout=graph;
        vbar x / sumvar=c type=sum raxis=axis1;
        by g;
     run;quit;

     %cat2gsf(1,3,graph,c:\test,cgmmwwc);
                                                                           */
  /* End of comments                                                       */

  %do entry=&first %to &last;

    %if &entry lt 10 %then %do;
      filename gsasfile "&base.0&entry..cgm";
      %end;
    %else %do;
      filename gsasfile "&base.&entry..cgm";
    %end;

    goptions dev=&gdev gsfname=gsasfile gsfmode=replace;

    proc greplay igout=&gcat nofs;
      replay &entry;
    run;quit;

    filename gsasfile clear;

  %end;

  goptions reset=all;

%mend cat2gsf;

*
;