PMENU Procedure

Example 1: Building a Menu Bar for an FSEDIT Application

Features:

PROC PMENU statement option: CATALOG=

ITEM statement options:
MENU=
SELECTION=
SUBMENU=

MENU statement

SELECTION statement

SUBMENU statement

Details

This example creates a menu bar that can be used in an FSEDIT application to replace the default menu bar. The selections available on these menus do not enable end users to delete or duplicate observations.
Note:
  • The windows in the PROC PMENU examples were produced in the UNIX environment and might appear slightly different from the same windows in other operating environments.
  • You should know the operating environment-specific system options that can affect how menus are displayed and merged with existing SAS menus. For details, see the SAS documentation for your operating environment.

Program

libname proclib
'SAS-data-library';
proc pmenu catalog=proclib.menucat;
   menu project;
      item 'File' menu=f;
      item 'Edit' submenu=editmnu;
      item 'Scroll' menu=s;
      item 'Help' menu=h;
      menu f;
         item 'Goback' selection=g;
         item 'Save';
         selection g 'end';
      submenu editmnu sashelp.core.edit;
      menu s;
         item 'Next Obs' selection=n;
         item 'Prev Obs' selection=p;
         item 'Top';
         item 'Bottom';
         selection n 'forward';
         selection p 'backward';
      menu h;
         item 'Keys';
         item 'About this application' selection=hlp;
         selection hlp 'sethelp user.menucat.staffhlp.help;help';
quit;

Program Description

Declare the PROCLIB library. The PROCLIB library is used to store menu definitions.
libname proclib
'SAS-data-library';
Specify the catalog for storing menu definitions. Menu definitions will be stored in the PROCLIB.MENUCAT catalog.
proc pmenu catalog=proclib.menucat;
Specify the name of the catalog entry. The MENU statement specifies PROJECT as the name of the catalog entry. The menus are stored in the catalog entry PROCLIB.MENUCAT.PROJECT.PMENU.
   menu project;
Design the menu bar. The ITEM statements specify the items for the menu bar. The value of the MENU= option is used in a subsequent MENU statement. The Edit item uses a common predefined submenu; the menus for the other items are defined in this PROC step.
      item 'File' menu=f;
      item 'Edit' submenu=editmnu;
      item 'Scroll' menu=s;
      item 'Help' menu=h;
Design the File menu. This group of statements defines the selections available under File on the menu bar. The first ITEM statement specifies Goback as the first selection under File. The value of the SELECTION= option corresponds to the subsequent SELECTION statement, which specifies END as the command that is issued for that selection. The second ITEM statement specifies that the SAVE command is issued for that selection.
      menu f;
         item 'Goback' selection=g;
         item 'Save';
         selection g 'end';
Add the EDITMNU submenu. The SUBMENU statement associates a predefined submenu that is located in the SAS file SASHELP.CORE.EDIT with the Edit item on the menu bar. The name of this SUBMENU statement is EDITMNU, which corresponds with the name in the SUBMENU= action-option in the ITEM statement for the Edit item.
      submenu editmnu sashelp.core.edit;
Design the Scroll menu. This group of statements defines the selections available under Scroll on the menu bar.
      menu s;
         item 'Next Obs' selection=n;
         item 'Prev Obs' selection=p;
         item 'Top';
         item 'Bottom';
         selection n 'forward';
         selection p 'backward';
Design the Help menu. This group of statements defines the selections available under Help on the menu bar. The SETHELP command specifies a HELP entry that contains user-written information for this FSEDIT application. The semicolon that appears after the HELP entry name enables the HELP command to be included in the string. The HELP command invokes the HELP entry.
      menu h;
         item 'Keys';
         item 'About this application' selection=hlp;
         selection hlp 'sethelp user.menucat.staffhlp.help;help';
quit;

Associating a Menu Bar with an FSEDIT Session

The following SETPMENU command associates the customized menu bar with the FSEDIT window.
setpmenu proclib.menucat.project.pmenu;pmenu on
You can also specify the menu bar on the command line in the FSEDIT session or by issuing a CALL EXECCMD command in SAS Component Language (SCL).
For other methods of associating the customized menu bar with the FSEDIT window, see Associating a Menu Bar with an FSEDIT Session.
The following FSEDIT window shows the menu bar:
FSEDIT Window