Examples


Example 1: Testing a GOPTIONS Statement

Features:

  • GOPTIONS statement

  • GTESTIT procedure

Sample library member: GITTGOS1

click to expand

This example illustrates how you can use the GTESTIT procedure to confirm the settings specified on a GOPTIONS statement. In this example, the GOPTIONS statement enlarges the size of the elements in the graphics output by decreasing the number of columns from the default number of columns for the device, resets the font to the default, and specifies a limited colors list.

Set the graphics environment. HPOS= selects 45 columns. VPOS= selects 25 rows. FTEXT= resets the font to the default font. COLORS= can determine the colors displayed in picture 1 and listed in the LOG, and the value of NCOLORS=.

 goptions hpos=45           vpos=25           ftext=           colors=(blue red green); 

Display the first picture of the GTESTIT procedure.

 proc gtestit picture=1;  run;  quit; 

Example 2: Displaying, Changing and Verifying the Colors List for a Device Driver

Features:

  1. GOPTIONS statement

  2. GOPTIONS COLORS= option

  3. GTESTIT procedure

The colors that SAS/GRAPH uses for the elements of a graph are determined, in order of precedence, by:

  1. The presence in a GOPTIONS statement of options that control the color of elements (for example, GOPTIONS CTEXT= to control the color of text).

  2. The COLORS= option on a GOPTIONS statement

  3. The default color list for the device driver for which the graph is being prepared.

For more information on the order in which SAS/GRAPH chooses colors, see Defining and Using a Colors List on page 93

You can use PROC GTESTIT to display the default color list for a device driver. For example, the following procedure displays the default color list for graphs prepared for the ActiveX control.

 goptions reset=all device=activex;  proc gtestit picture=1;  run;  quit; 

Running this procedure shows the default color list for the device ActiveX, as seen in the following output from PROC GTESTIT:

 D=ACTIVEX  B=1200    R= 43 C= 83 P=256  H= 13 W=  9 MAX=  0 D=8000000000000000  RF=8000800000000000 S=0000000000000000  OPTS=3500304009280008 NCOLORS= 10  Backgroung color = WHITE  Color 1 = BLACK  Color 2 = RED  Color 3 = GREEN  Color 4 = BLUE  Color 5 = CYAN  Color 6 = MAGENTA  Color 7 = GRAY  Color 8 = PINK  Color 9 = ORANGE  Color 10 = BROWN  Ratio = 0.74941  Hsize =    8.42  Vsize =    6.31  F=1 

The following procedure uses the COLORS= option of the GOPTIONS statement to change (temporarily) the color list for the device driver ActiveX. Then, it invokes PROC GTESTIT to verify that the color list is changed. The color list is changed at most for the duration of the SAS session. Use the GDEVICE procedure to change the color list permanently.

 goptions reset=all           device=activex           colors=(red, green, blue, yellow);  proc gtestit picture=1;  run;  quit; 

The following output from PROC GTEST shows that the color list for ActiveX has changed:

 D=ACTIVEX  B=1200    R= 43 C= 83 P=256  H= 13 W=  9 MAX=  0 D=8000000000000000  RF=8000800000000000 S=0000000000000000  OPTS=3500304009280008 NCOLORS=  4  Backgroung color = WHITE  Color 1 = RED  Color 2 = GREEN  Color 3 = BLUE  Color 4 = YELLOW  Ratio = 0.74941  Hsize =   8.42  Vsize =   6.31  F=1 

The following code resets the color list for the ActiveX device to the default, and then reissues PROC GTESTIT to verify that the colors have been reset:

 goptions colors=()           device=activex;  proc gtestit picture=1;  run;  quit; 

The following output confirms that the default color list has been re-established:

 D=ACTIVEX  B=1200    R= 43 C= 83 P=256  H= 13 W=  9 MAX=  0 D=8000000000000000  RF=8000800000000000 S=0000000000000000  OPTS=3500304009280008 NCOLORS= 10  Backgroung color = WHITE  Color 1 = BLACK  Color 2 = RED  Color 3 = GREEN  Color 4 = BLUE  Color 5 = CYAN  Color 6 = MAGENTA  Color 7 = GRAY  Color 8 = PINK  Color 9 = ORANGE  Color 10 = BROWN  Ratio = 0.74941  Hsize =    8.42  Vsize =    6.31  F=1 



SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net