Chapter Contents

Previous

Next
The GPRINT Procedure

PROC GPRINT Statement


The PROC GPRINT statement identifies the external file to be converted to graphics output. Optionally, specifies the text color, a destination catalog for graphics output, and an Annotate data set.


Syntax

PROC GPRINT FILEREF=fileref
<option(s)>;
option(s) can be one or more of the following:
ANNOTATE=Annotate-data-set
CTEXT=text-color
DESCRIPTION='entry-description'
GOUT=<libref.>output-catalog
NAME='entry-name'
NOCC
O


Required Arguments

FILEREF=fileref
specifies the fileref that is associated with the external file that will be used as input to the GPRINT procedure. Fileref must have been previously defined in a FILENAME statement or host command.
See also: FILENAME Statement
Featured in: Adjusting the Size of Characters


Options

Options in the PROC GPRINT statement affect all graphs that the statement produces. You can specify as many options as you want and list them in any order.

ANNOTATE=Annotate-data-set
ANNO=Annotate-data-set
specifies a data set to annotate the output that the GPRINT procedure produces.
See also: The Annotate Data Set

CTEXT=text-color
specifies the color in which the procedure displays the text from the input file.

If you do not use the CTEXT= option, a color specification is searched for in the following order:

  1. the CTEXT= option in a GOPTIONS statement

  2. the default, the first color in the colors list.

The CTEXT= option in the PROC GPRINT statement does not affect titles and footnotes generated by TITLE and FOOTNOTE definitions.
Featured in: Specifying Color Text

DESCRIPTION='entry-description'
DES='entry-description'
specifies the description of the catalog entry for the chart. The maximum length for entry-description is 40 characters. The description does not appear on the chart. By default, the GPRINT procedure assigns the description OUTPUT FROM PROC GPRINT.

GOUT=<libref.>output-catalog
specifies the SAS catalog in which to save the graphics output produced by the GPRINT procedure. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary library called WORK and creates the catalog if it does not exist.
See also: Storing Graphics Output in SAS Catalogs

NAME='entry-name'
specifies the name of the catalog entry for the graph. The maximum length for entry-name is 8 characters. The default name is GPRINT. If the specified name duplicates the name of an existing entry, SAS/GRAPH software adds a number to the duplicate name to create a unique entry, for example, GPRINT1.

NOCC
tells the procedure that the external text file does not contain carriage-control characters. If you include the NOCC option, the procedure assumes that the first character on each line of the input file is a text character and not a carriage-control character. If you omit the NOCC option, the characters in column one are read as carriage-control characters. If they are valid carriage-control characters, the GPRINT procedure recognizes and executes them. If they are not valid carriage-control characters, the GPRINT procedure issues an error message.

O
causes a 0 (numeric zero) to be converted to the letter O in the output. This option circumvents the use of a numeric zero with an interior slash that is present on some devices.


Adjusting SAS Output and Graphics Output

The size of SAS output (or other text) in columns and rows and the size of graphics output are independently controlled. Depending on the result you want, you can do either of the following:

You can adjust the size (columns and rows) of any other external text file that you use as input to the GPRINT procedure. Although the following sections explain how to adjust the size of SAS output, the general process can be applied to any text file.

SAS Output Size

SAS output prints in pages. The length (in number of rows) and the width (in number of columns) of the page are determined by the PAGESIZE= and LINESIZE= options, respectively. Each character of SAS output occupies one column of space in a row (one cell), as shown in SAS Output Size.

SAS Output Size

[IMAGE]


Graphics Output Size

Graphics output is drawn in the graphics output area, which is also divided into cells. The overall dimensions of the graphics output area (width and height) are determined by the values of the device parameters XMAX and YMAX. These values, which determine the aspect ratio of the graphics output area, can be temporarily reduced with the HSIZE= and VSIZE= graphics options.

The number of columns and rows that fill the area is determined by the values of the LCOLS or PCOLS and LROWS or PROWS device parameters. These values, which determine the size and aspect ratio of a cell, can be temporarily altered with the HPOS= and VPOS= graphics options. The more columns and rows there are in a given area, the smaller the cells are. Therefore, using HPOS= and VPOS= to change the number of columns and rows also changes the size of the cells and may change the size of the characters. However, it does not affect the overall dimensions of the graph. For details, see Maintaining the aspect ratio of cells.

See Procedure Output and the Graphics Output Area for a complete description of the graphics output area. See SAS/GRAPH Programs for more information on device parameters and graphics options.

Matching Sizes

When you use the GPRINT procedure to convert SAS output to graphics output, you may need to manipulate the dimensions of either or both to get the proper size characters in the graphics output and to avoid truncating lines. Adjustment may be necessary in the following situations:

