![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/GRAPH Software: Reference |
| DSGI Functions |
DATA Step Graphics Interface Functions summarizes the types of operations available and the functions used to invoke them. Refer to DATA Step Graphics Interface Dictionary for details about each function.
| DSGI Routines |
DSGI routines return the values set by some of the DSGI functions. DATA Step Graphics Interface Routines summarizes the types of values that the GASK routines can check. Refer to DATA Step Graphics Interface Dictionary for details about each routine.
| Creating Simple Graphics with DSGI |
Within any DSGI program, you need to follow these basic steps:
Note: You must execute a RUN statement at the end of the DATA step to display the output.
Basic Steps Used in Creating DSGI Graphics Output outlines the basic steps and shows the functions used to initiate steps 1, 2, 4, and 5. Step 3 can consist of many types of functions. The GDRAW('LINE', . . . ) function is used as an example.
Basic Steps Used in Creating DSGI Graphics Output
Notice that there are two pairs of functions that work together within a DSGI DATA step (shown by a and b in Basic Steps Used in Creating DSGI Graphics Output). The first pair, GINIT() and GTERM(), begin and end DSGI. Within the first pair, the second pair, GRAPH('CLEAR', . . . ) and GRAPH('UPDATE', . . . ) begin and end a graphics segment. You can repeat these pairs within a single DATA step to produce multiple graphics output; however, the relative positions of these functions must be maintained within a DATA step. See Generating Multiple Graphics Output in One DATA Step for more information about producing multiple graphics outputs from one DATA step.
The order of these steps is controlled by DSGI operating
states. Before any DSGI function or routine can be submitted, the operating
state in which that function or routine can be submitted must be active. See How Operating States Control the Order of DSGI Statements.
Each graphics primitive is associated with a particular set of attributes. Its appearance can only be altered by that set of attributes. Graphics Output Primitive Functions and Associated Attributes lists the operators used with GDRAW functions to generate graphics elements and the attributes that control their appearance.
If you do not set an attribute before you submit a graphics
primitive, DSGI uses the default value for the attribute. Refer to DATA Step Graphics Interface Dictionary for the
default values used for each attribute.
GKCL WSAC SGOP WSAC
GKCL |
| GINIT() | GKCL WSAC |
| GRAPH('CLEAR', . . . ) | WSAC SGOP |
| GRAPH('UPDATE', . . . ) | SGOP WSAC |
| GTERM() | WSAC GKCL |
Because these functions change the operating state, you must order all other functions and routines so that the change in operating state is appropriate for the functions and routines that follow. The following program statements show how the operating state changes from step to step in a typical DSGI program. They also summarize the functions and routines that can be submitted under each operating state. The functions that change the operating state are included as actual statements. Refer to Operating States for the operating states from which functions and routines can be submitted.
data dsname;
/* GKCL - initial state of DSGI; can execute: */
/* 1. GSET functions that set attributes */
/* that affect the entire graphics output */
/* 2. some catalog management functions */
/* (some GRAPH functions) */
/* Step 1 - initialize DSGI */
rc=ginit();
/* WSAC - workstation is active; can execute: */
/* 1. most GASK routines */
/* 2. some catalog management functions */
/* (some GRAPH functions) */
/* 3. GSET functions that set attributes */
/* and bundles, viewports, windows, */
/* transformations, and message logging */
/* Step 2 - open a graphics segment */
rc=graph('clear', 'text');
/* SGOP - segment open; can execute: */
/* 1. any GASK routine */
/* 2. any GDRAW function */
/* 3. some catalog management functions */
/* (some GRAPH functions) */
/* 4. GSET functions that set attributes */
/* and bundles, viewports, windows, */
/* transformations, and message logging */
/* Step 3 - execute graphics primitives */
rc = gdraw('line', 2, 30,50,50,50);
/* Step 4 - close the graphics segment */
rc=graph('update');
/* WSAC - workstation is active; can execute: */
/* 1. most GASK routines */
/* 2. some catalog management functions */
/* (some GRAPH functions) */
/* 3. GSET functions that set attributes */
/* and bundles, viewports, windows, */
/* transformations, and message logging */
/* Step 5 - end DSGI */
rc=gterm();
/* GKCL - initial state of DSGI */
run;
Notice that you can set attributes for the graphics primitives in several places. As long as the functions that set the attributes are executed before the graphics primitives, they will affect the graphics output. If you execute them after a graphics primitive, the primitive is not affected. See Setting Attributes for Graphics Elements.
The following program statements illustrate a more complex DSGI program that produces Simple Graphics Output Generated with DSGI when submitted. Notice that all attributes for a graphics primitive are executed before the graphics primitive. In addition, the GINIT() and GTERM() pairing and the GRAPH('CLEAR') and GRAPH('UPDATE') pairing are maintained within the DATA step. Refer to Operating States for the operating states in which each function and routine can be submitted.
/* set the graphics environment */
goptions reset=global gunit=pct border
hsize=7 in vsize=5 in
targetdevice=pscolor;
/* execute a DATA step with DSGI */
data dsname;
/* initialize SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* assign colors to color index */
rc=gset('colrep', 1, 'blue');
rc=gset('colrep', 2, 'red');
/* define and display titles */
rc=gset('texcolor', 1);
rc=gset('texfont', 'swissb');
rc=gset('texheight', 6);
rc=gdraw('text', 45, 93, 'Simple Graphics Output');
/* change the height and */
/* display second title */
rc=gset('texheight', 4);
rc=gdraw('text', 58, 85, 'Created with DSGI');
/* define and display footnotes */
/* using same text font and */
/* color as defined for titles */
rc=gset('texheight', 3);
rc=gdraw('text', 125, 1, 'GR31N03 ');
/* define and draw bar */
rc=gset('lincolor', 2);
rc=gset('linwidth', 5);
rc=gdraw('line', 2, 72, 72, 30, 70);
rc=gdraw('line', 2, 52, 92, 50, 50);
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Simple Graphics Output Generated with DSGI
| Bundling Attributes |
Each graphics primitive has a group of attributes associated with it that can be bundled. Only the attributes in that group can be assigned to the bundle. Attributes That Can Be Bundled for Each Graphics Primitive shows the attributes that can be bundled for each graphics primitive.
To assign values of attributes to a bundle, you must
The following example assigns the text attributes, color, and font, to the bundle indexed by the number 1. As shown in the GSET('TEXREP', . . . ) function, the color for the bundle is green, the second color in the COLOR= graphics option. The font for the bundle is the 'ZAPF' font. (See COLREP for an explanation of how colors are used in DSGI.)
goptions colors=(red green blue);
data dsname;
.
. /* other DATA step statements */
.
/* associate the bundle with the index 1 */
rc=gset('texrep', 1, 2, 'zapf');
.
. /* more statements */
.
/* assign the text attributes to a bundle */
rc=gset('asf', 'texcolor', 'bundled');
rc=gset('asf', 'texfont', 'bundled');
/* draw the text */
rc=gdraw('text', 50, 50, 'Today is the day.');
/* invoke the bundle of text attributes */
rc=gset('texindex', 1);
/* define another attribute bundle for text */
rc=gset('texrep', 2, 3, 'swiss');
goptions colors=(red green blue);
rc=gset('asf', 'lincolor', 'bundled');
rc=gset('asf', 'linwidth', 'bundled');
rc=gset('asf', 'lintype', 'bundled');
rc=gset('linrep', 3, 2, 5, 1);
/* activate the bundle */
rc=gset('linindex', 3);
/* select other attributes for the line */
rc=gset('lincolor', 3);
rc=gset('linwidth', 10);
rc=gset('lintype', 4);
/* draw a line from point (30,50) to (70,50) */
rc=gdraw('line', 2, 30, 70, 50, 50);
During processing, DSGI chooses the value of an attribute using the following logic:
/* disassociate an attribute from a bundle */
rc=gset('asf', 'texcolor', 'individual');
rc=gset('asf', 'texfont', 'individual');
| Using Viewports and Windows |
You generally follow these steps when defining viewports or windows:
The following program statements divide the graphics output area into four subareas:
/* define the first viewport, indexed by 1 */
rc=gset('viewport', 1, .05, .05, .45, .45);
/* define the second viewport, indexed by 2 */
rc=gset('viewport', 2, .55, .05, .95, .45);
/* define the third viewport, indexed by 3 */
rc=gset('viewport', 3, .55, .55, .95, .95);
/* define the fourth viewport, indexed by 4 */
rc=gset('viewport', 4, .05, .55, .45, .95);
When you use viewports,
you also may need to
use the clipping feature. Even though you have defined the dimensions of your
viewport, it is possible for graphics elements to display past its boundaries.
If the graphics elements are too large to fit into the dimensions you have
defined, portions of the graphics elements actually display outside of the
viewport. To ensure that only the portions of the graphics elements that fit
within the dimensions of the viewport display, turn the clipping feature on
by using the GSET('CLIP', . . . ) function. For details, see CLIP.
/* define the window for viewport 1 */
rc=gset('window', 1, 0, 50, 20, 100);
/* define the window for viewport 2 */
rc=gset('window', 2, 0, 40, 20, 90);
/* define the window for viewport 3 */
rc=gset('window', 3, 10, 25, 45, 100);
/* define the window for viewport 4 */
rc=gset('window', 4, 0, 0, 100, 100);
See Scaling Graphs by Using Windows for an example of using windows to scale graphs.
/* define the viewports */
.
.
.
/* define the windows */
.
.
.
/* activate the first transformation */
gset('transno', 1);
.
. /* graphics primitive functions follow */
.
/* activate the second transformation */
gset('transno', 2);
.
. /* graphics primitive functions follow */
.
/* activate the third transformation */
gset('transno', 3);
.
. /* graphics primitive functions follow */
.
/* activate the fourth transformation */
gset('transno', 4);
.
. /* graphics primitive functions follow */
.
When you activate these transformations, your display is logically divided into four subareas as shown in Graphics Output Area Divided into Four Logical Transformations.
Graphics Output Area Divided into Four Logical Transformations
| Inserting Existing Graphs into DSGI Graphics Output |
The following program statements provide an example of including an existing
graph in the graphics output being created. The name of the existing graph
is 'MAP'. 'LOCAL' points to the library containing the catalog 'MAPCTLG'.
The coordinates of the viewport are percentages of the graphics output area.
SAS-data-library refers to a
permanent SAS data library.
Graphics Output Area Divided into Four Logical Transformations
libname local 'SAS-data-library'; . . . /* select the output catalog to the */ /* catalog that contains 'map' */ rc=gset('catalog', 'local', 'mapctlg'); . . . /* define the viewport to contain the */ /* existing graph */ rc=gset('viewport', 1, .25, .45, .75, .9); rc=gset('window', 1, 0, 0, 100, 100); /* set the transformation number to the one */ /* defined in the viewport function */ rc=gset('transno', 1); /* insert the existing graph */ rc=graph('insert', 'map');
These statements put the existing graph 'MAP' in the upper half of the graphics output.
| Generating Multiple Graphics Output in One DATA Step |
![[cautend]](../common/images/cautend.gif)
| Processing DSGI Statements in Loops |
You can process DSGI statements in loops to draw a graphics element multiple times in one graphics output or to produce multiple output. If you use loops, you must maintain the GRAPH('CLEAR', . . . ) and GRAPH('UPDATE', . . . ) pairing within the GINIT() and GTERM() pairing. (See Basic Steps Used in Creating DSGI Graphics Output.) The following program statements illustrate how you can use DSGI statements to produce multiple graphics output for different output devices:
data _null_;
length d1-d5 $ 8;
input d1-d5;
array devices{5} d1-d5;
.
.
.
do j=1 to 5;
rc=gset('device', devices{j});
.
.
.
rc=ginit();
.
.
.
do i=1 to 5;
rc=graph('clear');
rc=gset('filcolor', i);
rc=gdraw('bar', 45, 45, 65, 65);
rc=graph('update');
end;
.
.
.
rc=gterm();
end;
cards;
tek4105 hp7475 ps qms800 ibm3279
;
run;
| Examples |
Refer to DATA Step Graphics Interface Dictionary
for a complete description of each of the functions used in the examples.
The following program statements produce Text Angled with the GSET('TEXUP', ...) Function:
/* set the graphics environment */
goptions reset=global gunit=pct border
ftext=swissb htitle=6 htext=3
colors=(black blue green red)
hsize=7 in vsize=5 in
targetdevice=pscolor;
/* define the footnote and title */
footnote1 j=r 'GR31N04 ';
title1 'Text Up Vector';
/* execute DATA step with DSGI */
data vector;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* define and display arc */
/* with intersecting lines */
rc=gset('lincolor', 2);
rc=gset('linwidth', 5);
rc=gdraw('arc', 84, 50, 35, 0, 360);
rc=gdraw('line', 2, 49, 119, 51, 51);
rc=gdraw('line', 2, 84, 84, 15, 85);
/* define height of text */
rc=gset('texheight', 5);
/* mark 360 degrees on the arc */
/* using default align */
rc=gdraw('text', 121, 50, '0');
/* set text to align to the right and */
/* mark 180 degrees on the arc */
rc=gset('texalign', 'right', 'normal');
rc=gdraw('text', 47, 50, '180');
/* set text to align to the center and */
/* mark 90 and 270 degrees on the arc */
rc=gset('texalign', 'center', 'normal');
rc=gdraw('text', 84, 87, '90');
rc=gdraw('text', 84, 9, '270');
/* reset texalign to normal and */
/* display coordinate values or quadrant */
rc=gset('texalign', 'normal', 'normal');
rc=gdraw('text', 85, 52, '(0.0, +1.0)');
/* rotate text using TEXUP and */
/* display coordinate values or quadrant */
rc=gset('texup', 1.0, 0.0);
rc=gdraw('text', 85, 49, '(+1.0, 0.0)');
/* rotate text using TEXUP and */
/* display coordinate values or quadrant */
rc=gset('texup', 0.0, -1.0);
rc=gdraw('text', 83, 50, '(0.0, -1.0)');
/* rotate text using TEXUP and */
/* display coordinate values or quadrant */
rc=gset('texup', -1.0, 0.0);
rc=gdraw('text', 83, 52, '(-1.0, 0.0)');
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Text Angled with the GSET('TEXUP', ...) Function
This example illustrates the following features:
This example changes the reading direction of text. Notice that the data set name is _NULL_. No data set is created as a result of this DATA step; however, the graphics output is generated. The following program statements produce Reading Direction of the Text Changed with the GSET('TEXPATH', ...) Function:
/* set the graphics environment */
goptions reset=global gunit=pct border
ftext=swissb htitle=6 htext=3
colors=(black blue green red)
hsize=7 in vsize=5 in
targetdevice=pscolor;
/* define the footnote and title */
footnote1 j=r 'GR31N05 ';
title1 'Text Path';
/* execute DATA step with DSGI */
data _null_;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* define height of text */
rc=gset('texheight', 5);
/* display first text */
rc=gdraw('text', 105, 50, 'Right');
/* change text path so that text reads from */
/* right to left and display next text */
rc=gset('texpath', 'left');
rc=gdraw('text', 65, 50, 'Left');
/* change text path so that text reads up */
/* the display and display next text */
rc=gset('texpath', 'up');
rc=gdraw('text', 85, 60, 'Up');
/* change text path so that text reads down */
/* the display and display next text */
rc=gset('texpath', 'down');
rc=gdraw('text', 85, 40, 'Down');
/* display the graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Reading Direction of the Text Changed with the GSET('TEXPATH', ...) Function
Features not explained earlier in "Vertically Angling Text" are described here:
This example uses the GCHART procedure to generate a graph, defines a viewport in which to display it, and inserts the GCHART graph into the graphics output being created by DSGI. Pie Chart Produced with the GCHART Procedure shows the pie chart created by the GCHART procedure. Pie Chart Inserted into DSGI Graph by Using a Viewport shows the same pie chart after it has been inserted into a DSGI graph.
/* set the graphics environment */
goptions reset=global gunit=pct border
ftext=swissb htitle=6 htext=4
colors=(black blue green red)
hsize=7 in vsize=7 in
targetdevice=pscolor;
/* create data set TOTALS */
data totals;
length dept $ 7 site $ 8;
do year=1996 to 1999;
do dept='Paris','Repairs','Tools';
do site='New York','Atlanta','Chicago','Seattle';
sales=ranuni(97531)*10000+2000;
output;
end;
end;
end;
run;
/* define the footnote */
footnote1 h=3 j=r 'GR31N06 ';
/* generate pie chart from TOTALS */
/* and create catalog entry PIE */
proc gchart data=totals;
format sales dollar8.;
pie site
/ type=sum
sumvar=sales
midpoints='New York' 'Chicago' 'Atlanta' 'Seattle'
fill=solid
cfill=green
coutline=blue
angle=45
percent=inside
value=inside
slice=outside
noheading
name='gr31n06';
run;
/* define the titles */
title1 'Total Sales';
title2 'For Period 1996-1999';
/* execute DATA step with DSGI */
data piein;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* define and activate viewport for inserted graph */
rc=gset('viewport', 1, .15, .05, .85, .90);
rc=gset('window', 1, 0, 0, 100, 100);
rc=gset('transno', 1);
/* insert graph created from GCHART procedure */
rc=graph('insert', 'gr31n06');
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Pie Chart Produced with the GCHART Procedure
Pie Chart Inserted into DSGI Graph by Using a Viewport
Features not explained in previous examples are described here:
This example uses the GPLOT procedure to generate a plot of AMOUNT*MONTH and store the graph in a permanent catalog. DSGI then scales the graph by defining a window in another DSGI graph and inserting the GPLOT graph into that window. Plot Produced with the GPLOT Procedure shows the plot as it is displayed with the GPLOT procedure. Plot Scaled by Using a Window in DSGI shows how the same plot is displayed when the x axis is scaled from 15 to 95 and the y axis is scaled from 15 to 75.
/* set the graphics environment */
goptions reset=global gunit=pct border
ftext=swissb htitle=6 htext=3
colors=(black blue green red)
hsize=7 in vsize=5 in
targetdevice=pscolor;
/* create data set EARN, which holds month */
/* and amount of earnings for that month */
data earn;
input month amount;
datalines;
1 2.1
2 3
3 5
4 6.4
5 9
6 7.2
7 6
8 9.8
9 4.4
10 2.5
11 5.75
12 4.35
;
run;
/* define the footnote for the first graph */
footnote1 j=r 'GR31N07(a) ';
/* define axis and symbol characteristics */
axis1 label=(color=green 'Millions of Dollars')
order=(1 to 10 by 1)
value=(color=green);
axis2 label=(color=green 'Months')
order=(1 to 12 by 1)
value=(color=green Tick=1 'Jan' Tick=2 'Feb' Tick=3 'Mar'
Tick=4 'Apr' Tick=5 'May' Tick=6 'Jun'
Tick=7 'Jul' Tick=8 'Aug' Tick=9 'Sep'
Tick=10 'Oct' Tick=11 'Nov' Tick=12 'Dec');
symbol value=M font=special height=8 interpol=join
color=blue width=3;
/* generate a plot of AMOUNT * MONTH, */
/* and store in member GR31N07 */
proc gplot data=earn;
plot amount*month
/ haxis=axis2
vaxis=axis1
name='gr31n07';
run;
/* define the footnote and titles for */
/* second graph, which will scale output */
footnote1 j=r 'GR31N07(b) ';
title1 'XYZ Corporation Annual Earnings';
title2 h=4 'Fiscal Year 1999';
/* execute DATA step with DSGI using */
/* catalog entry created in previous */
/* plot, but do not create a data set */
/* (determined by specifying _NULL_) */
data _null_;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* define viewport and window for inserted graph */
rc=gset('viewport', 1, .20, .30, .90, .75);
rc=gset('window', 1, 15, 15, 95, 75);
rc=gset('transno', 1);
/* insert graph previously created */
rc=graph('insert', 'gr31n07');
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Plot Produced with the GPLOT Procedure
Plot Scaled by Using a Window in DSGI
One feature not explained in previous examples is described here:
This example illustrates how you can enlarge a section of a graph by using windows. In the first DATA step, the program statements generate graphics output that contains four pie charts. The second DATA step defines a window that enlarges the bottom-left quadrant of the graphics output and inserts 'GR31N08' into that window. The following program statements produce Four Pie Charts Generated with DSGI from the first DATA step, and Area of the Graph Enlarged by Using Windows from the second DATA step:
/* set the graphics environment */
goptions reset=global gunit=pct border
ftext=swissb htext=3
colors=(black blue green red)
hsize=7 in vsize=5 in
targetdevice=pscolor;
/* define the footnote for the first graph */
footnote1 j=r 'GR31N08(a) ';
/* execute DATA step with DSGI */
data plot;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear', 'gr31n08');
/* define and draw first pie chart */
rc=gset('filcolor', 4);
rc=gset('filtype', 'solid');
rc=gdraw('pie', 30, 75, 22, 0, 360);
/* define and draw second pie chart */
rc=gset('filcolor', 1);
rc=gset('filtype', 'solid');
rc=gdraw('pie', 30, 25, 22, 0, 360);
/* define and draw third pie chart */
rc=gset('filcolor', 3);
rc=gset('filtype', 'solid');
rc=gdraw('pie', 90, 75, 22, 0, 360);
/* define and draw fourth pie chart */
rc=gset('filcolor', 2);
rc=gset('filtype', 'solid');
rc=gdraw('pie', 90, 25, 22, 0, 360);
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
/* define the footnote for the second graph */
footnote1 j=r 'GR31N08(b) ';
/* execute DATA step with DSGI */
/* that zooms in on a section of */
/* the previous graph */
data zoom;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* define and activate a window */
/* that will enlarge the lower left */
/* quadrant of the graph */
rc=gset('window', 1, 0, 0, 50, 50);
rc=gset('transno', 1);
/* insert the previous graph into */
/* window 1 */
rc=graph('insert', 'gr31n08');
/* display graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
Four Pie Charts Generated with DSGI
Area of the Graph Enlarged by Using Windows
Features not explained in previous examples are described here:
This example assigns a predefined color to color index 2 and then invokes a GASK routine to get the name of the color associated with color index 2. The value returned from the GASK call is displayed in the log and written to a data set. Checking the Color Associated with a Particular Color Index shows how the value appears in the log. Writing the Value of an Attribute to a Data Set shows how the value appears in the data set in the OUTPUT window.
/* execute DATA step with DSGI */
data routine;
/* declare character variables used */
/* in GASK subroutines */
length color $ 8;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* set color for color index 2 */
rc=gset('colrep', 2, 'orange');
/* check color associated with color index 2 and */
/* display the value in the LOG window */
call gask('colrep', 2, color, rc);
put 'Current FILCOLOR =' color;
output;
/* end DSGI without displaying the graph */
rc=graph('update', 'noshow');
rc=gterm();
run;
/* display the contents of ROUTINE */
proc print data=routine;
run;
Checking the Color Associated with a Particular Color Index
3 /* execute DATA step with DSGI */
4 data routine;
5
6 /* declare character variables used */
7 /* in GASK subroutines */
8 length color $ 8;
9
10 /* prepare SAS/GRAPH software */
11 /* to accept DSGI statements */
12 rc=ginit();
13 rc=graph('clear');
14
15 /* set color for color index 2 */
16 rc=gset('colrep', 2, 'orange');
17
18 /* check color associated with color index 2 and */
19 /* display the value in the LOG window */
20 call gask('colrep', 2, color, rc);
21 put 'Current FILCOLOR =' color;
22 output;
23
24 /* end DSGI without displaying the graph */
25 rc=graph('update', 'noshow');
26 rc=gterm();
27 run;
Current FILCOLOR =ORANGE |
Writing the Value of an Attribute to a Data Set
The SAS System 13:50 Tuesday, December 22, 1998 1
Obs color rc
1 ORANGE 0 |
Features not explained in previous examples are described here:
Note:
The example assumes
users will access the output through a file system rather than accross the
Web, so the HTML string uses a file specification rather than a full URL.
For information on bringing SAS/GRAPH output to the Web, see Bringing SAS/GRAPH Output to the Web. For specific information
about drill-down graphs, see About Drill-down Graphs. ![[cautend]](../common/images/cautend.gif)
In the example, the ODS HTML statement is used to create a body file named dsgi.htm. When file dsgi.htm is viewed in a Web browser, it displays a solid pie chart, as shown in Drill-down Graph Generated with DSGI. To drill down to the graph shown in Target Output for Drill-down Graph, click anywhere in the pie chart. This example uses PROC GSLIDE to create the simple graphic that is used for the target output:
/* This is the only line you have to */
/* change to run the program. Specify */
/* a location in your file system. */
filename odsout 'path-to-Web-server';
/* close the listing destination */
ods listing close;
/* set the graphics environment */
goptions reset=global gunit=pct noborder
ftitle=swissb htitle=6
ftext=swiss htext=3
colors=(black blue)
hsize=5 in vsize=5 in
device=gif;
/* define tile and footnote for graph */
title1 'Drill-down Graph';
footnote1 j=l ' Click in pie chart'
j=r 'GR31N10 ';
ods html body='dsgi.htm'
path=odsout;
/* execute DATA step with DSGI */
data _null_;
/* prepare SAS/GRAPH software */
/* to accept DSGI statements */
rc=ginit();
rc=graph('clear');
/* set a value for the html variable */
rc=gset('html', 'href="blue.htm"');
/* define and draw a pie chart */
rc=gset('filcolor', 2);
rc=gset('filtype', 'solid');
rc=gdraw('pie', 55, 50, 22, 0, 360);
/* generate graph and end DSGI */
rc=graph('update');
rc=gterm();
run;
goptions ftext=centb ctext=blue;
/* open a new body file for the */
/* target output */
ods html body='blue.htm'
path=odsout;
title1;
footnote1;
proc gslide wframe=4
cframe=blue
name='blue';
note height=20;
note height=10
justify=center
'Blue Sky';
run;
quit;
ods html close;
ods listing;
Drill-down Graph Generated with DSGI
Target Output for Drill-down Graph
Features not explained in previous examples are described here:
| See Also |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.