PMENU Procedure

Concepts: PMENU Procedure

Procedure Execution

Initiating the Procedure

You can define multiple menus by separating their definitions with RUN statements. A group of statements that ends with a RUN statement is called a RUN group. You must completely define a PMENU catalog entry before submitting a RUN statement. You do not have to restart the procedure after a RUN statement.
You must include an initial MENU statement that defines the menu bar, and you must include all ITEM statements and any SELECTION, MENU, SUBMENU, and DIALOG statements as well as statements that are associated with the DIALOG statement within the same RUN group. For example, the following statements define two separate PMENU catalog entries. Both are stored in the same catalog, but each PMENU catalog entry is independent of the other. In the example, both PMENU catalog entries create menu bars that simply list windowing environment commands the user can select and execute:
   libname proclib 'SAS-data-library';

   proc pmenu catalog=proclib.mycat;
      menu menu1;
      item end;
      item bye;
   run;

      menu menu2;
      item end;
      item pgm;
      item log;
      item output;
   run;
When you submit these statements, you receive a message that says that the PMENU entries have been created. To display one of these menu bars, you must associate the PMENU catalog entry with a window and then activate the window with the menus turned on, as described in Steps for Building and Using PMENU Catalog Entries.

Ending the Procedure

Submit a QUIT, DATA, or new PROC statement to execute any statements that have not executed and end the PMENU procedure. Submit a RUN CANCEL statement to cancel any statements that have not executed and end the PMENU procedure.

Steps for Building and Using PMENU Catalog Entries

In most cases, building and using PMENU entries requires the following steps:
  1. Use PROC PMENU to define the menu bars, menus, and other features that you want. Store the output of PROC PMENU in a SAS catalog. For more information, see Associating a Menu with a Window.
  2. Define a window using SAS/AF and SAS/FSP software, or the WINDOW or %WINDOW statement in Base SAS software.
  3. Associate the PMENU catalog entry created in step 1 with a window by using one of the following:
  4. Activate the window that you created. Make sure that the menus are turned on.

Templates for Coding PROC PMENU Steps

The following coding templates summarize how to use the statements in the PMENU procedure. Refer to descriptions of the statements for more information:
  • Build a simple menu bar. All items on the menu bar are windowing environment commands:
    proc pmenu;
       menu menu-bar;
       item command;
       ...more-ITEM-statements...
    run;
  • Create a menu bar with an item that produces a menu:
    proc pmenu;
        menu menu-bar;
        item 'menu-item' menu=pull-down-menu;
        ...more-ITEM-statements...
        menu pull-down-menu;
        ...ITEM-statements-for-pull-down-menu...
    run;
  • Create a menu bar with an item that submits a command other than the one that appears on the menu bar:
    proc pmenu;
       menu menu-bar;
       item 'menu-item' selection=selection;
       ...more-ITEM-statements...
       selection selection 'command-string';
    run;
  • Create a menu bar with an item that opens a dialog box, which displays information and requests text input:
    proc pmenu;
       menu menu-bar;
       item 'menu-item' menu=pull-down-menu;
       ...more-ITEM-statements...
       menu pull-down-menu;
          item 'menu-item' dialog=dialog-box;
          dialog dialog-box 'command @1';
             text #line @column 'text';
             text #line @column LEN=field-length;
    run;
  • Create a menu bar with an item that opens a dialog box, which permits one choice from a list of possible values:
    proc pmenu;
       menu menu-bar;
       item 'menu-item' menu=pull-down-menu;
       ...more-ITEM-statements...
       menu pull-down-menu;
          item 'menu-item' dialog=dialog-box;
          dialog dialog-box 'command %1';
             text #line @column 'text';
             radiobox default=button-number;
             rbutton #line @column
                     'text-for-selection';
             ...more-RBUTTON-statements...
    run;
  • Create a menu bar with an item that opens a dialog box, which permits several independent choices:
    proc pmenu;
       menu menu-bar;
       item 'menu-item' menu=pull-down-menu;
       ...more-ITEM-statements...
       menu pull-down-menu;
          item 'menu-item' dialog=dialog-box;
          dialog dialog-box 'command &1';
             text #line @column 'text';
             checkbox #line @column 'text';
             ...more-CHECKBOX-statements...
    run;