/**********************************************************************/


%macro change;
   %let c1=This line is exactly 40 characters long.; 
   %let c2=This line is longer than the previous one.; 
   change "&c1" "&c2";
%mend change; 


/**********************************************************************/


%macro change(dsn);
   %let c1=This line is exactly 40 characters long.; 
   %let c2=This line is longer than the previous one.; 
   clear;
   include "&dsn";
   change "&c1" "&c2";
   file; 
%mend change; 


/**********************************************************************/


%macro getpgm(dsn=,string=); 
   
   /* Bring a file into the PROGRAM EDITOR window          */
clear; 
include "&dsn"; 
zoom on;
 
   /* Issue a FIND command for a character string          */
%if %length(&string) gt 0 %then 
   %str(find "&string";); 

%mend getpgm; 


/**********************************************************************/


/* Example 1 */

   /* Assign the catalog to contain the PMENU              */
proc pmenu c=cat.pmenus; 

   /* Name the PMENU entry                                 */
menu sample; 

   /* Define the commands available to the user            */
item 'NEXT'     selection=next;
item 'PREVIOUS' selection=prev;
item END;
item 'TIME'     selection=time;
selection next 'forward;';
selection prev 'backward;'; 
selection time '%put &systime;';
run;
quit; 


/**********************************************************************/


/* Example 2 */

   /* Assign the catalog to contain the PMENU              */
proc pmenu c=cat.pmenus; 

   /* Name the PMENU entry                                 */
menu saverr;    
 
   /* Define the commands available to the user            */
item 'SAVE_ERROR' selection=error;
item END; 

   /* Define the commands executed for SAVE_ERROR          */
selection error 
   'PRTFILE
   "userid.ERRORS.%substr(&sysdate,%length(&sysdate)-4)"
   APPEND;
   SPRINT';
run;
quit; 


/**********************************************************************/


   /* Use CALL EXECCMD to assign the customized            */
   /* PMENU to the next window that displays               */
call execcmd('SETPMENU CAT.PMENUS.SAVERR.PMENU');

   /* Invoke FSEDIT session                                */
call fsedit('work.costs');


/**********************************************************************/


   /* Assign the catalog to contain the PMENU              */
proc pmenu c=cat.pmenus; 

   /* Name the PMENU entry                                 */
menu printds; 

   /* Define the commands available to the user            */
item END;
item 'PRINT_ON_EXIT' selection=printd;
item 'CANCEL_PRINT' selection=noprint;
selection printd '%let printds = Y;';
selection noprint '%let printds = N;'; 
run; 
quit; 


/**********************************************************************/


call symput('PRINTDS',''); 


/**********************************************************************/


call execcmd('SETPMENU CAT.PMENUS.PRINTDS.PMENU');


/**********************************************************************/


call fsview('work.status'); 


/**********************************************************************/


%let printds=Y; 


/**********************************************************************/


if symget('PRINTDS')='Y' then
   do;    /* Display Print Data Set window                 */
call display('PRINT.PROGRAM','WORK.STATUS');
call symput('PRINTDS','');
end;      /* Display Print Data Set window                 */


/**********************************************************************/