space
Previous Page | Next Page

The BUILD Procedure

PRINT Statement


Prints the contents of entries from the catalog specified in the PROC BUILD statement.
Restriction: The PRINT statement can print the contents of CBT, HELP, LIST, MENU, PROGRAM, SCL, and SOURCE entries. It cannot print the contents of FRAME, CLASS, RANGE, and RESOURCE entries or of any other entry types that are not supported by the BUILD procedure.
Note: The print operation is performed before the procedure opens any windows.
Tip: By default, the procedure attempts to print all entries in the current catalog (the catalog that was specified in the PROC BUILD statement). You can use the SELECT= option to select individual entries to print, or use the EXCLUDE= option to prevent certain entries from being printed.

PRINT items
<ENTRYTYPE=entry-type>
<EXCLUDE=entry-name.entry-type | (entry-list)> | <SELECT=entry-name.entry-type | (entry-list) <XREF>>
<FORM=form-name>
<LEFT>
<LINENUM>
<NOPAGEBREAK>
<PRTFILE='filename' | fileref <APPEND>>;

where items must be one or more of the following:

ATTR

DISPLAY<SHOWPAD>

LISTDIR

SOURCE


Required Arguments

You must always supply at least one of the following arguments with the PRINT statement. Any combination of the following arguments can be specified.

ATTR

prints all of the attribute information that is associated with each entry.

DISPLAY <SHOWPAD | SP>
DISP <SHOWPAD | SP>

prints the display portion of each entry.

For PROGRAM entries, user fields in the display are by default represented by their respective field names. Use the SHOWPAD option in conjunction with the DISPLAY option to represent user fields by their corresponding pad characters instead.

For LIST entries, the values in the list are printed.

LISTDIR
LD

prints a listing of the contents of the catalog specified in the PROC BUILD statement.

SOURCE
SRC

prints the SAS Component Language source code from each PROGRAM, SCL, or SOURCE entry.


Options

You can use the following options in the PRINT statement:

ENTRYTYPE=entry-type
ETYPE=entry-type
ET=entry-type

specifies the type of entry to print. By default, all CBT, HELP, LIST, MENU, PROGRAM, SCL, and SOURCE entries in the current catalog are printed (unless you also use the SELECT= or EXCLUDE= option). Use the ENTRYTYPE= option to print only entries of the specified type.

To print entries of more than one type, use a separate PRINT statement for each entry type.

EXCLUDE=entry-name.entry-type | (entry-list)
SELECT=entry-name.entry-type | (entry-list) <XREF>

specify catalog entries to exclude from or select for printing. By default, all CBT, HELP, LIST, MENU, PROGRAM, SCL, and SOURCE entries in the current catalog are printed (unless you also use the ENTRYTYPE= option). Use the EXCLUDE= option to prevent specified entries from being printed. Use the SELECT= option to print only specified entries. If you specify more than one entry for either of these options, enclose the list in parentheses and separate the names with spaces.

If you use the ENTRYTYPE= option in the same PRINT statement, you can omit the entry-type portion of the entry specification for the EXCLUDE= or SELECT= options because only entries of the type specified in the ENTRYTYPE= option can be printed.

When you use the SELECT= option to print CBT or MENU entries, you can also use the XREF option to print two cross-reference tables for each MENU or CBT entry. One table lists all entries that are called by that entry, and the other table lists all entries that call the entry.

Each PRINT statement can include only one EXCLUDE= option or one SELECT= option. However, you can use multiple PRINT statements with the same PROC BUILD statement.

FORM=form-name

specifies the name of a FORM entry to control the output generated by the PRINT statement. Specify either a one- or three-level name for form-name. A one-level name is assumed to be the name of a FORM entry in the current catalog. If the FORM entry is in a different catalog, use a three-level name (libref.catalog-name.entry-name). The default is the standard system form, SASHELP.FSP.DEFAULT.FORM.

LEFT

specifies that output produced by the PRINT statement is aligned at the left margin of the page or print file. By default, output is indented four spaces.

LINENUM

prints line numbers (up to 99999) at the beginning of each line of SCL source code.

Note:   The LINENUM option is valid only when SOURCE is specified for the items argument.  [cautionend]

NOPAGEBREAK

prints entries without page breaks. By default, a page break is generated each time the number of lines per page defined by your FORMS entry is reached, and each page of the program listing has a page header. Blank lines are printed at the end of the program listing until the specified page length is reached. Use the NOPAGEBREAK option to print the program listing without page breaks. Headers are printed only at the top of the entry and every 32,768 lines thereafter.

Note:   The NOPAGEBREAK option is valid only when SOURCE is specified for the items argument.  [cautionend]

PRTFILE='filename' | fileref <APPEND>

specifies a file to receive the output of the PRINT statement. By default, output is sent to the default printer or to the printer specified in the form identified in the FORM= option. Use the PRTFILE= option to redirect the output to a file instead. Specify the print file using either

  • a fully-qualified filename enclosed in quotes

  • a fileref that has been assigned to the file with a FILENAME statement or with an external allocation.

By default, if output is sent to a print file that already exists, the output overwrites the current contents of the file. Add the APPEND option to append printed output to the end of the file if it already exists.


Using the PRINT Statement

You can use the PRINT statement to generate hardcopy documentation of the displays, attributes, and source code in your applications. By default, output is sent to the default printer or to the printer specified in the FORM= option. You can use the PRTFILE= option to route output to a file instead.


PRINT Statement Examples


Example 1: Selecting Entries to Print

The following example shows how to print the DISPLAY window views for two entries, GETFIELD.PROGRAM and GETTYPE.PROGRAM. Pad characters are printed to show the DISPLAY windows as users see them. Because the PRTFILE= option is not specified, the output is sent to the default printer. This example uses batch mode, which is the optimum way to print entries when you do not need to view the catalog or its entries.

proc build cat=mylib.mycat batch;
   print display showpad et=program
         select=(getfield gettype);
run;


Example 2: Excluding Entries from Printing

The following example shows how to print the SCL source programs for all PROGRAM entries in the MYLIB.MYCAT catalog except GETFIELD.PROGRAM and GETTYPE.PROGRAM. Because the BATCH option is not specified, the Explorer window opens after the printing is performed so that you can work in the BUILD session.

proc build cat=mylib.newcat;
   print source etype=program
         exclude=(getfield gettype);
run;


Example 3: Printing a Cross Reference

The following example prints a cross reference of entries that call or are called by the MAIN.MENU entry. Output is routed to the file identified by the fileref MENUREF, which you must have previously assigned.

proc build cat=mylib.newcat batch;
   print xref select=main.menu
         prtfile=menuref;
run;

space
Previous Page | Next Page | Top of Page