You can adjust the size of the SAS output or the size of the graphics output, or both.

Adjusting the size of the SAS output

The following steps show you how to use the PAGESIZE= and LINESIZE= options to adjust the page size of the SAS output to fit the size of the graphics output area.

  1. Use the GDEVICE procedure to determine the number of rows (LROWS or PROWS) and the number of columns (LCOLS or PCOLS) on the graphics device that you intend to use. See The GDEVICE Procedure for details.

  2. Determine the number of columns and rows that you are going to use for SAS/GRAPH titles and footnotes. (If you specify height in units of CELLS, each unit of height equals one row.)

  3. Use the OPTIONS statement to set the PAGESIZE= option equal to the number of rows on the device minus the number of positions to be used by TITLE and FOOTNOTE definitions. Set the LINESIZE= option equal to the number of columns on the device minus the number of positions used by titles and footnotes if the titles and footnotes are positioned vertically.

  4. Produce the SAS output.


Adjusting the size of the graphics output

The following steps show you how to use the HPOS= and VPOS= graphics options to adjust the number of columns and rows in the graphics output area on the output device so that it can accommodate the page size of your SAS output.

  1. Determine the number of columns (LINESIZE=) and rows (PAGESIZE=) in the SAS output.

  2. Use the GOPTIONS statement to set the VPOS= graphics option equal to the number of rows in the SAS output plus the number of rows to be used by TITLE and FOOTNOTE definitions. Set the HPOS= graphics option equal to the number of columns in the SAS output plus the number of columns to be used by titles and footnotes if the titles and footnotes are positioned vertically.

  3. Produce the GPRINT output.

Similarly, adjusting the overall dimensions of the graphics output area with the HSIZE= and VSIZE= graphics options may affect the size and possibly the aspect ratio of the cells.

Note:    Changing the values of the HPOS= and VPOS= graphics options changes the size of the cells and consequently of characters in the output. On devices with nonscalable hardware fonts, changing the aspect ratio with HPOS= and VPOS= causes the Simulate font to be used instead of hardware characters. However, if you specify software fonts, the change in aspect ratio may be ignored. See Using Fonts and Using Hardware Fonts for more information.  [cautionend]

Maintaining the aspect ratio of cells

If you change the values of the HPOS= and VPOS= graphics options to control the size of characters or to match the rows and columns of the external text file, you should try to maintain the same ratio of columns to rows as the original values of the device parameters. For example, suppose you have SAS output with 50 columns and 10 rows, and a graphics device that has 80 columns and 32 rows. The aspect ratio of the device is 5:2. If you print 10 rows of output on a device with 32 rows, you will have 22 blank lines. You can reduce the number of blank lines and increase the size of the characters by reducing the number of rows in the graphics output area with VPOS=. If, in addition to the 10 rows of output, you allow four lines of space for titles and two lines of space for a footnote, you need a total of 16 rows. Therefore, assigning a value of 20 to VPOS= should produce readable text and plenty of space. If VPOS=20, setting HPOS= to 50 retains the original aspect ratio of the device (80:32 or 5:2).

Note that this method allows space for titles and footnotes in terms of rows; the actual size of the titles and footnotes depends on the height specification you use. Using the unit CELLS to define the height of titles and footnotes makes it easier to calculate precisely how much space is available.


Using Fonts

By default, the GPRINT procedure uses the default hardware font with a height of 1 cell to display the text from the external file. However, if you specify a nonscalable hardware font, SAS/GRAPH may use the Simulate font instead. See SAS/GRAPH Fonts for details.

Font and height specifications for titles and footnotes are determined by the TITLE and FOOTNOTE definitions. See TITLE, FOOTNOTE, and NOTE Statements for details.

To specify a font and height for the text, use the FTEXT= and HTEXT= graphics options. If you specify a software font, it is best to use a uniform font such as Swiss Uniform so that your text will be evenly spaced.

CAUTION:
Changes in the aspect ratio of cells made with the HPOS= and VPOS= graphics options are ignored if you specify software fonts. Change the aspect ratio in the device entry if you want the software characters proportioned to fit the new aspect ratio.   [cautionend]

If you specify a software font and change the aspect ratio of the cells with the HPOS= and VPOS= graphics options, the change in aspect ratio is ignored and the procedure continues to draw the font in the original proportions. As a result, your text may not fit the graphics output area.

However, if you want the software characters to reflect a change in aspect ratio or if you want the characters to fit the new aspect ratio even if they are distorted, use the LCOLS or PCOLS and LROWS or PROWS device parameters in the device entry to change the aspect ratio of the cells. Using the device entry to specify a change in the aspect ratio enables you to distort the characters. See The GDEVICE Procedure for more information on changing device parameters.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.