Graph Ref
Graph Ref
2 Reference
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS/GRAPH 9.2: Reference. Cary, NC: SAS Institute Inc. SAS/GRAPH 9.2: Reference Copyright 2009, SAS Institute Inc., Cary, NC, USA 978-1-59994-633-7 All rights reserved. Produced in the United States of America. For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc. For a Web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of this software and related documentation by the U.S. government is subject to the Agreement with SAS Institute and the restrictions set forth in FAR 52.227-19 Commercial Computer Software-Restricted Rights (June 1987). SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513. 1st electronic book, February 2009 1st printing, March 2009 SAS Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential. For more information about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site at support.sas.com/publishing or call 1-800-727-3228. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
Contents
Whats New xv Overview xv The SAS/GRAPH Statistical Graphics Suite xv The SAS/GRAPH Network Visualization Workshop xvi Support for Multiple Open ODS Destinations xvii Support for ODS Styles xvii Devices xvii Colors xviii Fonts and Font Rendering xviii Changing the Appearance of Output to Match That of Earlier SAS Releases Procedures xix Global Statements xxiii Graphics Options xxiv Transparent Overlays xxiv ActiveX Control xxiv Java Map Applet xxiv Java Tilechart Applet xxiv The Annotate Facility xxv New Map Data Sets xxv Updated Map Data Sets xxv Map Data Set Descriptions xxx New Data Set for Military ZIP Codes xxx Changes in SAS/GRAPH Documentation xxx
xix
PART
SAS/GRAPH Concepts
Chapter 1
Overview 4 Components of SAS/GRAPH Software 4 Device-Based Graphics and Template-Based Graphics Graph Types 6 About this Document 23 Conventions Used in This Document 24 Information You Should Know 27
Chapter 2
31
Chapter 3
39
40
iv
43 48 49
Controlling the Graphics Output Format With the DEVICE= Option Summary of Default Destinations, Styles, and Devices Sending Output To Multiple Open Destinations Related Topics
52 51
Chapter 4
4 SAS/GRAPH Processing
53 54
53
56
Chapter 5
Overview
59
59 61 65 65
The Graphics Output and Device Display Areas Controlling Dimensions Units
62
Controlling Display Area Size and Image Resolution Maintaining the Quality of Your Image Across Devices How Errors in Sizing Are Handled
66
Chapter 6
Overview
67
Default Devices For ODS Destinations Deciding Which Device To Use Overriding the Default Device
71 72
69 71
Device Categories And Modifying Default Output Attributes Using Universal Printer Shortcut Devices Using Scalable Vector Graphics Devices Viewing and Modifying Device Entries Creating a Custom Device Related Topics
86 86 85 75 77
72
Chapter 7
4 SAS/GRAPH Output
88 94
87
91
Specifying the Graphics Output File Type for Your Graph The SAS/GRAPH Output Process Setting the Size of Your Graph
93 95 97
Replacing an Existing Graphics Output File Using the GSFMODE= Graphics 104 Option Storing Multiple Graphs in a Single Graphics Output File 104 Replaying Your SAS/GRAPH Output 106 Previewing Output 109 Printing Your Graph 109 Exporting Your Output 110
Chapter 8
What to Consider When Choosing an Output Format Comparison of the Graphics Output 114 Enhancing Your Graphs 118 Importing Your Graphs into Microsoft Ofce 118
111
Chapter 9
About Writing Your Graphs to a PDF File 121 Changing the Page Layout 122 Adding Metadata to Your PDF File 122 Adding Bookmarks for Your Graphs 122 Changing the Default Compression Level for Your PDF File Examples 123
121
123
Chapter 10
Overview 131 Style Attributes Versus Device Entry Parameters 132 About Style Templates 133 Specifying a Style 137 Overriding Style Attributes With SAS/GRAPH Statement Options 138 Precedence of Appearance Option Specications 139 Viewing the List of Styles Provided by SAS 139 Modifying a Style 140 Graphical Style Element Reference for Device-Based Graphics 142 Turning Off Styles 151 Changing the Appearance of Output to Match That of Earlier SAS Releases
131
152
Chapter 11
Introduction: Specifying Fonts in SAS/GRAPH Programs SAS/GRAPH, System, and Device-Resident Fonts 153 TrueType Fonts That Are Supplied by SAS 154 Determining What Fonts Are Available 155 Default Fonts 155 Viewing Font Specications in the SAS Registry 156 Specifying a Font 157 Methods For Specifying Fonts 161
153
153
Chapter 12
165
vi
166 179
Chapter 13
189
ODS Destination Statement Options 190 ODS and Procedures that Support RUN-Group Processing 192 Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output
192
Chapter 14
Overview 195 Example 1. Ordering Axis Tick Marks with SAS Date Values Example Example Example Example Example Example Example Example Example
4 SAS/GRAPH Statements
195
294
2. Specifying Logarithmic Axes 296 3. Rotating Plot Symbols Through the Color List 299 4. Creating and Modifying Box Plots 301 5. Filling the Area between Plot Lines 304 6. Enhancing Titles 307 7. Using BY-group Processing to Generate a Series of Charts 309 8. Creating a Simple Web Page with the ODS HTML Statement 313 9. Combining Graphs and Reports in a Web Page 315 10. Creating a Bar Chart with Drill-Down Functionality for the Web 321
Chapter 15
Introduction 329 Specifying Graphics Options and Device Parameters 329 Dictionary of Graphics Options and Device Parameters 330
329
PART
4 Introducing SAS/GRAPH Output for the Web 4 Creating Interactive Output for ActiveX
439
441
Chapter 17
455
Overview 455 When to Use the ACTIVEX Device 456 Installing the SAS/GRAPH ActiveX Control 457 Generating Output for ActiveX 459 About Languages in ACTIVEX 460 About Special Fonts and Symbols in ACTIVEX 461 SAS Formats Supported by ACTIVEX 461 Conguring Drill-Down Links with ACTIVEX 462
vii
ActiveX Examples
463
Chapter 18
Overview 471 When to Use the JAVA Device 472 Generating Output for Java 472 Conguring Drill-Down Links for Java 477 Examples of Interactive Java Output 477
471
Chapter 19
Specifying Parameters and Attributes for Java and ActiveX Parameter Reference for Java and ActiveX 490
4 Attributes and Parameters for Java and ActiveX 4 Generating Static Graphics
505
487
487
Chapter 20
What is a Static Graphic? 505 Creating a Static Graphic 506 ACTXIMG and JAVAIMG Devices Compared to GIF, JPEG, SVG, and PNG Devices 508 Developing Web Presentations with the GIF, JPEG, SVG, and PNG Devices 510 Developing Web Presentations with the JAVAIMG and ACTXIMG Devices 512 Adding Drill-Down Links to Web Presentations Generated with a Static-Graphic 514 Device Sample Programs for Static Images 514
Chapter 21
Developing Web Presentations with the GIFANIM Device 521 When to Use the GIFANIM Device 521 Creating an Animated Sequence 522 GOPTIONS for Controlling GIFANIM Presentations 523 Sample Programs: GIFANIM 524
521
Chapter 22
Developing Web Presentations for the Metaview Applet 533 Advantages of Using the JAVAMETA Device 534 Using ODS With the JAVAMETA Device 534 Enhancing Web Presentations for the Metaview Applet 535 Specifying Non-English Resource Files and Fonts 535 Metaview Applet Parameters 536 Example: Generating Metacode Output With the JAVAMETA Driver
533
538
Chapter 23
Overview of Generating Web Output with the Annotate Facility Generating Web Output with the Annotate Facility 541 Examples 543
4 Generating Web Output with the Annotate Facility 4 Creating Interactive Treeview Diagrams
548
541
541
Chapter 24
545
Creating Treeview Diagrams 546 Enhancing Presentations for the Treeview Applet
viii
549
Chapter 25
Creating Constellation Diagrams 555 Enhancing Presentations for the Constellation Applet DS2CONST Macro Arguments 562 Sample Programs: Constellation Macro 562
555
Chapter 26
Macro Arguments
571
Chapter 27 Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality 597
Overview of Enhancing Web Presentations 598 Chart Descriptions for Web Presentations 598 Data Tips for Web Presentations 600 Adding Links with the HTML= and HTML_LEGEND= Options 603 Controlling Drill-Down Behavior For ActiveX and Java Using Parameters Example: Creating Bar Charts with Drill-Down for the Web 620
610
Chapter 28
Troubleshooting Web Output 635 Checking Browser Permissions 638 Using HTML Character Entities 638 Connecting to Web Servers that Require Authentication 639 Removing CLASSPATH Environment Variables 639 Setting the SAS_ALT_DISPLAY Variable for X Window Systems on UNIX 639 Correcting Text Fonts 640 Resolving Differences Between Graphs Generated with Different Technologies 640
635
PART
Overview 643 About the Annotate Data Set 645 About Annotate Graphics 651 Creating an Annotate Data Set 656 Producing Graphics Output from Annotate Data Sets Annotate Processing Details 658 Examples 660
641
643
657
Chapter 30
Annotate Annotate Annotate Annotate
4 Annotate Dictionary
671 740
669
ix
Annotate Macros 741 Using Annotate Macros 760 Annotate Error Messages 762
PART
Overview 770 Applications of the DATA Step Graphics Interface Using the DATA Step Graphics Interface 774 DSGI Graphics Summary
776
767
769
773
Chapter 32
813
GDRAW Functions 855 GRAPH Functions 866 GSET Functions 871 Return Codes for DSGI Routines and Functions See Also 909 References
910 908
PART
SAS/GRAPH Procedures
Chapter 33
Overview 913 Procedure Syntax Examples
916
911
913
Chapter 34
931
Chapter 35
Overview Concepts
947
Chapter 36
Overview
989
References
1094
Chapter 37
Overview Concepts
1095
Chapter 38
Overview 1126 Concepts 1126 Procedure Syntax 1128 Using the GDEVICE Procedure Examples 1143
1125
Chapter 39
1147
Chapter 40
1165
Chapter 41
Overview
1195
Chapter 42
Overview
1203
Chapter 43
Overview 1230 Concepts 1234 Procedure Syntax 1242 Using FIPS Codes and Province Codes 1279 Using Formats for Map Variables 1281 Using SAS/GRAPH Map Data Sets 1284
1229
xi
Examples
1290
Chapter 44
1309
Chapter 45
Overview Concepts
1315
Chapter 46
Overview
1385
Concepts 1387 Procedure Syntax 1392 Using the GPROJECT Procedure Examples 1399 References 1408
Chapter 47
Overview 1409 Calculating Weighted Statistics Procedure Syntax 1411 Examples 1425
1409
Chapter 48
1437
Chapter 49
1449
Chapter 50
Overview 1466 Concepts 1467 Procedure Syntax 1469 Using the GREPLAY Procedure Windows 1492 Running the GREPLAY Procedure Using Code-based Statements
1465
1496
xii
Replaying Catalog Entries 1497 Creating Custom Templates 1498 Replaying Graphics Output in a Template Creating Color Maps 1499 Examples 1500
1498
Chapter 51
1509
Chapter 52
1519
Chapter 53
Overview 1533 Concepts 1535 Procedure Syntax Examples 1552 References 1561
1533
Chapter 54
Overview 1563 Concepts 1565 Procedure Syntax Examples 1573 References 1582
1563
Chapter 55
1585
PART
Appendixes
Appendix 1
Introduction 1594 Global Statements 1594 PROC GAREABAR 1604 PROC GBARLINE 1605 PROC GCHART 1607 PROC GCONTOUR 1612 PROC GMAP 1614 PROC GPLOT 1617
1591
1593
xiii
PROC GRADAR 1622 PROC GTILE 1625 PROC G3D 1625 Annotate Functions 1627
Appendix 2
Introduction 1635 Rendering Bitstream Fonts 1635 Listing or Displaying SAS/GRAPH Fonts on Your System SAS/GRAPH Font Lists 1636 The SIMULATE Font 1644 Font Locations And the Default Search Path 1645
1635
1636
Appendix 3
Introduction 1647 Default Device-Resident Fonts 1647 Specifying the Full Font Name 1649 Specifying Alternative Device-Resident Fonts
1647
1649
Appendix 4
About Transporting and Converting Graphics Output 1651 Transporting Catalogs across Operating Environments 1651 Converting Catalogs to a Different Version of SAS 1654
1651
Appendix 5
Overview 1655 H2: One Box Left and One Box Right 1655 H2S: One Box Left and One Box Right with Space 1656 H3: Three Boxes Across 1656 H3S: Three Boxes Across with Space 1657 H4: Four Boxes Across 1657 H4S: Four Boxes Across with Space 1658 L1R2: One Box Left and Two Boxes Right 1658 L1R2S: One Box Left and Two Boxes Right with Space 1659 L2R1: Two Boxes Left and One Box Right 1659 L2R1S: Two Boxes Left and One Box Right with Space 1660 L2R2: Two Boxes Left and Two Boxes Right 1660 L2R2S: Two Boxes Left and Two Boxes Right with Space 1661 U1D2: One Box Up and Two Boxes Down 1662 U1D2S: One Box Up and One Box Down with Space 1662 U2D1: Two Boxes Up and One Box Down 1663 U2D1S: Two Boxes Up and One Box Down with Space 1663 V2: One Box Up and One Box Down 1664 V2S: One Box Up and One Box Down with Space 1664 V3: Three Boxes Vertically 1664 V3S: Three Boxes Vertically with Space 1665
xiv
1665
Appendix 6
Recommended Reading
4 Recommended Reading
1667
1667
Glossary Index
1669 1683
xv
Whats New
Overview
The changes and enhancements for SAS/GRAPH 9.2 are very extensive. Highlights include the following: 3 The new SAS/GRAPH statistical graphics suite provides a new set of procedures, a new language, and a graph editor specically designed for creating and editing statistical graphics. 3 All SAS/GRAPH procedures now support ODS styles for all devices. 3 SAS/GRAPH now automatically selects an appropriate device and style for all open destinations. 3 SAS/GRAPH now provides TrueColor support, which allows over 16 million colors in a single image. 3 The new Network Visualization Workshop enables you to visualize and investigate the patterns and relationships hidden in network data (node-link data). 3 The new GKPI procedure generates several key performance indicators. 3 The new GTILE procedure generates tile charts. 3 The new GEOCODE procedure enables you to add geographic coordinates to data sets that contain location information such as mailing addresses or to perform geolocation with non-address location data. 3 The new GINSIDE procedure determines which polygon in a map data set contains the geographic coordinates in your input data set. 3 All procedures now support graphics output lenames up to 256 characters long. 3 Many procedures have signicant enhancements and new options. See Procedures on page xix for a complete list. 3 The new Scalable Vector Graphics devices enable you to generate SVG output. 3 Several new map data sets, as well as new feature data sets, have been added to the MAPS library. Several existing map data sets have been updated.
xvi
Whats New
software products, including SAS/STAT, SAS/ETS, SAS/QC, and SAS/GRAPH. Many statistical procedures have been enabled to use this functionality, and these procedures now produce graphs as automatically as they produce tables. In addition, the new statistical graphics (SG) family of SAS/GRAPH procedures use this functionality to produce plots for exploratory data analysis and customized statistical displays. ODS Graphics includes the new SAS/GRAPH statistical graphics suite. This suite provides the following new features: SAS/GRAPH statistical graphics procedures provide a simple syntax for creating graphics commonly used in exploratory data analysis and for creating customized statistical displays. These new procedures include the SGPANEL, SGPLOT, and SGSCATTER procedures. In addition, the SGRENDER procedure provides a SAS procedure interface to the new Graph Template Language. For more information, including changes and enhancements for SAS 9.2 Phase 2, see SAS/GRAPH: Statistical Graphics Procedures Guide. Graph Template Language (GTL) is the underlying language for the default templates that are provided by SAS for procedures that use ODS Statistical Graphics. You can use the GTL either to modify these templates or to create your own highly customized graphs. Templates written with the GTL are built with the TEMPLATE procedure. For more information about Graph Template Language, see the SAS/GRAPH: Graph Template Language Reference and the SAS/GRAPH: Graph Template Language Users Guide. ODS Graphics Editor is an interactive editor that enables you to edit and enhance graphs that are produced by procedures that use ODS Statistical Graphics. You can use the ODS Graphics Editor to modify the existing elements of a graph such as titles and labels, or to add features such as text annotation for data points. For more information, including changes and enhancements for SAS 9.2 Phase 2, see SAS/GRAPH: ODS Graphics Editor Users Guide. ODS Graphics Designer provides a point-and-click interface for creating ODS graphics. Using the ODS Graphics Designer does not require knowledge of ODS templates or the Graph Template Language. With the ODS Graphics Designer, you can easily create multi-cell graphs, classication panels, scatter plot matrices, and more. You can save your output as an image le or as an ODS Graphics Designer le (SGD le) that you can edit later. For more information, see the SAS Help and Documentation. Select SAS Products I SAS/GRAPH I SAS/GRAPH Windows I ODS Graphics Designer. Note: The ODS Graphics Designer is available with SAS 9.2 Phase 2.
Note: For additional information on the ODS Statistical Graphics functionality, see SAS Output Delivery System: Users Guide and SAS/STAT Users Guide. 4
enables you to extract information that would otherwise remain hidden. Help is available from the menu within the product. To start NV Workshop, select Start I Programs I SAS I SAS GRAPH NV Workshop 2.1. For more information, including changes and enhancements for SAS 9.2 Phase 2, see SAS/GRAPH: Network Visualization Workshop Users Guide.
Devices
3 The new Scalable Vector Graphics devices enable you to create SVG graphs. The
SVG devices (SVG, SVGZ, SVGView, and SVGT) are supported for the LISTING, HTML, and PRINTER destinations.
3 The default device for the ODS HTML destination has changed from GIF to PNG,
which provides TrueColor support. Using the PNG device might result in graphs that have spacing or size differences, such as slightly narrower bars in bar charts.
3 Data tips are now supported by the JAVAIMG device. 3 Several devices have been added for compatibility with previous releases of
SAS/GRAPH. These devices are named Zdevice, where device is the name of the device in previous releases.
3 Several Universal Printing shortcut devices have been added. The UPCL5,
UPCL5E and UPCL5C devices have been added for printing support. The UPDF and UPDFC devices have been added for PDF support. The UPSL and UPSLC devices have been added for PostScript support. See also Using Universal Printer Shortcut Devices on page 75.
Colors
3 SAS/GRAPH now provides TrueColor support, which allows over 16 million colors
in a single image.
3 The number of colors in the default color list has been increased to 38.
3 Fonts are now rendered using the FreeType engine. This new font rendering
might result in fonts appearing larger than they did in previous versions of SAS/GRAPH. See also Changing the Appearance of Output to Match That of Earlier SAS Releases on page xix.
3 Many new TrueType fonts have been added. These new fonts are listed in Table
0.1 on page xviii.
* Albany AMT, Cumberland AMT, Thorndale AMT, Arial Symbol, and Times New Roman Symbol are font families. Normal, bold, italic, and bold italic versions of these fonts are provided.
Procedures
Support for Long Filenames
The NAME= option for each procedure has been enhanced to allow you to specify lenames up to 256 characters long for graphics output les (PNG les, GIF les, and so on). See the documentation for the specic SAS/GRAPH procedures for more information.
GAREABAR Procedure
The GAREABAR procedure has the following new options and enhancements: 3 The GAREABAR procedure now supports the BY and LEGEND statements.
3 The CONTINUOUS option enables you to display a range of numeric values along
the width axis. 3 The DESCRIPTION= option species the description of the catalog entry for the plot. 3 The LEGEND= option assigns the specied LEGEND denition to the legend generated by the SUBGROUP= option. 3 The NOLEGEND option suppresses the legend automatically generated by the SUBGROUP= option.
GBARLINE Procedure
The GBARLINE procedure has the following new options and enhancements:
3 The PLOT statement supports the creation of multiple plot lines on a single bar
chart.
xx
Whats New
3 The SUBGROUP= option divides the bar into segments according to the values of
the SUBGROUP variable values.
3 The HTML= option on the PLOT statement supports data tips and drill-down
links on the markers of the line plot.
3 The HTML_LEGEND= option supports data tips and drill-down legend links. 3 The IMAGEMAP= option enables you to generate an image map with drill-down
functionality in an HTML le. 3 The LEGEND= option enables you to generate both BAR and PLOT legends. 3 The LEVELS=ALL option has been enhanced to display any number of midpoints.
3 The ASCENDING and DESCENDING options now join plot points from
left-to-right by default when the bars are reordered.
3 The PLOT statement now supports several options for references lines on the plot
(right) response axis. 3 The AUTOREF option draws a reference line at each major tick mark. 3 The REF= option draws reference lines at the specied positions. 3 The CREF=, LREF=, and WREF= options enable you to specify the color, line style, and width of user-dened reference lines. 3 The CAUTOREF=, LAUTOREF=, and WAUTOREF= options enable you to specify the color, line style, and width of AUTOREF lines.
3 The WREF= and WAUTOREF= options on the BAR statement enable you to
specify the width of reference lines on the bar (left) response axis. 3 The PLOT statement now supports the following options: CAXIS= CTEXT= NOAXIS species a color for the tick marks and the axis area frame species a color for all text on the plot response axis and legend suppresses the right PLOT response axis
GCHART Procedure
The GCHART procedure has the following new options and enhancements: 3 The COUTLINE= option has been enhanced to include outlines on cylinder-shaped bars. 3 The GAXIS= option is now supported by the ACTIVEX, ACTXIMG, JAVA, and JAVAIMG devices. 3 The MAXIS= option is now supported by the ACTIVEX, ACTXIMG, JAVA, and JAVAIMG devices. 3 The NOPLANE option enables you to remove walls from threedimensional bar charts. 3 The PCTSUM option in the HBAR statement displays a column of percentages for the sum variable values. 3 The new PCTSUMLABEL= option enables you to specify the text for the column label for the PCTSUM statistic in the table of statistics. 3 The PLABEL= option enables you to specify the font, height, and color of pie slice labels. 3 The NOZERO option on the BAR statement is now supported by the JAVA and JAVAIMG devices.
3 The RADIUS= option on the PIE statement enables you to specify the radius of
the pie chart.
3 The RAXIS= option is now supported by the ACTIVEX, ACTXIMG, JAVA, and
JAVAIMG devices. 3 The SHAPE= option on BLOCK statement is now supported by the ACTIVEX, ACTXIMG, JAVA, and JAVAIMG devices. 3 The WREF= and WAUTOREF= options enable you to specify the width of reference lines. 3 The pie and bar name variable now support up to 256 characters.
GCONTOUR Procedure
The GCONTOUR procedure has the following changes and enhancements. 3 When used with the Java and ActiveX devices, the LJOIN option displays lled contour areas with separated by contour lines. 3 When used with the Java and ActiveX devices, the SMOOTH option produces smooth gradient areas between levels. 3 The WAUTOHREF= and WAUTOVREF= options specify the line width for reference lines generated with the AUTOHREF and AUTOVREF options, respectively. 3 The WHREF= and WVREF= options specify the line width for reference lines generated with the HREF= and VREF= options, respectively.
GEOCODE Procedure
The new GEOCODE procedure enables you to add geographic coordinates (latitude and longitude) to data sets that contain location information such as mailing addresses. You can also perform geolocation, which is adding geographic coordinates to non-address locations such as sale territories. For SAS 9.2 Phase 2 and later, the new RANGE geocoding method enables you to perform geolocation for IP addresses.
GINSIDE Procedure
The new GINSIDE procedure determines which polygon in a map data set contains the X and Y coordinates in your input data set. For example, if your input data set contains coordinates within Canada, you can use the GINSIDE procedure to identify the province for each data point.
GKPI Procedure
The new GKPI procedure generates key performance indicators, including sliders, bullet graphs, speedometers, dials, and trafc lights. This GKPI procedure is supported by the JAVAIMG device only.
GMAP Procedure
The GMAP procedure has the following new features: 3 The AREA statement enables you to control the appearance of regions in block maps and prism maps. 3 The CDEFAULT= option species the color for empty map areas.
3 The DENSITY= option enables you to reduce the number of map points that are
drawn.
3 The RELZERO= option species that the heights of bars and regions are relative
to zero, rather than the minimum value.
3 The STATISTIC= option species a statistic to use for the response variable. 3 The STRETCH option stretches the extents of a map to ll the output device. 3 The UNIFORM option species that each map that is created when you use the
BY statement uses the same colors and legend.
GPLOT Procedure
The GPLOT procedure has the following new options and enhancements:
3 The BFILL= option enables you to generate gradient, solid-lled bubble plots. 3 The FRONTREF= option species that reference lines are drawn in front of lled
areas.
3 The OVERLAY option is no longer required to display a legend when the PLOT (or
PLOT2 )statement species only one plot.
3 The WAUTOHREF= and WAUTOVREF= options specify the line width for
reference lines generated with the AUTOHREF and AUTOVREF options, respectively.
3 The WHREF= and WVREF= options specify the line width for reference lines
generated with the HREF= and VREF= options, respectively.
3 Enhanced features in box plots enable you to click on the interior of the boxes for
simple drill-down functionality. Previously, you could click only on visible box elements. Now, you can click anywhere inside the box to drill down to more detailed data.
GPROJECT Procedure
The NODATELINE option enables contiguous projections when projecting maps that cross the line between 180 degrees and 180 degrees longitude. The following options for the GPROJECT procedure have been renamed:
Old Name DEGREE PARALEL1 PARALEL2 New Name DEGREES PARALLEL1 PARALLEL2
GRADAR Procedure
The GRADAR procedure has the following new options and enhancements:
Whats New
xxiii
3 The NLEVELS= option species the number of colors to use in calendar charts. 3 The NOLEGEND option turns off the automatically generated legend. 3 The SPOKESCALE= option species whether every spoke is drawn to the same
scale or each spoke is drawn to a different scale. 3 The WINDROSE option produces a windrose chart, which is a type of histogram.
3 The FREQ= option now supports only non-zero integers. Zero and negative values
are dropped. Decimal values are truncated to integers.
3 The WEIGHT= option is no longer supported. 3 The GRADAR procedure now draws missing overlay values to the center.
Previously, missing values were drawn to zero.
GREMOVE Procedure
The GREMOVE procedure has the following new options:
3 The FUZZ= option species an error tolerance for the point matching algorithm. 3 The NODECYCLE option enables some types of polygons to be closed properly.
GTILE Procedure
The new GTILE procedure enables you to create and display tile charts using the Java or ActiveX device drivers. Tile charts are designed for visualizing a large quantity of hierarchical-type data and are sometimes referred to as rectangular tree maps. Tile charts display rectangles of varying sizes and colors based on the magnitude of the variables specied and provides drill-down links to more detailed data.
MAPIMPORT Procedure
The ID statement for the MAPIMPORT procedure enables you to group related polygons.
Global Statements
3 The REPEAT= option on the LEGEND statement enables you to specify the
number of times a plot symbol is displayed in a single legend item in the legend.
3 The TICK= suboption on the VALUE= option of the LEGEND statement is now
supported by the Java Map Applet.
3 The ROWMAJOR and COLMAJOR options on the LEGEND statement enable you
to control whether legend entries are listed by row or by column.
xxiv
Whats New
Graphics Options
3 The ACCESSIBLE graphics option generates descriptive text and the summary
statistics that are represented by the graph. This option is valid for the Java and ActiveX devices only. 3 The ALTDESC option enables you to specify whether the text specied in the DESCRIPTION= option is used as the data tip text. 3 The TRANSPARENCY option is supported by the ACTIVEX and ACTXIMG devices when the output is used in a PowerPoint presentation.
Transparent Overlays
Transparent overlays from GIF les are now supported in SAS/GRAPH output. You can use transparent GIFs with the IMAGE function in the Annotate facility and with the IBACK and IFRAME graphics options.
ActiveX Control
The following are enhancements for the ActiveX Control:
3 The ActiveX control now displays calendar and windrose charts generated by the
GRADAR procedure. 3 The control also displays tile charts created by the new GTILE procedure. 3 Support for UNICODE fonts has been added.
3 A new eld in the user interface enables you to provide interactive graphs in
Microsoft Powerpoint slideshows.
3 The user interface now enables you to specify the properties of scroll bars in your
graph. 3 Data tips are supported for scatter plots generated with the GCONTOUR procedure. 3 Enhanced support of the Annotate Facility listed under The Annotate Facility on page xxv.
Whats New
xxv
more detailed data. You can generate the applet with the GTILE procedure and the JAVA device.
3 The ANGLE, CBORDER, CBOX, LINE, and ROTATE variables are now supported
by the ACTIVEX and ACTXIMG devices.
3 The ARROW function and %ARROW macro enable you to draw arrows. 3 A new value for the HSYS= option, D, species points as the unit of measurement
for font sizes.
3 The IMAGE function is now supported by the JAVA and JAVAIMG devices. 3 The WIDTH variable for the PIE function species the thickness of the outline
around the pie slice.
xxvi
Whats New
Changes updated with new districts and states. The following new variables have been added:
3 3 3 3
The IDNAME variable contains the values that were previously in IDNAME2. The IDNAME2 variable has been removed. INDIA, INDIA2 updated with new states and new ID numbers. The new OLDID variable in the INDIA2 data set contains the old ID numbers. Additionally, the IDNAME2 variable in the INDIA2 data set contains alternate spellings for the state names. The INDIA data set contains a new DENSITY variable. Because the ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets. ITALY, ITALY2 updated with new provinces and ID numbers. The new OLDID variable in the ITALY2 data set contains the old ID numbers. The ITALY data set contains new DENSITY, NUTS, and REGNAME2 variables. Because the ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets. JAOSAKA, JAOSAKA2 JATOKYO, JATOKYO2 LUXEMBOU, LUXEMBO2 updated with new ID values. The new TYPE variable in JAOSAKA2 contains feature types. updated with new ID values. The new TYPE variable in JATOKYO2 contains feature types. updated with more detail and new variables. The LUXEMBOU data set has a new DENSITY variable. The LUXEMBO2 data set has the following new variables:
3 3 3 3
Data Set(s) NAMES (feature table for the WORLD data set)
Changes contains three new variables: ID2 for territories, species the ID values for the countries that the territory is associated with. For example, Greenland has an ID2 value of 315 because it is a territory of Denmark. If a territory is claimed by more than one country, its ID2 value might consist of several threedigit ID values to identify each country. _REGION_ species a geographic region for each country or territory. For example, Panama belongs to the Central America region. TERRITORY for territories, describes the association between the territory and the country or countries that are identied by ID2. For example, Togo is described as Overseas territory of France.
PHILIPPI, PHILIPP2
updated with more detail and new variables. The PHILIPPI data set has a new DENSITY variable. The PHILIPP2 data set has the following new variables:
3 3 3 3 3 3 3 3 3
The ID numbers for these data sets have changed. You might need to change your response data in any existing SAS programs that use these data sets. POLAND, POLAND2 updated with new values and variables. The POLAND data set has a new DENSITY variable. The POLAND2 data set has new PROVNAME and PROVNAME2 variables. renamed to OCEANIA. updated with values and new variables. The SPAIN data set contains a new DENSITY variable. The new OLDID variable in the SPAIN2 data set contains the old ID numbers. The new REGION and REGNAME variables identify regions. The new IDNAME2 and REGNAME2 variables contain alternate spellings for the province and region names. Because the ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets.
Changes updated with new provinces and ID numbers. The SWEDEN data set contains a new DENSITY variable. The new OLDID variable in the SWEDEN2 data set contains the old ID numbers. The new REGNAME variable contains region names. Because the ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets.
SWITZERL, SWITZER2
updated with new province names and ID numbers, and new variables. The new OLDID and OLDNAME variables in the SWITZER2 data set contains the old names and ID numbers. The SWITZERL data set contains new DENSITY and LAKE variables. Because the province names and ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets.
THAILAND, THAILAN2
updated with more detail and new variables. The THAILAND data set has a new DENSITY variable. The THAILAN2 data set has the following new variables:
3 3 3 3
The provinces have new ID numbers. The new OLDID variable in the THAILAN2 data set contains the old ID numbers. Because the ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets. UKRAINE, UKRAINE2 updated with more detail and new variables. The UKRAINE data set has a new DENSITY variable. The UKRAINE2 data set has the following new variables:
3 3 3
The provinces have new names and ID numbers. The new OLDIDNAME and OLDID variables in the UKRAINE2 data set contain the old province names and ID numbers. Because the province names and ID numbers have changed, you might need to change your response data in any existing SAS programs that use these data sets.
Changes Puerto Rico added as state 72. The new STATECODE variable in the US and USCITY data sets contains two-letter state abbreviations. The USCITY data set has new cities, and some city names have been standardized. The PLACE variable now includes the state FIPS code as the rst two digits.
Note: The projected X and Y values might be different due to the need to re-project the data sets with the addition of more cities in USCITY. 4
VIETNAM, VIETNAM2 updated with more detail and new variables. The VIETNAM data set has a new DENSITY variable. The VIETNAM2 data set has the following new variables:
3 3 3
The ID numbers for these data sets have changed. You might need to change your response data in any existing SAS programs that use these data sets.
xxx
Whats New
Changes simplied to use fewer observations. In addition, the following changes have been made:
3 3 3 3 3 3 3 3 3 3 3 3
YUGOSLA, YUGOSLA2
The values are now projected using the CYLINDRI algorithm. Continent 96 has been renamed from South Pacic to Oceania. Antarctica has been added as continent 97. Brunei, Indonesia, and the Philippines have been reassigned from continent 96 to continent 95. French Southern Territories and Heard & McDonald Islands have been reassigned from continent 96 to continent 97. St. Helena has been reassigned from continent 91 to continent 94. The former country of Yugoslavia has been split into Serbia and Montenegro. Newfoundland has been added to Canada (ID 260). Tasmania has been added to Australia (ID 160). More data points are included for Cuba (ID 300). The Galapagos Islands have been added to Ecuador (ID 325). Hong Kong is now included as part of China.
3 Information about the META2HTM macro has been removed. To generate the
Metaview applet, use the JAVAMETA device.
P A R T
1
3 31
SAS/GRAPH Concepts
Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter
1. . . . . . . . . . Introduction to SAS/GRAPH Software 2 . . . . . . . . . . Elements of a SAS/GRAPH Program 3 . . . . . . . . . . Getting Started With SAS/GRAPH 4 . . . . . . . . . . SAS/GRAPH Processing
53 59
39
8 . . . . . . . . . . Exporting Your Graphs to Microsoft Ofce Products 9 . . . . . . . . . . Writing Your Graphs to a PDF File
121 131
111
10. . . . . . . . .Controlling The Appearance of Your Graphs 11. . . . . . . . .Specifying Fonts in SAS/GRAPH Programs 12. . . . . . . . .SAS/GRAPH Colors and Images
165 189
153
329
CHAPTER
1
Introduction to SAS/GRAPH Software
Overview 4 Components of SAS/GRAPH Software 4 Device-Based Graphics and Template-Based Graphics 6 Graph Types 6 Charts 7 Block charts 7 Horizontal bar charts 7 Vertical bar charts 8 Pie charts, Detailed pie charts, 3D pie charts, and Donut charts Star charts 9 Bar-line Charts 10 Area Bar Charts 10 Tile Charts 11 Radar Charts 12 Two-Dimensional Plots 12 Two-dimensional scatter plots 12 Simple line plots 13 Regression plots 13 High-low plots 14 Bubble plots 15 Three-Dimensional Plots 15 Surface plots 15 Scatter plots 16 Contour plots 16 Maps 17 Block maps 17 Choropleth maps 18 Prism maps 18 Surface maps 19 KPI Charts 20 Creating Text Slide and Presentation Graphics 20 Text Slides 20 Combining Output into One Slide 21 Enhancing Graphics Output (graphs and text slides) 22 SAS/GRAPH Statements 22 The Annotate Facility 22 Creating Custom Graphics 22 The DATA Step Graphics Interface 22 Graph-N-Go 23 About this Document 23 Audience 23
Overview
Chapter 1
Prerequisites 23 Conventions Used in This Document 24 Syntax Conventions 24 Conventions for Examples and Output Information You Should Know 27 Support Personnel 27 Sample Programs 27 Map Data Sets 29 Annotate Macros Data Set 29
26
Overview
SAS/GRAPH is the data visualization and presentation (graphics) component of the SAS System. As such, SAS/GRAPH: 3 organizes the presentation of your data and visually represents the relationship between data values as two- and three-dimensional graphs, including charts, plots, and maps. 3 enhances the appearance of your output by allowing you to select text fonts, colors, patterns, and line styles, and control the size and position of many graphics elements. 3 creates presentation graphics. SAS/GRAPH can create text slides, display several graphs at one time, combine graphs and text in one display, and create automated presentations. 3 generates a variety of graphics output that you can display on your screen or in a Web browser, store in catalogs, review, or send to a hard copy graphics output device such as a laser printer, plotter, or slide camera.
many device-based SAS/GRAPH procedures, including GCHART, GPLOT, GMAP, GBARLINE, GCONTOUR, and G3D, as well as others. For more information, see Chapter 29, Using Annotate Data Sets, on page 643. Network Visualization (NV) Workshop enables you to visualize and investigate the patterns and relationships hidden in network data (node-link data). Some common applications that use network data include supply chains, communication networks, Web sites, database schema, and software module dependencies. NV Workshop is designed for visualizing large networks. Using a combination of data tables, statistical graphs, and network graphs, NV Workshop enables you to extract information that would otherwise remain hidden. Help is available from the menu within the product. To start NV Workshop, select Start I Programs I SAS I SAS GRAPH NV Workshop 2.1. For additional information, see SAS/GRAPH: Network Visualization Workshop Users Guide. SAS/GRAPH statistical graphics suite is part of ODS Statistical Graphics (referred to as ODS Graphics for short). ODS Graphics is functionality for creating statistical graphics that is available in a number of SAS software products, including SAS/STAT, SAS/ETS, SAS/QC, and SAS/GRAPH. The SAS/GRAPH statistical graphics suite provides the following features: SAS/GRAPH statistical graphics procedures provide a simple syntax for creating graphics commonly used in exploratory data analysis and for creating customized statistical displays. These procedures include the SGPANEL, SGPLOT, and SGSCATTER procedures. In addition, the SGRENDER procedure provides a SAS procedure interface to create graphs using the Graph Template Language. These procedures are template-based procedures; they do not use devices like the device-based SAS/GRAPH procedures. For more information, see Device-Based Graphics and Template-Based Graphics on page 6 and SAS/GRAPH: Statistical Graphics Procedures Guide. Graph Template Language (GTL) is the underlying language for the default templates that are provided by SAS for procedures that use ODS Statistical Graphics. You can use the GTL either to modify these templates or to create your own customized graphs. Templates written with the GTL are built with the TEMPLATE procedure. For more information about Graph Template Language, see SAS/GRAPH: Graph Template Language Users Guide and SAS/GRAPH: Graph Template Language Reference. ODS Graphics Editor is an interactive editor that enables you to edit and enhance graphs that are produced by procedures that use ODS Graphics. You can use the ODS Graphics Editor to modify the existing elements of a graph such as titles and labels, or to add features such as text annotation for data points. For more information, see SAS/GRAPH: ODS Graphics Editor Users Guide. ODS Graphics Designer provides a point-and-click interface for creating ODS Graphics. Using the ODS Graphics Designer does not require knowledge of ODS templates or the Graph Template Language. With the ODS Graphics Designer, you can easily create multi-cell graphs, classication panels, scatter plot matrices, and more. You can save your output as an image le or as an ODS Graphics Designer le (SGD le) that you can edit later. For more information, see the
Chapter 1
SAS Help and Documentation. Select SAS Products I SAS/GRAPH I SAS/ I ODS Graphics Designer. For additional information on the ODS Statistical Graphics functionality, see SAS Output Delivery System: Users Guide and SAS/STAT Users Guide.
GRAPH Windows
Graph Types
SAS/GRAPH produces many kinds of charts, plots, and maps in both two- and three-dimensional versions. In addition to helping you understand the variety of graphs that are available to you, these descriptions also help you choose the correct type of graph for your data and point you to the appropriate chapter.
Charts
Charts
SAS/GRAPH uses the GCHART procedure to produce charts that graphically represent the value of a statistic for one or more variables in a SAS data set. See Chapter 36, The GCHART Procedure, on page 989 for a complete description.
Block charts
Block charts use three-dimensional blocks to graphically represent values of statistics. Block charts are useful for emphasizing relative magnitudes and differences among data values.
Charts
Chapter 1
Pie charts, Detailed pie charts, 3D pie charts, and Donut charts
Pie charts, detailed pie charts, 3-D pie charts, and Donut charts use the angle of pie slices to graphically represent the value of a statistic for a data range. Pie charts are useful for examining how the values of a variable contribute to the whole and for comparing the values of several variables.
Charts
Star charts
Star charts use the length of spines to graphically represent the value of a statistic for a data range. Star charts are useful for analyzing where data are out of balance.
10
Bar-line Charts
Chapter 1
Bar-line Charts
The GBARLINE procedure produces vertical bar charts with plot overlays. These charts graphically represent the value of a statistic calculated for one or more variables in an input SAS data set. The charted variables can be either numeric or character. See Chapter 35, The GBARLINE Procedure, on page 947 for a complete description.
Tile Charts
11
Tile Charts
The GTILE procedure produces charts that tile charts, which consist of a rectangle or square divided into tiles. The sizes of the individual tiles represent the value of the size variable. You can also specify a color variable, so that the colors of the individual tiles represent the magnitude of the color variable. Tile charts are useful for determining the relative magnitude of categories of data or the contribution of a category toward the whole.
12
Radar Charts
Chapter 1
Radar Charts
The GRADAR procedure produces radar charts that show the relative frequency of data measures. On a radar chart, the chart statistics are displayed along spokes that radiate from the center of the chart. The charts are often stacked on top of one another with reference circles, thus giving them the look of a radar screen. Radar charts are frequently called star charts and are often used in quality control or market research problems. See Chapter 47, The GRADAR Procedure, on page 1409 for a complete description.
Two-Dimensional Plots
SAS/GRAPH uses the GPLOT procedure to produce two-dimensional graphs that plot one or more dependent variables against an independent variable within a set of coordinate axes. GPLOT can display the data points as individual symbols (as in a scatter plot), or use interpolation methods specied by the SYMBOL statement to join the points, request spline interpolation or regression analysis, produce various high-low plots, or generate several other types of plots. GPLOT can also display data as bubble plots in which circles of different sizes represent the values of a third variable. Plots are useful for demonstrating the relationship between two or more variables and frequently compare trends or data values or depict movements of data values over time. See Chapter 45, The GPLOT Procedure, on page 1315 for a complete description.
Two-Dimensional Plots
13
Regression plots
Regression plots specify that the plot is a regression analysis. You can specify one of three types of regression equation linear, quadratic, or cubic, and you can choose to display condence limits for mean predicted values or individual predicted values.
14
Two-Dimensional Plots
Chapter 1
High-low plots
High-low plots show how several values of one variable relate to one value of another variable. Typically, each variable value on the horizontal axis has several corresponding values on the vertical axis. High-low plots include box, needle, and stock market plots.
Three-Dimensional Plots
15
Bubble plots
Bubble plots show the relative magnitude of one variable in relation to two other variables. The values of two variables determine the position of the bubble on the plot, and the value of a third variable determines the size of the bubble.
Three-Dimensional Plots
SAS/GRAPH uses the G3D procedure to produce three-dimensional surface and scatter plots that examine the relationship among three variables. Variable values are plotted on a set of three coordinate axes. See Chapter 53, The G3D Procedure, on page 1533 for a complete description.
Surface plots
Surface plots are three-dimensional plots that display the relationship of three variables as a continuous surface. Surface plots examine the three-dimensional shape of data.
16
Three-Dimensional Plots
Chapter 1
Scatter plots
Scatter plots enable you to examine three-dimensional data points instead of surfaces and to classify your data using size, color, shape, or a combination of these features.
Contour plots
SAS/GRAPH uses the GCONTOUR procedure to examine three-dimensional data in two dimensions. Lines or areas in a contour plot represent levels of magnitude (z) corresponding to a position on a plane (x,y). See Chapter 37, The GCONTOUR Procedure, on page 1095 for a complete description. Contour plots are two-dimensional plots that show three-dimensional relationships. These plots use contour lines or patterns to represent levels of magnitude of a contour variable plotted on the horizontal and vertical axes.
Maps
17
When you need to interpolate or smooth data values that are used by the G3D and GCONTOUR procedures, use the G3GRID procedure. The G3GRID procedure does not produce graphics output but processes existing data sets to create data sets that the G3D or GCONTOUR procedure can use to produce three-dimensional surface or contour plots. See Chapter 54, The G3GRID Procedure, on page 1563 for a complete description.
Maps
SAS/GRAPH uses the GMAP procedure to produce two- and three-dimensional maps that can show an area or represent values of response variables for subareas. SAS/GRAPH includes data sets to produce geographic maps. In addition, you can create your own map data sets. See Chapter 43, The GMAP Procedure, on page 1229 for a complete description.
Block maps
Block maps are three-dimensional maps that represent data values as blocks of varying height rising from the middle of the map areas.
18
Maps
Chapter 1
Choropleth maps
Choropleth maps are two-dimensional maps that display data values by lling map areas with combinations of patterns and color that represent the data values.
Prism maps
Prism maps are three-dimensional maps that display data by raising the map areas and lling them with combinations of patterns and colors.
Maps
19
Surface maps
Surface maps are three-dimensional maps that represent data values as spikes of varying heights.
SAS/GRAPH also provides several utility procedures for handling map data. The GPROJECT procedure lets you choose how geographic maps are projected. This is particularly important for large areas because producing a map of any large area on the Earth involves distorting some areas in the process of projecting the spherical surface of the Earth onto a at plane. You can use the procedure to select the projection method that least distorts your map. Map areas are constructed of joined data points. Each data point represents an observation in a SAS data set. For large maps, the amount of data can be prohibitively expensive (in terms of computing resources or time to process); the GREDUCE
20
KPI Charts
Chapter 1
procedure enables you to reduce the number of points in the data set. The GREMOVE procedure enables you to remove boundary lines within a map.
KPI Charts
The GKPI procedure creates graphical key performance indicator (KPI) charts. KPIs are metrics that help a business monitor its performance and measure its progress toward specic goals. The procedure produces ve KPI chart types:
3 slider (vertical or horizontal) 3 bullet graph (vertical or horizontal) 3 radial dial 3 speedometer 3 trafc light (vertical or horizontal).
3 create text slides with the GSLIDE procedure 3 combine several graphs into one output with the GREPLAY procedure 3 automatically or manually replay your graphs and text slides with the GREPLAY
procedure.
Text Slides
Use the GSLIDE procedure to create text slides in which you can specify a variety of colors, fonts, sizes, angles, overlays, and other modications as well as drawing lines and boxes on the output. See Chapter 51, The GSLIDE Procedure, on page 1509 for a complete description. Text slides display text as graphics output. Text slides can be used as title slides for presentations, or to produce certicates, signs, or other display text.
21
In addition, you can use the GREPLAY procedure to create an automated or user-controlled presentation of graphics output. The GREPLAY procedure enables you to name, arrange, and customize the presentation of graphs that are stored in a catalog. See Chapter 50, The GREPLAY Procedure, on page 1465 for a complete description.
22
Chapter 1
SAS/GRAPH Statements
You can also use global statements and graphics options in SAS/GRAPH programs. With global statements, you can add titles and footnotes and control the appearance of axes, symbols, patterns, and legends. With graphics options, you can control the appearance of graphics elements by specifying default colors, ll patterns, fonts, text height, and so on.
Figure 1.4
Annotated graphs
Prerequisites
23
Graph-N-Go
To generate presentation graphs without writing any SAS/GRAPH code, you can use Graph-N-Go (not available on mainframes). You can start Graph-N-Go in several ways:
3 from the menus in any SAS window, select Solutions I Reporting I Graph-N-Go 3 submit either of the following from the SAS command line:
gng graphngo
3 select Help I Using This Window 3 press F1 (this might not work in some operating environments).
You can also get help for the application by submitting the following command from the SAS command line:
help gng
Audience
This document is written for users who are experienced in using the SAS System. You should understand the concepts of programming in the SAS language, and you should have an idea of the tasks you want to perform with SAS/GRAPH.
Prerequisites
The following table summarizes the SAS System concepts that you need to understand in order to use SAS/GRAPH:
To learn how to invoke the SAS System at your site use Base SAS software use the DATA step to create and manipulate SAS data sets use the SAS Text Editor to enter and edit text Refer to instructions provided by the on-site SAS support personnel SAS Language Reference: Concepts or SAS Language Reference: Dictionary
24
Chapter 1
To learn how to allocate SAS libraries and assign librefs create external les and assign lerefs manipulate SAS data sets using SAS procedures
Refer to documentation for using the SAS System under the operating system for the hardware at your site Base SAS Procedures Guide
argument
Syntax Conventions
Type styles have special meanings when used in the presentation of SAS/GRAPH syntax in this document. The following list explains the style conventions for the syntax sections: UPPERCASE identies SAS keywords such as the names of statements and procedures (for example, PROC GCHART). Uppercase characters also identify arguments and values that are literals (for example, NOLEGEND and LABEL=NONE). identies arguments or values that you supply. Items in italic can represent user-supplied values that are either 3 nonliteral values assigned to an argument (for example, axis-color in COLOR=axis-color) 3 nonliteral arguments (for example, VBAR chart-variable. . . ; ). In addition, an item in italics can be the generic name for a list of arguments or parameters from which the user can choose (for example, appearance-options).
italic
Syntax Conventions
25
The following symbols are used to indicate other syntax conventions: < > (angle brackets) | (vertical bar) . . . (ellipsis) identify optional arguments. Any argument not enclosed in angle brackets is required. indicates that you can choose one value from a group. Values separated by bars are mutually exclusive. indicates that the argument following the ellipsis can be repeated any number of times (plot-request <. . . plot-request-n>, for example). If the ellipsis and the following argument are enclosed in angle brackets, they are optional. In SAS/GRAPH, an ellipsis also indicates a range from which a value is selected (LINE=1 . . . 46, for example).
The following examples illustrate the syntax conventions described in this section. These examples contain selected syntax elements, not complete syntax. PROC GANNO ANNOTATE=Annotate-data-set <DATASYS>;
3 The ending semicolon (;) is required because it is outside the angle brackets for the
option.
3 3 3 3
COLOR= is enclosed in angle brackets because it is an optional argument. Symbol-color is in italics because it represents a value that you specify. MODE= is enclosed in angle brackets because it is an optional argument. EXCLUDE and INCLUDE are in uppercase because they are literal values and must be spelled exactly as shown. They are separated by a vertical bar (an OR bar) because you use one or the other but not both. that can be used in the SYMBOL statement.
26
Chapter 1
COLOR=color
COLOR=text-color
3 Font must be a valid SAS font name. (See Chapter 11, Specifying Fonts in SAS/
GRAPH Programs, on page 153 for details.) 3 Color and text-color must be valid SAS/GRAPH colors. (See Chapter 12, SAS/ GRAPH Colors and Images, on page 165 for details.) 3 Chart-variable must be a valid SAS variable name. (See SAS Language Reference: Dictionary for details.)
3 3 3 3
a description of the highlights of the example the program statements that produce the output the actual output from the example an explanation of the features of the example.
The output that is shown for the examples was generated in a Windows operating environment. If you are using a different operating environment, you might need to make some minor adjustments to the example programs. In most cases, the output was sent to the Listing destination and generated using the default style and device for that destination. Exceptions are noted in the text. The dimensions of the graphics output area vary across devices and when using the GRAPH windows. The dimensions can affect aspects of the graphics output for example, the appearance of axes or the position of graphics elements that use explicit coordinates in units other than percent. You might need to adjust the dimensions of your graphics output area or the size of graphics elements to correct any differences you see. Most of the images of output in this document were generated with a GOPTIONS
Sample Programs
27
statement that specied a size approximately equal 5.5 inches by 4.2 inches, although some images might be larger, if necessary, to accommodate the content of the graph.
goptions hsize=5.5inin vsize=4.2in;
These HSIZE= and VSIZE= settings are not shown in the example code and are not necessary for generating the output, but you might want to use similar settings if your output looks different from the output that is shown in the document. Most examples specify these options: RESET=ALL BORDER sets all graphics options to default values and cancels all global statements. draws a border around the graphics output area.
Support Personnel
Most sites have personnel available to help users learn to run SAS System. Record the name of your on-site SAS support personnel. Also, record the names of anyone else you regularly turn to for help with running SAS/GRAPH.
Sample Programs
The documentation for each procedure, for global statements, and for features such as the Annotate facility provide examples that demonstrate these features of SAS/GRAPH. You can copy the example code from the help or the OnlineDoc and paste it into the Program Editor in your SAS session. These same programs are included in the sample library SAS Sample Library. How you access the code in the sample library depends on how it is installed at your site. 3 In most operating environments, you can access the sample code through the SAS Help and Documentation. Select Help I SAS Help and Documentation. On the Contents tab, select Learning to Use SAS I Sample SAS Programs I SAS/ GRAPH I Samples. 3 In other operating environments, the SAS Sample Library might be installed in your le system. If the SAS Sample Library has been installed at your site, ask your on-site SAS support personnel where it is located. To access the sample programs through SAS Help and Documentation or through your le system, you must understand the naming convention used for the samples. The naming convention for SAS/GRAPH samples is Gpcxxxxx, where pc is the product code and xxxxx is an abbreviation of the example title. The product code can be a code for a procedure, a statement, or in the case of Java and ActiveX examples, WB for "web graphs." For example, the code for the rst example in the GMAP procedure chapter, Example 1 on page 1291, is stored in sample member GMPSIMPL. The sample-library member name is sometimes displayed as a footnote in the outputs lower-right corner. 3 In the Help system, the sample programs are organized by product. Within each product category, most of the samples are sorted by procedure. Thus, to access the
28
Sample Programs
Chapter 1
code for the rst example in the GMAP procedure chapter, select Learning to Use SAS I SAS/GRAPH I Samples, scroll to GMAP Procedure, and select GMPSIMPL-Producing a Simple Block Map.
3 In your le system, the les that contain the sample code have lenames that
match the sample member names. For example, in a directory-based system, the code for sample member GMPSIMPL is located in a le named GMPSIMPL.SAS. Note: For Java and ActiveX (web graph) samples, the naming convention is GWBxxxxx. 4
29
Code ON LG NO PN SY TI
30
31
CHAPTER
2
Elements of a SAS/GRAPH Program
Overview 31 A Typical SAS/GRAPH Program 31 SAS/GRAPH PROC Step 32 Procedure Statement 32 Subordinate Statement 32 Other Statements and Options 32 Global Statements 33 Annotate DATA Set 34 DSGI Functions and Routines in a DATA Step ODS Statements 34 Destination Statements 34 ODS Statement Options 35 Base SAS Language Elements 35 FILENAME Statement 36 LIBNAME Statement 36 Other Resources 36
34
Overview
The elements used by SAS/GRAPH programs can include SAS/GRAPH language elements, ODS statements, and Base SAS language elements. The purpose of this chapter is to familiarize you with the overall structure of a typical SAS/GRAPH program, to dene its basic parts, and to show how these parts relate to one another.
32
Chapter 2
Procedure Statement
The procedure statement identies which procedure you are invoking (for example, GCHART, GMAP, or GCONTOUR) and identies which input data set is to be used.
Subordinate Statement
are statements used within the procedure that perform Subordinate statements the work of the procedure. Subordinate statements that generate graphs are called action statements. At least one action statement is required for a procedure to produce a graph. Examples of action statements are the HBAR statement in the GCHART procedure and the BUBBLE statement in the GPLOT procedure. Non-action statements are those that do not generate graphs. The GRID statement in PROC G3GRID and the DELETE statement in PROC GDEVICE are examples of non-action statements.
Global Statements
33
segments according to the values of the SUBGROUP= variable. The HAXIS option in the PLOT statement of the GPLOT procedure, as shown in Display 2.1 on page 32, species where to draw the major tick mark values for the horizontal axis.
Global Statements
A global statement is a statement that you can specify anywhere in a SAS program. Global statements set values and attributes for all the output created from that point in the program when the statement is specied. The specications in a global statement are not conned to the output generated by any one procedure but apply to all the output generated then point on in the program, unless they are overridden by a procedure option or another global statement. The RESET= option in the GOPTIONS statement also overrides global statements by resetting them. Below is a list of all the SAS/GRAPH statements along with a brief description of each. See Chapter 14, SAS/GRAPH Statements, on page 195 for a more detailed description of each of these statements. AXIS modies the appearance, position, and range of values of axes in charts and plots. BY processes data and orders output according to the values of a classication (BY) variable. The BY statement in SAS/GRAPH is essentially the same as the BY statement in Base SAS, but the effect on the output is different when it is used withSAS/GRAPH procedures. When used with SAS/GRAPH procedures, the BY statement subsets the data and creates a graph for each unique value of the BY-variable. Note: The BY statement is an exception here because it is not a global statement. It must be specied within a DATA or PROC step. 4 GOPTIONS species graphics options that control the appearance of graphics elements by specifying characteristics such as default colors, ll patterns, fonts, or text height. Graphics options can also temporarily change device settings. LEGEND modies the appearance and position of legends generated by procedures that produce charts, plots, and maps. PATTERN denes the characteristics of patterns used in graphs created by the GAREABAR, GBARLINE, GCHART, GCONTOUR, GMAP, and GPLOT procedures. SYMBOL denes the characteristics of symbols that display the data plotted by a PLOT statement used by PROC GBARLINE, PROC GCONTOUR, and PROC GPLOT as well the interpolation method for plot data. The SYMBOL statement also controls the appearance of lines in contour plots. TITLE, NOTE, and FOOTNOTE add text to maps, plots, charts, and text slides. They control the content, appearance, and placement of text on your graph. The FOOTNOTE statement is used to display lines of text at the bottom of the page. The TITLE statement is used to specify up to ten title lines to be printed on the title area of the output. The NOTE statement is used to add text to the procedure output area of your graph. Note: The NOTE statement is a local statement. It can be specied only within a PROC step, and it affects the output of that PROC step only. 4
34
Chapter 2
ODS Statements
Destination Statements
Like Base SAS, SAS/GRAPH uses ODS destination statements ( , ) to control where the output goes and how it looks. While ODS statements are not required in every SAS/GRAPH program, they are necessary if you want to generate graphs for destinations other than the default listing destination. Some other destinations include HTML, RTF, and PDF. For more information about ODS destinations, see Understanding ODS Destinations in SAS Output Delivery System: Users Guide.
35
As shown in Display 2.1 on page 32, the ODS destination statement is used at the beginning and end of the program to open and close the destination, respectively. If you do chose to use a destination other than the default and need to use the ODS destination statement, you should always open the destination before calling the procedure. To conserve system resources, you should also use the ODS destination statement to close the LISTING destination if you do not need LISTING output.
36
Other Resources
Chapter 2
FILENAME Statement
The FILENAME statement associates a SAS leref with an external text le or output device. With SAS/GRAPH software, you can use a FILENAME statement to to the following tasks:
3 point to a text le that you want to use for data input or output. 3 assign the destination of a graphics stream le (GSF). This destination can be
either a single, specic le or an aggregate le storage location, such as directory or PDS. See Exporting Your Output on page 110 for information on creating graphics stream les. You can also use the FILENAME statement to route input to and from other devices. For details, see the SAS documentation for your operating environment. A FILENAME statement that points to an external le has this general form: FILENAME leref external-le; leref is any SAS name. external-le is the physical name of the external le or aggregate le storage location you want to reference. For details on specifying the physical names of external les, see the SAS documentation for your operating environment.
LIBNAME Statement
The LIBNAME statement associates a libref with a SAS library. A SAS library can be either temporary or permanent. Typically, SAS libraries used with SAS/GRAPH software contain the following items:
3 SAS les for data input and output. 3 SAS catalogs that contain SAS/GIS maps, fonts, GRSEG, CMAP, TEMPLATE, or
device entries.
3 SAS catalogs that contain graphics output. These catalogs are often stored in
permanent libraries. See Controlling Where Your Output is Stored on page 97 for information on storing graphics output in a permanent catalog. The LIBNAME statement has this general form: LIBNAME libref SAS-library; libref is any SAS name. SAS-library is the physical name for the SAS library on your host system. For details on specifying SAS-library, see the SAS documentation for your operating environment. The libref WORK is reserved; it always points to an area where temporary data sets and catalogs are kept. The contents of WORK are deleted when you exit a SAS session.
Other Resources
3 For more information on using and managing SAS/GRAPH programs to create
graphics output, see Chapter 3, Getting Started With SAS/GRAPH, on page 39.
Other Resources
37
3 For more information on bringing SAS/GRAPH output to the Web, see Chapter 16,
Introducing SAS/GRAPH Output for the Web, on page 441.
3 For information on using and managing SAS/GRAPH output, see Chapter 7, SAS/
GRAPH Output, on page 87.
38
39
CHAPTER
3
Getting Started With SAS/GRAPH
Introduction 39 Introduction to ODS Destinations and Styles 40 Opening And Closing Destinations 40 The LISTING Destination 41 Introduction to Styles 41 Specifying a Style 42 Generating Output With SAS/GRAPH Procedures 43 Sending Output to the GRAPH Window (LISTING Destination) 43 Sending Output to a File 44 Sending Output to a Web Page 45 Sending Output to an RTF File (Microsoft Word Document) 46 Sending Output to a PDF File 47 Controlling the Graphics Output Format With the DEVICE= Option 48 Overview of Devices and Destinations 48 Specifying the DEVICE= Graphics Option 49 Summary of Default Destinations, Styles, and Devices 49 Sending Output To Multiple Open Destinations 51 Closing Destinations To Save System Resources 51 Specifying Devices And Styles With Multiple Open Destinations 51 Related Topics 52
Introduction
Like other SAS procedures, the output from SAS/GRAPH procedures is controlled by ODS (Output Delivery System). ODS controls where your output is sent, which could be to a le, to the GRAPH window, directly to a printer, and so on. By default, ODS also applies a style to your output. Styles set the overall appearance of your output; that is, the colors and fonts that are used. SAS/GRAPH uses device drivers to generate graphics output. SAS/GRAPH device drivers control the format of your graphics. For example, they determine whether SAS/GRAPH produces a PNG le, an SVG le, or an ActiveX control. Note: This document deals only with device-based graphics. See Device-Based Graphics and Template-Based Graphics on page 6. 4 Each ODS destination is associated with a default style and a default graphics device to optimize your output for that destination. However, using ODS statements and SAS/GRAPH statements and options, you can customize all of the aspects of your output, including where your output is sent, its appearance, and the format of your graphics.
40
Chapter 3
ODS destination
The ODS destination controls where your output is sent, such as to a le or directly, to a printer, and so on. The ODS destination is specied by the ODS destination statement. The ODS style controls the appearance of your output, including colors and fonts. The ODS STYLE= attribute in the ODS destination is specied by the ODS style statement. The SAS/GRAPH device controls the format of your graphics output such as PNG, GIF, SVG , and so on. The SAS/GRAPH DEVICE= option is specied in the GOPTIONS SAS/GRAPH DEVICE= statement
ODS style
SAS/GRAPH device
Note: The LISTING destination is unique. For the LISTING destination, the device controls where your output is sent. 4 The following sections discuss these concepts of SAS output and describe how you can use SAS/GRAPH and ODS statements and options to create the graphic output you want. For complete information on ODS, see also SAS Output Delivery System: Users Guide.
For example, to send output to the HTML destination, you would specify
ods html; /* procedure statements and other program elements here */ ods html close;
For more information on ODS destinations, see Managing ODS Destinations on page 189 and ODS Destination Statement Options on page 190.
Introduction to Styles
41
Introduction to Styles
By default, ODS applies a style to all output. A style is a template, or set of instructions, that determines the colors, font face, font sizes, and other presentation aspects of your output. SAS ships many predened styles in the STYLES item store, such as Analysis, Statistical, and Journal. Examples of some of these predened styles are shown in Table 3.1 on page 42. Many additional styles (see Viewing the List of Styles Provided by SAS on page 139) are available in the STYLES item store in SASHELP.TMPLMST. Each destination has a default style associated with it. For example, the default style for the PDF destination is Printer, and the default style for the HTML destination is Default. See ODS Destinations and Default Styles on page 133 and Recommended Styles on page 134 for more information.
42
Specifying a Style
Chapter 3
Table 3.1 Examples of Styles Available in SASHELP.TMPLMST Display 3.1 Style=Statistical Display 3.2 Style=Analysis
Specifying a Style
To change the style that is applied to your output, specify the STYLE= option on your ODS destination statement. For example, if you want to change the overall look of your
43
graph for the HTML destination to the Analysis style, you would specify style=analysis in the ODS HTML destination statement as follows:
ods html style=analysis;
See About Style Templates on page 133 and Specifying a Style on page 137 for more information. Note: You can turn off the use of styles by default by specifying the NOGSTYLE option. See Changing the Appearance of Output to Match That of Earlier SAS Releases on page 152 and the GSTYLE system option in SAS Language Reference: Dictionary for more information. 4
44
Chapter 3
Display 3.7 LISTING Destination Output Using the Listing Style (Shown in the GRAPH Window)
The default style applied to output sent to the LISTING destination is the Listing style. When you send output to the LISTING destination, SAS/GRAPH uses a default device driver that generates output for the GRAPH window. This device driver does not write an image le to disk.* For the LISTING destination, the default device driver varies by operating environment. In a Display Manager Session (DMS), the default device driver on Windows systems is WIN. On UNIX systems, the default device driver is XCOLOR, and on z/OS systems, the default device driver is IBMPCGX.
* SAS/GRAPH procedures create GRSEG catalog entries when you send output to the LISTING destination, but the GRSEG
le format is an internal le format specic to SAS/GRAPH. It cannot be used as if it was an image le such as a PNG, GIF, or JPEG le.
45
proc gchart data=sashelp.electric (where=(year >= 2000)) ; vbar year / discrete sumvar=Revenue subgroup=Customer; run; quit;
By default, the Listing style is applied to the graph as shown in Display 3.7 on page 44. In the FILENAME statement, the current directory is the default SAS output directory. For more information on sending graphics output to a le, see Controlling Where Your Output is Stored on page 97.
46
Chapter 3
Display 3.8 HTML Destination Output Using the Default Style (Styles.Default)
By default, SAS/GRAPH creates a PNG le that contains the graph and an HTML page that references the PNG le. You can use the BODY= and PATH= options in the ODS HTML statement to specify a specic lename and location for the HTML and PNG les. SAS/GRAPH displays the HTML page in the Results Viewer. You can also view the graph outside of your SAS session by displaying the HTML page in your browser. The default device driver is PNG, and the default style is Default (STYLES.DEFAULT).
4
Display 3.9 RTF Output Using the Rtf Style
47
By default, SAS/GRAPH creates an RTF le with the graph embedded in it and displays this RTF le in the Results Viewer. When you send output to the RTF destination, SAS/GRAPH does not write a separate image le to disk. The default device driver is the SASEMF driver, and the default style is Rtf.
48
Chapter 3
Display 3.10
By default, SAS/GRAPH creates a PDF le and displays this PDF le in the Results Viewer. When you send output to the PDF destination, SAS/GRAPH does not write a separate image le to disk. The default device driver is the SASPRTC device driver, and the default style applied to output sent to the PDF destination is Printer.
49
others. Viewing The List Of All Available Devices on page 71 describes how to display the entire list of devices that are available. Table 3.2 on page 50 lists the default and supported devices for the LISTING, HTML, RTF, and PDF destinations.
Devices that you might specify include PNG, GIF, JPEG, SVG, ACTIVEX, ACTXIMG, JAVA, JAVAIMG, and many others. For all open destinations, SAS/GRAPH attempts to use the device that you specify. If the device that you specify is not valid for an open destination, SAS/GRAPH switches to the default device for that destination. For details, see GOPTIONS Statement on page 219. Summary of Default Destinations, Styles, and Devices on page 49 describes the supported devices for the LISTING, HTML, RTF, and PDF destinations. See also Chapter 6, Using Graphics Devices, on page 67.
50
Chapter 3
Table 3.2 Default Devices and Styles for Commonly Used ODS Destinations
ODS Destination LISTING Default Style Listing Recommended Devices All devices2 except JAVA and ACTIVEX PNG GIF JPEG JAVA JAVAIMG ACTIVEX ACTXIMG SVG JAVAMETA GIFANIM RTF SASEMF Rtf RTF le (with embedded metale) SASEMF PNG JPEG JAVAIMG ACTIVEX ACTXIMG PDF SASPRTC Printer PDF le SASPRTC (color) SASPRTG (gray scale) SASPRTM (monochrome) PRINTER SASPRTC Printer Controlled by the PRINTERPATH= system option (and by the SYSPRINT= system option on Windows)3 SASPRTC (color) SASPRTG (gray scale) SASPRTM (monochrome)
Default Output Graphics output is displayed in the GRAPH window1 HTML and PNG le
HTML
PNG
Default
(Styles.Default)
1 The default devices for the LISTING destination do not write image les to disk. 2 JAVAMETA is supported for the LISTING destination, but its output requires processing with the Metaview applet. 3 In Windows, if the PRINTERPATH= option is not specied, then SAS uses the setting of the SYSPRINT= system option. If neither the SYSPRINT= nor the PRINTERPATH= option has been set, then SAS uses the default Windows printer.
Note: SASHELP.DEVICES also has high resolution versions of the PNG and JPEG devices, PNG300 and JPEG300. These devices are not appropriate choices for the HTML destination. Web browsers cannot display images in high resolution, so high resolution images appear very large. 4
51
3 You should close any open destinations whose output you are not interested in.
Doing so saves system resources.
3 If you specify a device that is not supported for an open destination, SAS/GRAPH
switches to the default device for that destination and prints a warning to the SAS log.
SAS/GRAPH uses the PNG device and the Default style to generate output for the HTML destination, and it uses the SASEMF device and the Rtf style to generate output for the RTF destination. If you specify a different device with the DEVICE= option in the GOPTIONS statement, SAS/GRAPH attempts to use that device to generate output for every open destination. If you want to use a different style for all output, you need to specify that style on each ODS destination statement. For example, to use the ACTIVEX device and the ANALYSIS style for all output sent to both the HTML and RTF destinations, you would specify the GOPTIONS statement and the STYLE= option as follows:
goptions device=activex; ods listing close; ods html style=analysis; ods rtf style=analysis; /* procedure statements and other program elements here */ ods html close; ods rtf close; ods listing;
52
Related Topics
Chapter 3
If you specify a device that is not supported for an open destination, SAS/GRAPH switches to the default device for that destination and prints a warning to the SAS log.
Related Topics
Additional information is available on all of the SAS/GRAPH output concepts that are described in this topic. For more information on generating output with the SAS/ GRAPH procedures, see the following topics:
3 Chapter 7, SAS/GRAPH Output, on page 87 3 Chapter 16, Introducing SAS/GRAPH Output for the Web, on page 441
For more information on the ODS, ODS destinations, and ODS styles, see the following topics:
3 Chapter 13, Managing Your Graphics With ODS, on page 189 3 Chapter 10, Controlling The Appearance of Your Graphs, on page 131
For more information on using the graphics devices, see Chapter 6, Using Graphics Devices, on page 67.
53
CHAPTER
4
SAS/GRAPH Processing
Running SAS/GRAPH Programs 53 SAS Data Sets 54 Specifying an Input Data Set 54 Using a Library Reference 54 Using a File Specication 55 Input Data Set Requirements 55 Automatic Data Set Locking 56 Using Engines with SAS/GRAPH Software 56 RUN-Group Processing 56 RUN-group Processing with global and local statements RUN-group Processing with BY statements 57 RUN-group Processing with the WHERE Statement 57
56
54
Chapter 4
See Chapter 7, SAS/GRAPH Output, on page 87 for more information about SAS/GRAPH output.
If you omit the DATA= option, then the procedure uses the SAS data set that was most recently used or created in the current SAS session. If you do not specify a SAS data set and no data set has been created in the current SAS session, an error occurs and the procedure stops. Most of the procedures that read data sets or create output data sets accept data set options. SAS data set options appear in parentheses after the DATA= option specication, as shown in this example:
proc gplot data=stocks(where=(year=1997));
SAS/GRAPH Processing
55
To specify a permanent data set you typically use a two-level name. A permanent library reference is specied in the form libref.SAS-data-set-name in which libref identies a storage location on your host system. A LIBNAME statement associates a libref with the storage location. See also LIBNAME Statement in SAS Language Reference: Dictionary. For example, these statements specify a permanent data set:
libname reflib my-SAS-library; proc gplot data=reflib.stocks; run;
You can use a one-level name for permanent SAS data sets if you specify a USER data library. In this case, the procedure assumes that data sets with one-level names are in the User library instead of in the WORK data library. You can assign a User library with a LIBNAME statement or the USER= SAS system option. For example, these statements use a single-level name to specify a permanent data set that is stored in the library identied as the User library:
options user=my-SAS-library; proc gplot data=stocks;
For more information on SAS Libraries see SAS Libraries in SAS Language Reference: Concepts.
The quotes are required for a le specication; if omitted, SAS treats the specication as a library reference. In the above example, if the quotes are omitted, SAS creates the data set in the temporary WORK catalog and identies it by the name WORK.MYDATA. To create the le in a location other than the default location, the quoted le specication must include the full path to the desired location. You cannot use quoted le specications for the following items:
3 SAS catalog names 3 MDDB and FDB references 3 the _LAST_= system option
56
Chapter 4
RUN-Group Processing
You can use RUN-group processing with the GAREABAR, GBARLINE, GCHART, GKPI, GMAP, GPLOT, GRADAR, GREPLAY, GSLIDE, and GTILE procedures to produce multiple graphs without restarting the procedure every time. To use RUN-group processing, you start the procedure and then submit multiple RUN-groups. A RUN-group is a group of statements that contains at least one action statement and ends with a RUN statement. The procedure can contain other SAS statements such as AXIS, BY, GOPTIONS, LEGEND, TITLE, or WHERE. As long as you do not terminate the procedure, it remains active and you do not need to resubmit the PROC statement. To end RUN-group processing and terminate the procedure, submit a QUIT or RUN CANCEL statement, or start a new procedure. If you do not submit a QUIT or RUN CANCEL statement, SAS/GRAPH does not terminate RUN-group processing until it reaches another step boundary. Note: When using SAS/GRAPH with the ODS statement, it is best to use a QUIT statement after each procedure that uses RUN-group processing, rather than relying on a new procedure to end the processing. Running too many procedures without an intervening QUIT statement can use up too much memory. Also, note that failing to submit a QUIT statement before submitting an ODS CLOSE statement results in the process memory not being freed at all. 4
SAS/GRAPH Processing
57
title1 "Sales Summary"; plot sales*model_a; run; /* second run group */ plot sales*model_b; run; quit;
3 With the GMAP procedure, the WHERE variable must be in the input data set. 3 With a procedure that is using an Annotate data set, the following requirements
must be met: 3 The ANNOTATE= option must be included in the action statement.
3 The WHERE variable must occur in both the input data set and the Annotate
data set.
58
59
CHAPTER
5
The Graphics Output Environment
Overview 59 The Graphics Output and Device Display Areas 59 Controlling Dimensions 60 Controlling Display Area Size and Image Resolution 61 Units 62 Cells 62 Other Units 64 Maintaining the Quality of Your Image Across Devices 65 Maintaining Proportions 65 Getting the Colors You Want 65 Previewing Your Output 65 How Graphic Elements are Placed in the Graphics Output Area How Errors in Sizing Are Handled 66
65
Overview
The result of most SAS/GRAPH procedures is the graphic display of data in the form of graphics output. Graphics output consists of commands that tell a graphics device how to draw graphic elements. A graphics element is a visual element of graphics outputfor example, a plot line, a bar, a footnote, the outline of a map area, or a border. To generate graphics output, your program uses a device driver that directs the graphics output to a display device (a monitor or terminal), a hard-copy device, or a le. Even though all graphics devices do not understand the same commands, SAS/GRAPH can produce graphics output on many types of graphics devices. Your program controls this process as well as the environment in which the graphics appear. This section describes this graphics environment and how you can modify it and make your programs work for different output devices.
60
Controlling Dimensions
Chapter 5
You can modify some of the characteristics of the graphics output area and the device display area by using graphics options to change the values of the device parameter. This section describes how you can change the dimensions of the output and display areas, how these changes in dimension affect the output, and the types of units you can specify for your output. For a description of the graphics options and device parameters referred to in this section, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
Controlling Dimensions
The outer dimensions of the devices display area are controlled by the values of the XMAX and YMAX device parameters. XMAX sets the maximum horizontal dimension; YMAX sets the maximum vertical dimension. The outer dimensions of the graphics output area are controlled by the values of the HSIZE and VSIZE device parameters. Since the dimensions of the device display area are typically the same as the dimensions of the graphics output area, the default value of HSIZE and VSIZE is 0. However, for hard-copy devices, because the XMAX, YMAX values represent the outer boundaries of the output medium (such as a sheet of paper), these devices might need a margin. Therefore, HSIZE, VSIZE, HORIGIN, and VORIGIN are assigned default values and the default graphics output area is somewhat smaller than the devices display area. Figure 5.1 on page 61 illustrates such a device. Note: The default unit of measurement for the XMAX and YMAX options is inches.
61
VSIZE=8.5in
HORIGIN=0.218in VORIGIN=1.496in
For further discussion of how the default values for HSIZE and HORIGIN are determined using the value of the LEFTMARGIN option, see HSIZE on page 386 and HORIGIN on page 384. Note that HORIGIN and VORIGIN dene the left margin and bottom margin, respectively. The right margin and top margin are calculated by the device driver as follows: right-margin = XMAX (HSIZE + HORIGIN) top-margin = YMAX (VSIZE + VORIGIN) You cannot specify values for right-margin and top-margin. You can change the dimensions of the graphics output area for a SAS session or for a single graph with the HSIZE= and VSIZE= graphics options. Changing the size of the graphics output area does not change the dimensions of the devices display area or affect the resolution. The values of HSIZE= and VSIZE= cannot exceed the maximum dimensions for the device as specied by XMAX and YMAX. Furthermore, you cannot specify values for graphics options HSIZE= and VSIZE= that exceed the HSIZE and VSIZE values for that device.
62
Units
Chapter 5
change either the values of XPIXELS= and YPIXELS=, or the values of XMAX= and YMAX=. SAS/GRAPH automatically calculates the correct value for the unspecied parameters so that the device retains the default resolution. For information on controlling the resolution of your image see Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics on page 96.
Units
Cells
Within the graphics output area, SAS/GRAPH denes an invisible grid of rows and columns. This grid consists of character cells as shown in Figure 5.2 on page 62. The size and shape of these cells affect the size and appearance of your graph since each graphic element is drawn using units of cells. The size and shape of the cells are determined by both the size of the graphics output area and by the number of rows and columns that SAS/GRAPH has dened in the grid. You can control the number of rows by specifying the LROWS device parameter (for a landscape orientation) or the PROWS device parameter (for a portrait orientation). Similarly, the number of columns is controlled by the LCOLS (landscape) or PCOLS (portrait) device parameter. It is not recommended that you change the number of rows and columns in the grid from the default for your device. If you must do so, you can specify the HPOS= and VPOS= graphics options. HPOS= overrides the value of LCOLS or PCOLS and sets the number of columns in the graphics output area. VPOS= overrides the value of LROWS or PROWS and sets the number of rows in the graphics output area. Figure 5.2 on page 62 illustrates how device parameter settings for the size of the output area relate to the parameter settings for the number of character cells in the output area.
Figure 5.2
character cell VPOS=6 (rows in graphics output area; can also be defined by LROWS or PROWS device parameter) HSIZE=8 in (can also be defined by XMAX device parameter) VSIZE=6 in (can also be defined by YMAX device parameter)
Cells
63
Changing only the outer dimensions of the graphics output area (HSIZE= and VSIZE=) retains the cell size but causes SAS/GRAPH to automatically recalculate the number of rows and columns, as illustrated in Figure 5.3 on page 63.
Figure 5.3 Changing HSIZE= and VSIZE= Changes Dimensions and Recalculates the Number of Rows and Columns
HPOS=12 (recalculated)
HPOS=8
VSIZE=9IN (specified)
HSIZE=4IN
HSIZE=6IN (specified)
Changing only the number of rows and columns (HPOS and VPOS) changes the size of the cells without altering the overall size of the output. Figure 5.4 on page 63 shows how increasing the number of rows and columns reduces the size of the individual cells.
HSIZE=4IN
If you use units of CELLS to control the size of the text in your graph while also changing the number of rows and columns, then the size of the text changes. If the cells are large (that is, HPOS= and VPOS= have small values), the text might not t. If the cells are too small, the text might be too small to read. In this case, you can adjust the size of the text with the HEIGHT= statement option or the HTEXT= graphics option. To change all the attributes of the graphics output area, specify values for all four options, as shown in Figure 5.5 on page 64.
64
Other Units
Chapter 5
Figure 5.5 Changing HSIZE=, VSIZE=, HPOS=, and VPOS= Changes Dimensions and the Number and Size of Cells
HPOS=6 (specified)
HPOS=8
VSIZE=7.5IN (specified)
HSIZE=4IN
HSIZE=6IN (specified)
Table 5.1 on page 64 summarizes the interaction of the HSIZE=, VSIZE=, HPOS=, and VPOS= graphics options.
Table 5.1 Interaction of Graphics Options Affecting Cells
Options Specied HSIZE= and VSIZE= Options Not Specied HPOS= and VPOS= (or specify HPOS=0 and VPOS=0) HSIZE= and VSIZE= Result changes the external dimensions of the graphics output area and recalculates the number of rows and columns in order to retain cell size and proportions. keeps the external dimensions but changes the cell size according to the number of rows and columns. changes the dimensions of the graphics output area, the number of rows and columns, and recalculates the cell size.
Other Units
By default, most graphic elements are drawn using units of CELLS to determine their size. For example, the default character height for the TITLE1 denition is two cells; for all other text the default height is one cell. Changing the cell size to control the size of one element, such as text, can distort other parts of your graph. Instead, you might want to change the type of units that SAS/GRAPH uses to control the size of the graphic elements. In addition to CELLS you can use the following units:
3 3 3 3
The percent unit specication is often a good choice because it changes the height of the graphic elements in proportion to the size of the graphics output area. You can specify the unit for individual graphic elements, or you can use the GUNIT= graphics option to set the units for most graphic element heights.
65
Maintaining Proportions
You can use percent of the graphics output area (PCT) as the unit of measure when specifying text size to make sure that text is proportional across devices. For example, a one-inch-high title might be appropriate on a standard piece of paper, but a title of this size uses almost all of the display area of a slide. To make units of percentage the default for size specications, use the GUNIT= graphics option:
goptions gunit=pct;
See GUNIT on page 380 for a complete description of the GUNIT= graphics option.
3 Titles are placed in the title area at the top of the graphics output area. 3 Footnotes are placed in the footnote area at the bottom of the graphics output area. 3 The graph itself uses the procedure output area, which is the area left after the
titles and footnotes have been drawn.
66
Chapter 5
3 Legends use the procedure output area and can affect the amount of space
available for the graph. By default, space is reserved for the legend below the axis area of a graph and above the footnote area. However, you can position the legend in the part of the procedure output area that is reserved for the graph. For details, see LEGEND Statement on page 223. Note: Titles and footnotes can be positioned elsewhere on the graph as well, with different effects on space allocation. See TITLE, FOOTNOTE, and NOTE Statements on page 278 for details. For destinations other than the listing destination, some graphics elements, such as the title and footnote, can appear in the graphics output instead of the procedure output area. 4
Figure 5.6
Note: If the titles, footnotes, and legend are very large, they can make the procedure output area too small for the graph. You can control the size of title and footnote text and of most legend elements with statement options. For details, see Chapter 14, SAS/GRAPH Statements, on page 195 for a description of the appropriate statement. In addition, the section GOPTIONS Statement on page 219 lists the graphics options that control the size of various graphic elements. 4
3 resizes the graphics element and issues a warning explaining what it did 3 issues an error message and does not attempt to produce the graph
For example, it adjusts the size of titles to make them t but it does not drop bars in order to produce a readable bar chart. If you get unexpected results or no graph, check the SAS log for notes, warnings, and errors.
67
CHAPTER
6
Using Graphics Devices
Overview 67 What Is a SAS/GRAPH Device? 68 Commonly Used Devices 68 Default Devices For ODS Destinations 69 Viewing The List Of All Available Devices 71 Deciding Which Device To Use 71 Overriding the Default Device 72 Device Categories And Modifying Default Output Attributes 72 Using Universal Printer Shortcut Devices 75 Using Scalable Vector Graphics Devices 77 What Is an SVG Document? 77 Why Create SVG Documents? 78 The SVG Devices and the Output That They Create 79 Example: Placing Images Behind SVG Documents 79 Example: Generating A Single SVG Document With Multiple Pages and Page Controls Implementing Drill-Down Functionality With the SVG Devices 83 Web Server Content Type for SVG Documents 83 Browsers That Support SVG Documents 83 Controlling Graph Resolution With The SVG Devices 84 Controlling Graph Size With the SVG Devices 84 SAS System Options and SVG Output 84 Viewing and Modifying Device Entries 85 Viewing the Contents of a Device Entry 85 Modifying Device Entry Parameters 85 Creating a Custom Device 86 Related Topics 86
81
Overview
SAS/GRAPH procedures that produce graphics output require a device to create the output. The following topics discuss the role of devices in generating SAS/GRAPH output, provide directions for selecting and specifying them, and explain how you can change the settings of device parameters. Note: SAS/GRAPH produces graphics using two very distinct systems. SAS/GRAPH can produce output using a device-based system or using a template-based system. Template-based graphics (ODS graphics) do not use SAS/GRAPH devices. See Device-Based Graphics and Template-Based Graphics on page 6. 4
68
Chapter 6
When you specify a device, you are specifying the name of a device entry. SAS/GRAPH uses that device entry to determine which device driver to use in order to generate nal output. However, most users do not ever need to deal directly with device drivers, so for simplicity, this document simply refers to devices.
ACTXIMG BMP
69
External Files A CGM le that contains the graph. A CGM le suitable for inserting into Microsoft Word or PowerPoint presentations. An EMF le that contains the graph. A GIF le that contains the graph. This device is used with the ODS HTML destination. It generates a JavaScript that ODS includes in the HTML le. When the HTML le is viewed in a browser, the SAS/GRAPH output is displayed as an interactive Java applet. Display device. This device is available on z/OS hosts only. A PNG le that contains a static graph that is generated with the JAVA device. A JPG le that contains the graph. A PCL le that contains the graph. A PDF le that contains one or more graphs and tables. A PNG le that contains the graph. A PostScript le that contains one or more graphs. A PostScript le that contains the graph in gray scale. An EMF le that contains the graph. This device is the default device for the ODS RTF destination. An SVG le that contains the graph. A TIFF le that contains the graph in color. Display device. This device is available on Windows hosts only. Display device. This device is available on UNIX hosts only.
IBMPCGX JAVAIMG JPEG PCL5 PDF PNG PSCOLOR PSL SASEMF SVG TIFFP WIN XCOLOR
Note: Chapter 16, Introducing SAS/GRAPH Output for the Web, on page 441 describes any requirements or limitations associated with using the ActiveX, Java, and SVG devices. 4
70
Chapter 6
Table 6.2 Default Devices and Styles for Commonly Used ODS Destinations
ODS Destination LISTING Default Style Listing Recommended Devices All devices2 except JAVA and ACTIVEX PNG GIF JPEG JAVA JAVAIMG ACTIVEX ACTXIMG SVG JAVAMETA GIFANIM RTF SASEMF Rtf RTF le (with embedded metale) SASEMF PNG JPEG JAVAIMG ACTIVEX ACTXIMG PDF SASPRTC Printer PDF le SASPRTC (color) SASPRTG (gray scale) SASPRTM (monochrome) PRINTER SASPRTC Printer Controlled by the PRINTERPATH= system option (and by the SYSPRINT= system option on Windows)3 SASPRTC (color) SASPRTG (gray scale) SASPRTM (monochrome)
Default Output Graphics output is displayed in the GRAPH window1 HTML and PNG le
HTML
PNG
Default
(Styles.Default)
1 The default devices for the LISTING destination do not write image les to disk. 2 JAVAMETA is supported for the LISTING destination, but its output requires processing with the Metaview applet. 3 In Windows, if the PRINTERPATH= option is not specied, then SAS uses the setting of the SYSPRINT= system option. If neither the SYSPRINT= nor the PRINTERPATH= option has been set, then SAS uses the default Windows printer.
71
If you do not specify a catalog, and you have dened a libref named GDEVICE0, then the GDEVICE procedure looks in the GDEVICE0 catalog rst. See Using the GDEVICE Windows on page 1136 for details. 3 Use GDEVICE procedure statements to write the list of device drivers to the Output window. For example:
proc gdevice catalog=sashelp.devices nofs browse; list; run; quit;
The NOFS option in the PROC GDEVICE statement causes the procedure not to use the GDEVICE window. If you want to write the list of devices to an external le you can do either of the following actions: 3 save the contents of the Output window. 3 use the PRINTTO procedure to redirect the GDEVICE procedure output to an external le. See Base SAS Procedures Guide for a description of the PRINTTO procedure.
72
Chapter 6
Note: High resolution devices such as PNG300 and JPEG300 are not appropriate choices for the HTML destination. Web browsers cannot display images in high resolution, so high resolution images appear very large. These drivers are appropriate for high resolution output that can be inserted into other software applications. 4
3 Specify the name of a device entry with the DEVICE= option in a GOPTIONS
statement. For example:
goptions device=gif;
3 Specify the name of a device entry with the DEVICE= option in an OPTIONS
statement. For details, see DEVICE= System Option in SAS Language Reference: Dictionary.
3 Enter OPTIONS on the SAS command line, or select Tools I Options I System to
open the SAS System Options window. Expand Graphics, and select Driver settings. Right-click on Device, select Modify value, and specify the name of the graphics device that you want to use.
3 Enter the device name in the DEVICE prompt window. The DEVICE prompt
window opens automatically if you submit a SAS/GRAPH program that produces graphics output, no device has been specied, and you are running outside of the SAS windowing system environment. If you specify a device in more than one way, the last specication that SAS/GRAPH encounters is the one that it uses. The device specication stays in effect until you specify another device, submit the graphics option RESET=GOPTIONS or RESET=ALL, or end your SAS session. If you use the same device for most or all of your SAS/GRAPH programs, you can put the GOPTIONS DEVICE= statement in an AUTOEXEC le. See the SAS companion for your operating environment for details on setting up an AUTOEXEC le. You can also specify a device for previewing or printing your output with the TARGETDEVICE= graphics option. For details, see Printing Your Graph on page 109. If you submit a SAS procedure without specifying a device and your display device does not support the GRAPH window or you are running outside the SAS windowing system, then SAS/GRAPH prompts you for a device.
73
Native SAS/GRAPH devices produce output in the native language of the device. For example, TIFFP, PS300, SASEMF, JPEG, CGMC, and GIF are native SAS/GRAPH devices. With native SAS/GRAPH devices, you can specify default attributes for your output by customizing the device entry (the DEV catalog entry). For example, by editing the DEV catalog entry for the device, you can change the default size and resolution of your output and the default colors and fonts that are used when styles are turned off. Native SAS/GRAPH devices do not set and or use the SYSPRINT= or PRINTERPATH= system options. Java and ActiveX devices produce output using different technologies than the native SAS/GRAPH devices. These devices are the JAVA, JAVAIMG, ACTIVEX, and ACTXIMG devices. These devices do not use information specied in the device entry. Universal Printer shortcut devices use the Universal Printing system to generate output. Universal Printing is a printing system that provides printing capabilities to SAS applications and procedures on all the operating environments that are supported by SAS. It is part of Base SAS. For information on universal printing, see Printing With SAS in SAS Language Reference: Concepts. Universal Printer shortcut devices can generate output in the following formats: PDF, PostScript, PCL, PNG, GIF, and SVG. For example, PNG and SVG are Universal Printer shortcut devices. Any device whose name begins with the letter U, such as UGIF or UPSL, is also a Universal Printer shortcut device. The description of a Universal Printer shortcut device generally says Universal Printer when you view the contents of the SASHELP.DEVICES catalog (see Viewing The List Of All Available Devices on page 71). The list of all Universal Printer shortcut devices is shown in Table 6.4 on page 76. Universal Printer shortcut devices are designed to emulate a native SAS/GRAPH device, which means that these devices behave as much as possible like native SAS/GRAPH devices. For example, these devices set the value of PRINTERPATH= so that you need only specify the device name with the GOPTIONS statement. However, for these devices there are some attributes of your output, such as default resolution, that cannot be changed by modifying the DEV catalog entry. See Using Universal Printer Shortcut Devices on page 75 for more information. Interface devices are devices that, in some operating environments, use the facilities of the operating environment, and, in other operating environments, use Universal Printing to generate output. There are three subcategories of interface devices: printer, display, and metale. The printer interface devices are the SASPRTC, SASPRTG, and SASPRTM devices (and the WINPRT* devices on Windows systems). In Windows operating environments, if the PRINTERPATH= system option has not been set, these devices use the setting of the SYSPRINT= system option to determine the default output device and the Windows Print Manager to control the generation of output. In Windows operating environments, the Universal Printing System is used if the PRINTERPATH= system option is specied or if the UPRINT system option has been specied at invocation. Otherwise, they use the setting of the PRINTERPATH= system option to determine the default output device and the Universal Printing system to control the generation of output.
74
Chapter 6
Examples GIF TIFFP JPEG CGM BMP1 SASBMP2 EMF, WMF1 SASEMF, SASWMF2 JAVAMETA ZPNG IBMPCGX
Yes, except as noted in the documentation for specic graphics options. Also, resolution is controlled by the operating environment. Yes3, except for resolution5
no
Shortcut devices
Interface devices
Printer
Display
WIN XCOLOR
Yes, except for size8, resolution9, and fonts Yes, except for resolution9 and fonts
Metale
1 On Windows, BMP, EMF, and WMF are interface metale devices. In all other operating environments, BMP, EMF, and WMF are native SAS/GRAPH devices. 2 In operating environments other than Windows, SASEMF, SASWMF, and SASBMP are copies of EMF, WMF, and BMP, respectively. 3 With SVG devices, the XMAX= and YMAX= graphics options set the size of the page, and the HSIZE= and VSIZE= graphics options set the size of the SVG output. With other devices,
75
4 5
6 7
8 9
all four options set the size of the graphics output, and if all four are specied, the smaller specications are used. Some native devices have a set resolution, and others have a xed set of supported resolutions that you can specify. Shortcut devices use Universal Printers. Universal Printers have a xed set of supported resolutions that can be selected through the Print Setup dialog box or through the PRINTDEF procedure. The WINPRT* devices are identical to the SASPRT* devices. They differ in name only. The interface printer devices use a mix of host printing facilities and Universal Printing, depending on the operating environment. On Windows systems, use the Windows Print Manager to change the default resolution and size. On other systems, resolution and size are set through the Print Setup dialog box or through the PRINTDEF procedure. The device is queried. The size is constrained by the window. Display resolution is set in the display properties for the operating environment. The device is queried, and the resolution is set according to the value returned.
76
Chapter 6
The device is set to SASPRTC because SASPRTC is the default device for the PRINTER destination. The Universal Printer is set to PNG by the PRINTER= or PRINTERPATH= option. The default output lename is controlled by ODS, for example, sasprt.png.
Table 6.5 on page 76 lists all of the Universal Printer shortcut devices that are provided by SAS.
Table 6.5 Universal Printer Shortcut Devices
Name PCL5 PCL5C PCL5E PDF PDFA PDFC PNG PNG300 PNGT PSCOLOR PSL PSLEPSF PSLEPSFC SVG SVGT SVGVIEW SVGZ UEPS UEPSC UGIF UPCL5 UPCL5C Description PCL5 Universal Printer PCL5c Universal Printer PCL5e Universal Printer PDF Version 1.3 color Archive PDF - ISO-19005-1/b PDF Version 1.3 color PNG Universal Printer PNG Universal Printer-300 dpi PNG Universal Printer with Transparency PostScript Level 1 (Color) PostScript Level 1 (Gray Scale) PostScript EPS (Gray Scale) PostScript EPS (Color) SVG Universal Printer SVG Transparency Universal Printer SVG Printer w/ Control Buttons SVG Compressed Universal Printer PostScript EPS (Gray Scale) PostScript EPS (Color) GIF Universal Printer PCL5c Universal Printer PCL5c Universal Printer
77
Description PCL5e Universal Printer PDF Version 1.3 color PNG Universal Printer PNG Universal Printer with Transparency PostScript Level 1 (Gray Scale) PostScript Level 1 (Color)
SAS can create SVG documents by using either the SVG Universal Printers or SAS/GRAPH SVG devices. There are four SVG devices: SVG, SVGT, SVGVIEW, and SVGZ. These devices are Universal Printer shortcut devices and are, therefore, intended mainly for use with the LISTING and HTML destinations. With the PRINTER destination, it is recommended that you use the SVG Universal Printers directly (see Table 6.4 on page 76). The information provided here is limited to creating SVG documents using SAS/GRAPH devices in the LISTING and HTML destinations. For information about creating SVG documents in the PRINTER destination using the SVG Universal Printers, see Creating Scalable Vector Graphics Using Universal Printing in SAS Language Reference: Concepts. For detailed information about the SVG standard, see the W3C documentation at http://www.w3.org/TR/SVG.
78
Chapter 6
title "Population in Europe"; proc gmap map=maps.europe(where=(id ne 405 and id ne 845)) data=sashelp.demographics(where=(cont=93)) all; id id; choro pop / name="europePop"; run; quit; ods html close; ods listing;
You can view the SVG coding by opening the SVG document, europepop.svg, in a text editor. When you view the SVG document in an SVG-enabled browser (see Browsers That Support SVG Documents on page 83), the browser renders the image.
79
SVG documents are ideal for producing documents to display on a computer monitor, PDA, or cell phone; or documents to be printed.
80
Chapter 6
imagestyle=fit iback="external-image-file"; /* Close the LISTING destination to conserve resources. */ /* Open the HTML destination and specify */ /* the name of the HTML output file. */ ods listing close; ods html file="carType.htm"; /* Specify the title for the graphic file and */ /* define response axis characteristics. */ title h=2 "Types of Vehicles Produced Worldwide"; axis1 label=none major=none minor=none; /* Generate the bar chart. The NAME= option */ /* specifies the name of the SVG file. proc gchart data=sashelp.cars; vbar type / raxis=axis1 outside=freq noframe name="carType"; run; quit; /* Close the HTML destination and */ /* reopen the LISTING destination. */ ods html close; ods listing;
*/
For additional information, see Displaying an Image in a Graph Background on page 180.
Example: Generating A Single SVG Document With Multiple Pages and Page Controls
81
Example: Generating A Single SVG Document With Multiple Pages and Page Controls
The SVGVIEW device is designed to be used when in the LISTING destination. It is useful when a single procedure produces multiple graphs, such as with BY-group processing. When used in the LISTING destination, the SVGVIEW device creates a single SVG document with multiple pages. Each graph produced by the procedure is on a different page. The SVG document, by default, has control buttons that enable you to navigate forward and backward through the graphs as well as display an index page that shows a thumbnail image of each page in the document. For example, the following display shows the initial graph that is produced by the program in Example Code 6.1 on page 82. The program produces six graphs. You can page through them clicking on using the Prev and Next buttons.
The Index button displays a page of thumbnail images. There is one thumbnail for each page in the SVG document.
82
Example: Generating A Single SVG Document With Multiple Pages and Page Controls
Chapter 6
filename mysvg "productView.svg"; goptions reset=all device=svgview gsfmode=replace gsfname=mysvg; /* Join the data points and change the */ /* line style for the predicted sales */ /* to a dashed line. */
83
symbol1 interpol=join line=1 color=_style_; symbol2 interpol=join line=2 color=_style_; legend1 label=none; /* Generate a graph for each unique */ /* combination of country and product. */ proc gplot data=work.prodsub; by country product; plot actual*month predict*month / overlay legend=legend1; run; quit;
When used in the HTML destination, the SVGVIEW device produces separate SVG documents for each graph, just like the SVG device. For additional information, see Multi-Page SVG Documents in a Single File and Multi-Page SVG Documents in a Single File in SAS Language Reference: Concepts.
84
Chapter 6
Company Adobe Systems, Inc. Apache Software Foundation eSVG Viewer for PC, PDA, Mobile GPAC Mozilla Foundation Opera Software TinyLine
1 Adobe SVG Viewer 3 works in Internet Explorer 7. Check www.adobe.com for information on support by Adobe Systems, Inc. for the SVG viewer. 2 Mozilla Firefox does not support compressed SVG documents or font embedding. To avoid font mapping problems, specify the NOFONTEMBEDDING system option. Zooming and panning features are not currently implemented. Also, if you select View Page Style No Style, all graphs appear as a black rectangle.
85
Topics dealing primarily with SAS system options are as follows: 3 SAS System Options That Effect Stand-alone SVG Documents 3 Scaling an SVG Document to the Viewport 3 Setting the ViewBox 3 Preserving the Aspect Ratio 3 Interaction between SAS SVG System Options and the SVG Tag Attributes
3 Run the GDEVICE procedure in windowing mode. The following statements open
the GDEVICE directory window that lists the available devices:
proc gdevice catalog=sashelp.devices; run;
From the GDEVICE Directory window, select the device name to open the GDEVICE Detail window. From there you can move to the other GDEVICE windows for the entry, either by selecting windows from the Tools menu or entering commands on the command line. For details, see Using the GDEVICE Windows on page 1136.
86
Chapter 6
Some output devices cannot display color. If you try to increase the size of the display past the devices capability or if you specify colors for a device that cannot display them, you will get unpredictable results. You cannot force a device to act as a device with different capabilities by choosing a different device driver Note: The device driver that is associated with a device entry is shown in the
Module eld in the device entry. It is recommended that you do not change the device
driver associated with a device entry. Please contact SAS Technical Support before changing the device driver associated with a device entry. 4 Note: If you run SAS/GRAPH software in a multi-user environment, you should not change the device entries in the SASHELP.DEVICES catalog unless you are the system administrator or other on-site SAS support personnel. 4 If you need to change a device entry in SASHELP.DEVICES, copy it into a personal catalog named DEVICES, and then modify the copy. To use the new device, assign the libref GDEVICE0 to the library that contains the modied copy. See Creating or Modifying Device Entries on page 1142 for details.
Related Topics
Other tasks related to devices are discussed in the following topics: Devices on page xvii describes changes in device support for the current release. Chapter 7, SAS/GRAPH Output, on page 87 provides general information about graphics output formats and the SAS/GRAPH output process, setting the size and resolution of your graphics output, previewing on one device how output will look on another device, sending output directly to a printer or other hardcopy device, and replaying output. Chapter 16, Introducing SAS/GRAPH Output for the Web, on page 441 describes the options available for creating a Web presentation. Several devices can be used to create a Web presentation, including JAVA and ACTIVEX, which create interactive presentations. Chapter 8, Exporting Your Graphs to Microsoft Ofce Products, on page 111 describes how to choose a device for output that you want to use in Microsoft Ofce products. Chapter 38, The GDEVICE Procedure, on page 1125 describes how to create and modify devices. 3 creating les in graphics formats that can be viewed with a Web browser with other applications (see Graphics Output Files on page 92).
87
CHAPTER
7
SAS/GRAPH Output
About SAS/GRAPH Output 88 SAS/GRAPH Output Terminology 88 Supported Graphics Formats 88 Output Types 89 About GRSEGs 89 What You Can Do With SAS/GRAPH Output 90 Specifying the Graphics Output File Type for Your Graph 91 About the Output Delivery System (ODS) 91 About the Graphics Output Devices 91 The Output that Each Device Generates 91 Graphics Output Files 92 About File Extensions 93 The SAS/GRAPH Output Process 93 All Devices Except JAVA, JAVAIMG, ACTIVEX, and ACTXIMG 93 JAVA or ACTIVEX Device 93 JAVAIMG or ACTXIMG Device 94 Setting the Size of Your Graph 94 Using the HSIZE= and VSIZE= Graphics Options to Set the Size of Your Graphics Area 94 Using the XPIXELS= and YPIXELS= Graphics Options to Set the Size of Your Graph 95 Setting the Resolution of Your Graph 95 Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics 96 Using a Device Variant to Set the Size or Resolution of Your Graph 97 Controlling Where Your Output is Stored 97 Specifying the Name and Location of Your ODS Output 97 Specifying the Name and Location of Your Graphics Output File 98 About Filename Indexing 99 Specifying the Catalog Name and Entry Name for Your GRSEGs 100 Using the Default Catalog and Entry Name 100 Specifying a Name for Your GRSEG with the NAME= Option 100 Specifying the Catalog and GRSEG Name with the GOUT= and NAME= Options 100 Where GRSEGs are Stored When Multiple ODS Destinations are Used 101 Summary of How Output Filenames and GRSEG Names are Handled 102 Replacing an Existing Graphics Output File Using the GSFMODE= Graphics Option 104 Storing Multiple Graphs in a Single Graphics Output File 104 Using Graphics Options to Store Multiple Graphs in One Graphics Output File 104 Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File 104 Replaying Your SAS/GRAPH Output 106 Replaying Your Output Using the GREPLAY Procedure 106 Replaying Output Using the DOCUMENT Procedure 106 Creating Your ODS Document 106
88
Chapter 7
Replaying Your ODS Document 107 Previewing Output 109 Printing Your Graph 109 Sending Your Graph Directly to a Printer 109 Saving and Printing Your Graph 110 Exporting Your Output 110
Document le
SAS/GRAPH supports the following vector le formats: CGM EMF EPS PCL PDF Computer Graphics Metale Microsoft Enhanced Metale Encapsulated PostScript Printer Control Language Portable Document Format
4
PS SVG PostScript Scalable Vector Graphics are usually smaller than image les can be edited with thirdparty software (except for EPS) support system fonts
About GRSEGs
89
3 3 3 3 3
support font embedding with the PDF, SVG, l, and PostScript devices provide a clear image on high-resolution devices.
The type of graphics le format that you choose depends on how you are going to use the output. For example, you are planning to import the graph into other software applications, such as Microsoft Excel, Word or Power Point, you might prefer to create a CGM le. The vector-based les are usually smaller than image les, they support TrueType fonts, and except for EPS, they can be edited with third-party software. In addition, they use device-resident fonts and provide a clear image on high-resolution devices. If you want to display the graph on a Web page, or import it into software that cannot accept vector graphics. You must create an image le such as PNG or GIF. Most software applications that process graphics input can accept one or more of these le formats. Check the documentation for the hardware or software product to which you want to send the graph to determine what le formats it can use. For a complete list of graphics le formats that are available with SAS/GRAPH in your operating environment, refer to the Device Help for SAS/GRAPH in the SAS Help facility.
Output Types
The SAS graphics procedures can generate the following types of output:
3 a GRSEG (except for procedures GKPI, GTILE, and GAREABAR) 3 a graphics output le that contains the graph (BMP, JPG, GIF, PNG, and so on) 3 an HTML le that contains XML code that is consumed by the ActiveX control or
Java applet In addition, the SAS Output Delivery System (ODS) creates document les, which include the following types of output:
3 3 3 3 3 3
an HTML le that displays a graph an RTF le that contains a graph a PCL le that contains a graph a PDF le that contains a graph a PostScript le that contains a graph an SVG le that contains one or more graphs
About GRSEGs
A GRSEG is a SAS catalog entry that contains graphics commands in a generic, device-independent format. There are few cases in which you would be concerned with the GRSEGs. One case for using the GRSEGs is when combining multiple graphs into a single graphics output le using the GREPLAY procedure (see Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File on page 104). Beyond
90
Chapter 7
this case, there are few reasons to use the GRSEGs. If you plan to use the GRSEGs, you must understand when they are generated and where they are stored. GRSEGs are supported by the SAS/GRAPH procedures that use the graphics output devices with some exceptions. The procedures that are supported by only the JAVA, JAVAIMG, ACTIVEX, and ACTXIMG devices, such as GKPI, GTILE, and GAREABAR, do not support GRSEGs. A procedure that generates a GRSEG produces output in two steps: 1 It creates a GRSEG in a SAS catalog. 2 It uses a graphics output device to translate the commands from the GRSEG to commands that a particular graphics device understands. This is called device-dependent output. This method enables you to produce graphics output on several types of graphics output devices. A GRSEG is stored in a catalog in the SAS temporary directory. The graphics instructions that are contained in the GRSEG are understood only by the SAS/GRAPH software. You cannot use third-party graphics applications to view the graphic in a GRSEG. The SAS/GRAPH software provides devices that enable you to output a GRSEG to standard graphics formats such as GIF, PNG, and PDF, which you can view using third-party applications. SAS/GRAPH software always assigns a name and a description to each GRSEG so that you can identify it. By default, the names and descriptions are determined by the procedure. For example, a GRSEG produced by the GCHART procedure is assigned the name GCHART and a description such as PIE CHART OF MONTH. By default, SAS/GRAPH appends each new GRSEG to the catalog. If you create more than one graph with a procedure during a SAS session and the GRSEGs are stored in the same catalog, SAS/GRAPH software appends a number to the end of the name of subsequent GRSEGs. This number makes the names unique within the catalog. For example, if you create three graphs with the GCHART procedure during the same SAS session, the GRSEGs are named GCHART, GCHART1, and GCHART2. SAS/GRAPH software uses this naming convention whether GRSEGs are being stored in a temporary or a permanent catalog. You can supply a name and description when you create the graph by using the NAME= and DESCRIPTION= options. If you create more than one graph of the same name, the SAS/GRAPH software increments the specied name just as it does the default names.
91
unless you specify a different catalog with the GOUT= procedure option. To generate only GRSEGs and suppress all other forms of graphics output, use the NODISPLAY graphics option. See DISPLAY on page 355. After your graphics output is saved in a catalog, you can do the following with your graphics: 3 transport them in catalogs from one operating environment to another. For details, see Appendix 4, Transporting and Converting Graphics Output, on page 1651. 3 convert them for use with a different version of SAS by converting the catalog containing the graphics output. For details, see Converting Catalogs to a Different Version of SAS on page 1654. 3 export them to graphics output les using different graphics le formats. For details, see Exporting Your Output on page 110.
ACTXIMG
92
Chapter 7
External Files A BMP le that contains the graph A CGM le that contains the graph. A CGM le suitable for inserting into Microsoft Word or PowerPoint presentations. An EMF le that contains the graph. A GIF le that contains the graph. This device is used with the ODS HTML destination. It generates a JavaScript that ODS includes in the HTML le. When the HTML le is viewed in a browser, the SAS/GRAPH output is displayed as an interactive Java applet. Display device. This device is available on z/OS hosts only. A PNG le that contains a static graph that is generated with the JAVA device. A JPG le that contains the graph. A PCL le that contains the graph. A PDF le that contains one or more graphs and tables. A PNG le that contains the graph. A PostScript le that contains one or more graphs. A PostScript le that contains the graph in gray scale. An EMF le that contains the graph. This device is the default device for the ODS RTF destination. An SVG le that contains the graph. A TIFF le that contains the graph in color. Display device. This device is available on Windows hosts only. Display device. This device is available on UNIX hosts only.
IBMPCGX JAVAIMG JPEG PCL5 PDF PNG PSCOLOR PSL SASEMF SVG TIFFP WIN XCOLOR
3 print the le using host commands 3 view the le with an appropriate viewer or browser 3 edit the le with the appropriate editing software 3 import the le into other software applications
93
Note: A graphics output le is different from a SAS/GRAPH GRSEG. A graphics output le is a le that is independent of SAS, and a GRSEG is a type of SAS catalog le. Consequently, you use host commands to manipulate a graphics output le independent of the SAS System, whereas you must use the SAS System to manipulate SAS GRSEGs. The GREPLAY procedure can be used to replay graph entries stored in catalogs and display them in the GRAPH window. 4
ODS
ods listing close; ods rtf; ods html; proc ...
Note: The image size, color, and font information is obtained from the device entry and incorporated into the GRSEG. 4
94
Chapter 7
Browser
ODS
image
RTF File with embedded graph ODS XML image ACTXIMG or JAVAIMG Device Size and color information from styles is incorporated here
Using the HSIZE= and VSIZE= Graphics Options to Set the Size of Your Graphics Area
You can use the HSIZE= and VSIZE= graphics options to change the default size of the graphics area for the device that you are using. The HSIZE= option sets the horizontal dimension, while the VSIZE= option sets the vertical dimension. You can specify the dimension in inches (in), centimeters (cm), or points (pt). The default unit is inches (in). Here is an example that creates a 20 centimeter wide by 10 centimeter high GIF image of a graph.
option gstyle; ods listing style=statistical; goptions reset=all device=gif hsize=20cm vsize=10cm; proc gchart data=sashelp.cars;
4
vbar Make; where MPG_Highway >= 37; run; quit;
95
Using the XPIXELS= and YPIXELS= Graphics Options to Set the Size of Your Graph
For devices other than the default display devices and the Universal Printing devices, you can use the XPIXELS= and YPIXELS= graphics options to change the default size of the display area for your graph without having to modify the device. Note: The XPIXELS= and YPIXELS= graphics options are not supported by the default display devices. They are also not supported by Universal Printer devices (including the shortcut devices). The options are partially supported by the ACTIVEX and JAVA devices. 4 Setting only the XPIXELS= and YPIXELS= options affects the size of the graph, but does not affect the resolution. Here is an example that creates a 600 pixel wide by 800 pixel high GIF image of a graph.
option gstyle; ods listing style=statistical; goptions reset=all device=gif xpixels=600 ypixels=800; proc gchart data=sashelp.cars; vbar Make; where MPG_Highway >= 37; run; quit;
Notice that XMAX= and YMAX= are not set. In this example, the SAS/GRAPH software recomputes the XMAX= and YMAX= values to retain the original resolution for the new graph size.
96
Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics
Chapter 7
Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics
For devices other than the default display devices and the Universal Printer devices, you can use the XPIXELS=, XMAX=, YPIXELS=, and YMAX= graphics options to set the resolution of your graph. Note: The XPIXELS=, YPIXELS=, XMAX=, and YMAX= graphics options are not supported by the default display devices and the Universal Printer devices, including the shortcut devices. These graphics options are partially supported by the ACTIVEX and JAVA devices. 4 Note: The resolution of GIF and BMP images is xed and cannot be changed using this method. 4 The XPIXELS= and YPIXELS= graphics options set the number of pixels for the X and Y axes respectively. The XMAX= and YMAX= graphics options set the maximum boundaries of the output on the X and Y axes respectively. The SAS/GRAPH software computes the resolution as follows: X-resolution = XPIXELS / XMAX Y-resolution = YPIXELS / XMAX Table 7.2 on page 96 summarizes the affect of the XPIXELS=, XMAX=, YPIXELS=, and YMAX= graphics options have on the image resolution.
Table 7.2 Interactions of Graphics Options That Affect Resolution
Options Specied XPIXELS= and YPIXELS= Options Not Specied XMAX= and YMAX= SAS/GRAPH Action Changes the dimensions and recalculates the value of XMAX= and YMAX= in order to retain the resolution. Changes the dimensions and recalculates the value of XPIXELS= and YPIXELS= in order to retain the resolution. Changes the horizontal dimension and recalculates the resolution. Changes the vertical dimension and recalculates the resolution.
For example, for the graphics option settings XPIXELS=800 and XMAX=8in, the resulting X resolution is 100 DPI. You can set the X resolution, the Y resolution, or both. Here is an example that sets the resolution of a 1000-pixel-wide-by-1200-pixel-high TIFF image of a graph to 200 DPI.
option gstyle; ods listing style=seaside; goptions reset=all device=tiffp xpixels=1000 xmax=5in ypixels=1200 ymax=6in; proc gchart data=sashelp.cars; vbar Make;
4
where MPG_Highway >= 37; run; quit;
97
The PNG300 and JPEG300 device variants produce 300 DPI images in the PNG and JPEG format respectively. Note: The PNG300 and JPEG300 devices are not appropriate for use with the ODS HTML destination. These devices are used when a high-resolution graph (300 DPI) in the PNG or JPEG format is required for printing purposes. Because most browsers do not use the resolution value stored in the PNG or JPEG le, images produced by the PNG300 and JPEG300 devices appear very large when they are viewed in the browser. 4 See Overview on page 67.
98
Chapter 7
Here is an example that uses the PATH=, GPATH=, and the BODY= ODS options with the HTML destination to send the HTML output to le mygraph.html in the current directory, and the graphics output le to the images subdirectory.
goptions reset=all; ods listing close; ods html style=banker path="./" gpath="images" body="mygraph.html"; proc gchart data=sashelp.prdsale; vbar Product / sumvar=actual; title1 "First Quarter Sales in Canada"; where Quarter=1 and Country="CANADA"; run; quit; ods html close; ods listing;
For more information on the PATH=, GPATH=, and BODY= options, see SAS Output Delivery System: Users Guide .
If the le reference points to an aggregate le storage location, the graphics output les are named according to the NAME= option, if specied, or the default naming convention. If the le reference points to a le, the le specied in the FILENAME statement is used, even if the NAME= option is specied. See Summary of How Output Filenames and GRSEG Names are Handled on page 102. Here is an example that shows how to send the output of the GCHART procedure to le mychart.png in the MyGraphs directory.
filename graphout "MyGraphs"; goptions reset=all device=png gsfname=graphout; proc gchart data=sashelp.cars; pie Make / name="MYCHART"; where MSRP <= 15000; run; quit
If a MYCHART GRSEG entry does not already exist in the temporary catalog, the device sends the output to le mychart.png in the Mygraphs directory. If a MYCHART GRSEG entry already exists, the device uses an incremented name such as MYCHART1. In the previous example, you can replace the aggregate le location with a lename in the FILENAME statement and omit the NAME= option and get the same result. If you specify the lename in the FILENAME statement, you must include the proper le extension. See About File Extensions on page 93.
99
You can also store your output in a graphics output le on a remote host using FTP. Here is an example that uses FTP to store multiple PNG graphs in directory /public/ sas/graphs on the remote UNIX host unixhost73.
filename grafout ftp "/public/sas/graphs" dir host="unixhost73" fileext user="anonymous"; ods listing style=banker; goptions reset=all device=png gsfname=grafout; /* Create our data set by sorting sashelp.cars by type */ proc sort data=sashelp.cars out=work.cars; by type; run; /* Generate the graphs */ proc gchart data=work.cars; vbar Make; title1 "30 MPG or Better"; where MPG_Highway >= 30; by type; run; quit;
This example creates four PNG les in directory /public/sas/graphs on host unixhost73. Since the GCHART procedure uses BY-group processing, the FILENAME statement includes the DIR option, which denes an aggregate le storage location. If you need to create only one graph, remove the DIR option and specify the absolute path to your graphics output le in your FILENAME statement.
3 3 3 3 3
All of the other procedures use catalog-based indexing. Because two independent indexing systems are used by the SAS/GRAPH procedures, it is possible that existing graphics output les can be overwritten if the NAME= option is used to specify the same name for the procedures that use StatGraph indexing and the procedures that use catalog-based indexing. To avoid this problem, if you are using the NAME= option with your procedures, make sure that you use different names for the procedures that use StatGraph indexing and the procedures that use catalog-based indexing.
100
Specifying the Catalog Name and Entry Name for Your GRSEGs
Chapter 7
Specifying the Catalog Name and Entry Name for Your GRSEGs
Using the Default Catalog and Entry Name
If you omit the NAME= and GOUT= options, the SAS/GRAPH software uses the default naming convention to name the GRSEG entry and stores the entry in the default WORK.GSEG catalog. The GRSEG naming convention uses up to eight characters of the default name for the procedure as the base name for the GRSEG. If the name generated by the procedure duplicates an existing GRSEG, the name is incremented such as GCHART, GCHART1, GCHART2, and so on. For details, see the description of the NAME= option for a specic procedure. If you specify a lename for the graphics output le and omit the NAME= option, the graphics output lename is the name specied in the FILENAME statement, and the GRSEG entry name is the default procedure name. When you specify the lename, make sure that you include the appropriate le extension, such as .cgm, .gif, or .ps. If you specify an aggregate le storage location instead of a specic lename and you omit the NAME= option, the name of both the GRSEG entry and the graphics output le is the default procedure name, and SAS/GRAPH supplies the appropriate le extension. See Summary of How Output Filenames and GRSEG Names are Handled on page 102 for examples.
This example creates the le mychart.png in the SAS default output directory, and it creates the GRSEG Mychart in the SAS temporary catalog. See Summary of How Output Filenames and GRSEG Names are Handled on page 102 for additional information on output naming.
Specifying the Catalog and GRSEG Name with the GOUT= and NAME= Options
By default, GRSEGs are stored in the WORK.GSEG temporary catalog under the default name of the procedure that was used to generate the graph. The GRSEG name can be specied using the NAME= option, and the output catalog can be changed using the GOUT= procedure option. GRSEG names are limited to eight characters. If the NAME= option is set to a name that is more than eight characters in length, the GRSEG name is truncated to eight characters. The name of the library and catalog in which the GRSEG is stored can be changed with the GOUT= procedure option. The GOUT= procedure option is assigned the catalog name in the format libref.catalog for the desired catalog. The name can be a one-level or a two-level name. If a one-level name is used, the GRSEG is stored in the temporary WORK library under the specied catalog name. A two-level name can be used to specify a permanent catalog.
Specifying the Catalog Name and Entry Name for Your GRSEGs
101
Here is an example that shows how to store a GRSEG generated by the GCHART procedure under entry MYCHART in the MYGRAPHS.CARS catalog.
LIBNAME Mygraphs "Mygraphs"; ods listing style=banker; proc gchart data=sashelp.cars gout=Mygraphs.cars; vbar Make / name="Mychart"; where MPG_Highway >= 37; run; quit;
Table 7.4 on page 101 summarizes the location of the GRSEG based on the NAME= and GOUT= procedure using the GCHART procedure as an example.
Table 7.4 How NAME= and GOUT= Affect the GRSEG Location
NAME= Not specied Not specied Not specied MYCHART MYCHART MYCHART GOUT= Not specied CARS MYGRAPHS.CARS Not specied CARS MYGRAPHS.CARS GRSEG Location Gchart in WORK.GSEG Gchart in WORK.CARS Gchart in MYGRAPHS.CARS Mychart in WORK.GSEG Mychart in WORK.CARS Mychart in MYGRAPHS.CARS
Where GRSEGs are Stored When Multiple ODS Destinations are Used
When you send output to multiple ODS destinations, a catalog is created for the GRSEGs for each of the destinations. If the GOUT= procedure option is not specied, by default, the GRSEGs for the rst destination that was opened are sent to the WORK.GSEG catalog. The GRSEGs for the subsequently opened ODS destinations are sent to a catalog that is named after the destination itself. For example, if you open the ODS LISTING, HTML, and RTF destinations, in that order, the GRSEGs are stored in the catalogs that are shown in the following table.
Catalog Name WORK.GSEG WORK.HTML WORK.RTF Content The GSEGs for ODS LISTING The GSEGs for ODS HTML The GSEGs for ODS RTF
In the default case, the GRSEGs for the rst destination that is opened are stored in the WORK.GSEG catalog, regardless of the destination. If you use the GOUT= procedure option to specify a catalog name, the GRSEGs for the rst destination that you opened are sent to the catalog that is specied by the GOUT= procedure option. The GRSEGs for the subsequently opened ODS destinations are sent to a catalog that is named after the destination itself. For example, if you open the ODS HTML, LISTING, and RTF destinations, and you use the GOUT=MyGraphs.Sales procedure option, the GRSEGs are stored in the catalogs that are shown in the following table.
102
Chapter 7
Content The GRSEGs for ODS HTML The GRSEGs for ODS LISTING The GRSEGs for ODS RTF
The GRSEGs for the rst destination are stored in the catalog that is specied by the GOUT= procedure option.
NAME="FRED"
NAME="WEATHEROBS"
Note: When the le reference points to an aggregate le storage location, the name of the GRSEG always determines the name of the graphics output le. It does not matter whether the GRSEG name is the default name or a name assigned by the NAME= option. 4 CAUTION:
If the graph created by your program already exists in the catalog, a new GRSEG with an incremented name is created. A new graphics output le might be created, which leaves your old graphics output le in place. 4
103
Although GRSEG names cannot be more than eight characters in length, the NAME= option supports long names. When the NAME= option is assigned a name of more than eight characters and the le reference points to an aggregate le location, the GRSEG name is the NAME= value truncated to eight characters, and the graphics output lename is the complete NAME= value. This is demonstrated by the NAME="WEATHEROBS" example in Table 7.5 on page 102. When a GRSEG of the same name already exists in the catalog, the SAS/GRAPH software combines the NAME= option value with a number to create an incremented name of no more than eight characters. If the GSFNAME= graphics option is used and the le reference points to an aggregate le location, the new graphics output lename is also incremented, but the lename is the full value of the NAME= option with a number appended. The same number is used for the GRSEG name and the graphics output lename. If the GSFNAME= graphics option points to a le, the graphics output lename remains the same and the original le is replaced with the new graph by default. Table 7.6 on page 103 demonstrates how the SAS/GRAPH software increments the GRSEG name and the graphics output lenames when a GRSEG and graphics output le of the same name already exist.
Table 7.6 How SAS/GRAPH Increments GRSEG Names and Filenames
NAME= NAME="FRED" Condition GSFNAME= points to a le named "MYGRAPH.GIF" and GRSEG FRED already exists. GSFNAME= points to an aggregate le storage location and GRSEG FRED already exists. GSFNAME= points to an aggregate le storage location and GRSEG WEATHERO already exists. GSFNAME= points to a le named "MYGRAPH.GIF" and GRSEG GCHART already exists. GSFNAME= points to an aggregate le storage location and GRSEGs GCHART and GCHART1 already exist. Result GRSEG name: FRED1 external lename: MYGRAPH.GIF GRSEG name: FRED1 external lename: FRED1.GIF GRSEG name:WEATHER1 external lename: WEATHEROBS1.GIF
NAME="FRED"
NAME="WEATHEROBS"
GRSEG name: GCHART1 external lename: MYGRAPH.GIF GRSEG name: GCHART2 external lename: GCHART2.GIF
You cannot replace individual GRSEGs in a catalog. To replace a GRSEG, you must delete the GRSEG, and then re-create it. Therefore, even though the contents of the graphics output le are replaced, the GRSEG is not. Each time you submit the program, a new GRSEG is created, and the GRSEG name is incremented.
104
Replacing an Existing Graphics Output File Using the GSFMODE= Graphics Option
Chapter 7
Replacing an Existing Graphics Output File Using the GSFMODE= Graphics Option
You can use the GSFMODE= graphics option to replace an existing graphics output le with a new graph. To replace an existing graphics output le, the GSFMODE= option must be set to REPLACE, which is the default value for this option. When you run a SAS program that creates a graphics output le and the graphics option GSFMODE=REPLACE is used, the existing graphics output le is replaced with the new graph. However, a unique GRSEG is still generated each time you run the procedure. See Introduction on page 329.
Using Graphics Options to Store Multiple Graphs in One Graphics Output File
You can use the GSFMODE=APPEND and the GSFNAME= graphics options to store multiple graphs in one graphics output le. When the GSFMODE= graphics option is set to APPEND and the GSFNAME= option points to a le, if the graphics output le specied by the GSFNAME= option already exists, the SAS/GRAPH software appends the new graph to the graphics output le. Otherwise, it creates the graphics output le and stores the graph in it. Note: Although a le can contain multiple graphs, some viewers can view only one graph. This can make it appear that a le containing multiple graphs contains only one graph. 4 A common application of the GSFMODE=APPEND option is in the production of animated GIFs. See Developing Web Presentations with the GIFANIM Device on page 521.
Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File
You can use the GOUT= procedure option with the GREPLAY procedure to store multiple graphs in one graphics output le. This involves the following steps: 1 Create a le reference for your output le. For example:
filename myfile "MyOutputFile.ps";
2 Run the procedure to generate your charts and store them in a catalog. 3 Add the GSFNAME=FileRefName to your GOPTIONS statement. 4 Run the GREPLAY procedure as follows:
proc greplay igout=<CatalogName>
Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File
105
Replace <CatalogName> with the name of the catalog in which your graphs are stored. The REPLAY _ALL_ action statement replays all of the entries in the catalog. Here is an example that replays ve graphs to one PostScript le for printing.
/* Specify graphics output file name */ filename psout "multicharts.ps"; /* Specify style and graphics options */ ods listing style=banker; goptions reset=all device=pscolor gsfname=psout nodisplay; /* Generate the graphs */ proc gchart data=sashelp.cars gout=Work.Mygraphs; vbar Make; title1 "30 MPG or better"; where MPG_Highway > 30; run; vbar Make; title1 "Between 25 MPG and 29 MPG"; where MPG_Highway >= 25 AND MPG_Highway <= 29; run; vbar Make; title1 "Between 20 MPG and 24 MPG"; where MPG_Highway >= 20 AND MPG_Highway <= 24; run; vbar Make; title1 "Between 15 MPG and 19 MPG"; where MPG_Highway >= 15 AND MPG_Highway <= 19; run; vbar Make; title1 "Less than 15 MPG"; where MPG_Highway < 15; run; quit; /* Enable display, and then replay all of the graphs to psout */ goptions display; proc greplay igout=Work.Mygraphs nofs; replay _all_; run; quit;
106
Chapter 7
You can also use the GREPLAY procedure to replay multiple graphs to a single le for the graphic and document formats that support multiple images per le. See Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File on page 104 and Chapter 21, Generating Web Animation with GIFANIM, on page 521. For information on the GREPLAY procedure, see Chapter 50, The GREPLAY Procedure, on page 1465.
permissions.
2 Close ODS LISTING. 3 Open the ODS destinations that you want to send your output to. 4 Specify the device that you want to use using the DEVICE= graphics option. 5 Generate your chart. 6 Close the ODS destinations that you opened in step 3. 7 Close ODS DOCUMENT. 8 Open ODS LISTING.
107
Here is an example that shows how to create an ODS document containing three pie charts and how to store it in catalog Mygraphs.Mydocs. The pie charts are generated with the JAVA device.
/* Create the Mygraphs catalog */ LIBNAME Mygraphs "./"; /* Open the DOCUMENT destination. Specify catalog */ /* Mygraphs.Mydocs for the output and give it write permission */ ods document name=Mygraphs.Mydocs(write); /* Close the LISTING destination */ ods listing close; /* Open the HTML destination, and specify the JAVA device. */ ods html style=seaside; goptions reset=all device=java; /* Generate the charts */ proc gchart data=sashelp.cars gout=Mygraphs.Mydocs; pie Make / other=2; title1 "30 MPG or Better"; where MPG_Highway >= 30; run; pie Make / other=3; title1 "Between 20 MPG and 29 MPG"; where MPG_Highway < 30 and MPG_Highway >=20; run; pie Make / other=3; title1 "19 MPG or less"; where MPG_Highway < 20; run; quit; /* Close the HTML and DOCUMENT destinations */ ods html close; ods document close; /* Reopen the LISTING destination */ ods listing;
108
Chapter 7
A list of the graphs in the document is displayed in the Output window as shown in the following example:
Listing of: \Mygraphs.Mydocs\ Order by: Insertion Number of levels: All Obs Path Type ------------------------------------------------------1 \Gchart#1 Dir 2 \Gchart#1\Gchart#1 Graph 3 \Gchart#1\Gchart#2 Graph 4 \Gchart#1\Gchart#3 Graph
In this example, the graphs are listed in the order in which they were inserted into the catalog. To replay individual graphs, you must know the path to the graphs, which is shown in the Path column. To replay the output: 1 Close the ODS LISTING destination. 2 Open the ODS destinations that you want to send the output to. 3 Use the DEVICE= graphics option to specify the graphics output device that you want to use to generate the graphs. 4 Run the DOCUMENT procedure with one or more REPLAY statements to replay your graphs. Specify the path to each graph, and use the DEST= option to specify the output destination. Note: If you want to display all of the graphs, do not specify a path.
5 Close the ODS destinations that you opened in step 2. 6 Open the ODS LISTING destination.
Here is an example that shows how to play the rst and the third graphs in the Mygraphs.Mydocs catalog to the ODS RTF destination using the ACTIVEX device.
goptions reset=all device=activex; ods listing close; ods rtf style=money; proc document name=Mygraphs.Mydocs; replay \Gchart#1\Gchart#1 / levels=all dest=rtf; replay \Gchart#1\Gchart#3 / levels=all dest=rtf; run; quit; ods rtf close; ods listing;
To replay all of the graphs in the catalog, use one REPLAY statement that does not specify a path. For example:
proc document name=Mygraphs.Mydocs; replay / levels=all dest=rtf; run;
For more information on using the ODS DOCUMENT destination and the DOCUMENT procedure, see SAS Output Delivery System: Users Guide.
109
Previewing Output
If you want to preview how a graph is going to appear on another device before you send it to that device, use the TARGETDEVICE= graphics option. For example, to preview output on your display as it would appear on a color PostScript printer, include TARGETDEVICE= in a GOPTIONS statement and specify the device for the printer:
goptions targetdevice=pscolor;
How output is displayed on your screen depends on the following: 3 the orientation of the target device. As a result, the graph might not cover the entire display area of the preview device. 3 the values of either the LCOLS and LROWS pair or the PROWS and PCOLS pair, depending on the orientation of the target device. 3 the default color list of the target device. 3 the values of the HSIZE and VSIZE device parameters for the target device. The HSIZE and VSIZE values are scaled to t the display device, but they retain the target device aspect ratio. 3 the value of the CBACK device parameter for the target device. All other device parameter values, including the destination of the output, come from the current device entry. Therefore, the output displayed by TARGETDEVICE= might not be an exact replication of the actual output, but it is as close as possible. See TARGETDEVICE on page 426 for a complete description of TARGETDEVICE=.
110
Chapter 7
3 Use the GDEVICE procedure to modify a SAS/GRAPH device entry to spool output
directly to a printer. See Chapter 38, The GDEVICE Procedure, on page 1125 for information on adding host commands to a device entry.
3 Use FILENAME and GOPTIONS statements to create the graphics output le,
and then use a host command to spool the le to a spooler for the device.
3 Use an ODS PRINTER statement to produce a Postscript, PDF, PCL, SVG, PNG,
or GIF le. Then use a host command or a host application command to send the le to the printer.
3 Use the GDEVICE procedure to modify a SAS/GRAPH device to save the output to
a graphics output le and spool the output directly to a printer. See Chapter 38, The GDEVICE Procedure, on page 1125 for information on modifying device entries. 3 Use the Universal Printing interface. Note: On Windows platforms, the ODS PRINTER destination uses the Universal Printing interface in addition to the Windows system printers.
For detailed instructions on each of these methods, refer to the SAS Help facility for SAS/GRAPH.
3 Replaying Output Using the DOCUMENT Procedure on page 106 3 Chapter 9, Writing Your Graphs to a PDF File, on page 121 3 Chapter 8, Exporting Your Graphs to Microsoft Ofce Products, on page 111
111
CHAPTER
8
Exporting Your Graphs to Microsoft Ofce Products
What to Consider When Choosing an Output Format 111 Graphics Formats Versus Document Formats 111 Image Resolution and Size 112 Color Depth 112 Fonts 113 Multiple-Image Graphics Files 113 Ability to Edit: Vector Versus Raster Formats 113 Comparison of the Graphics Output 114 Working Around the EMF and CGM Transparency Limitation About the Default CGM Filter for Microsoft Ofce 118 Enhancing Your Graphs 118 Importing Your Graphs into Microsoft Ofce 118 Importing Graphs into Microsoft Word 118 Importing Graphs into Microsoft Excel 119 Importing Graphs into Microsoft PowerPoint 120
117
3 3 3 3 3 3
whether you need output in a graphics format or a document format the resolution and size of your graphs the color depth required for your graphs the fonts you want to use whether you need multiple graphs per page whether you need to edit your graphs using Microsoft products or using other third-party software
112
Chapter 8
PNG JPEG TIFF GIF BMP The document format can include both text and graphics in a single document. These documents store graphics in one of the following ways:
3 in the format of the document 3 in a graphics format embedded in the document 3 in an external le that the document links to
To include images in a document, the images must be compatible with the document. Here is a summary of the compatibility between the SAS/GRAPH document and graphics formats:
Document Format HTML RTF Compatible Graphics Formats PNG, GIF, JPEG, SVG, and ActiveX EMF, PNG, JPEG, and ActiveX
Color Depth
Another consideration when choosing a graphics format is color depth, which is the number of bits that are used to represent each color in an image. Color depth can affect the smoothness, clarity, and color trueness of the elements in a rasterized image. A greater color depth means that more distinct colors are available to represent elements such as gradient shading and antialiasing in text. Most of the graphics le formats support Truecolor, which provides a 24-bit color depth. The GIF format provides only an 8-bit color depth, which can represent up to 256 distinct colors in a single image. For many graphics, 8-bit color depth is sufcient. However, if your output includes background images, color gradients, or other
113
color-intensive elements, consider using a format that supports Truecolor. The formats that support Truecolor include the following: BMP CGM EMF EPS PNG SVG WMF See Overview on page 67 for information on the color depth supported by each of the graphics output devices.
Fonts
Microsoft Ofce products use fonts that are native to the Windows operating system, which include TrueType and OpenType fonts. The SAS/GRAPH graphics output devices might support the fonts that you are using in your Microsoft applications. See Introduction on page 1635 for information on the fonts that the SAS/GRAPH graphics output devices use.
3 Use the GREPLAY procedure to replay multiple graphs to a le of the same format
that was used to generate the original graphs.
3 Use the ODS DOCUMENT destination and the DOCUMENT procedure to replay
multiple graphs to a le of any supported format
3 Use the ODS PRINTER destination with a Universal Printer device that supports
multiple-page documents.
3 Use the GIFANIM procedure to insert multiple graphs into an animated GIF.
See Using the GREPLAY Procedure to Store Multiple Graphs in One Graphics Output File on page 104 and Exporting Your Output on page 110 for information on replaying your graphs. See Developing Web Presentations with the GIFANIM Device on page 521 for information on using the GIFANIM device.
114
Chapter 8
3 The ODS HTML destination generates two les: a PNG le (by default) that
contains the graph and an HTML le that enables you to view the graph le. 3 The ACTIVEX device is used with the ODS RTF or ODS HTML destination to create an RTF or HTML le that contains code that is consumed by the ActiveX Control.
3 The ACTXIMG and JAVAIMG devices generate a PNG le that contains a static
graph that is generated by the ACTIVEX and JAVA devices respectively. 3 Procedures that do not support the ACTIVEX, ACTXIMG, JAVA, and JAVAIMG devices produce a GIF le when the ACTIVEX, ACTXIMG, JAVA, or JAVAIMG device is used. Table 8.1 on page 115 provides a brief comparison of these graphics output formats and lists some of the graphics output devices that generate each output type. For detailed information on all of the graphics output devices, see Overview on page 67.
4
Table 8.1 Comparison of the Graphics and Document Types
Type EMF and WMF Advantages and Limitations Advantages:
115
Devices
3 3 3
Most Windows-based applications recognize the EMF and WMF formats. Graphs stored in EMF or WMF can usually be edited after they are imported. Graphs are imported at full size into Ofce, and can be resized without a loss of quality.
3 3
Limitations:
The EMF format does not support transparency (see Working Around the EMF and CGM Transparency Limitation on page 117). Only one graph per le is supported.
3
CGM
Advantages:
3 3
Graphs stored in CGM les can be edited after they are imported. The image can be resized without a loss of quality.
3 3
Limitations:
The format does not support transparency (see Working Around the EMF and CGM Transparency Limitation on page 117). Because the default CGM lter is not installed by default in Microsoft Ofce, to import CGM les, you must install the CGM lter (see About the Default CGM Filter for Microsoft Ofce on page 118). Although the CGM format supports multiple images per le, not all versions of Microsoft Ofce can import more than one image per le (see About the Default CGM Filter for Microsoft Ofce on page 118).
116
Chapter 8
Type PNG
Devices
3 3 3 3 3
Designed to display images on the Web. Uses lossless data compression. Supports transparency (with the PNGT device). Can store high-resolution images. Supports truecolor images.
3 3 3 3 3
PNG ( no transparency) PNG300 (no transparency) PNGT (transparency) UPNG (no transparency) UPNGT (transparency)
Limitation: cannot be resized without a loss of quality. JPEG and TIFF Advantages:
3 3 3 3 3 3
JPEG is widely used for displaying photographs on the Web. Both can store high-resolution graphics.
3 3 3
Limitations: JPEG uses lossy compression. The SAS/GRAPH JPEG device supports only 256 colors. TIFF is not a Web graphics format. JPEG and TIFF images cannot be resized without a loss of quality.
Advantages:
3 3 3
GIF supports transparent backgrounds. GIF can store multiple images per le when it is formatted as an animated GIF. Both support the IBACK option and the IMAGE annotation function for including logos and other images in the background of the graph.
3 3 3 3 3
BMP (720x480) BMP20 (720 480, BMP 2.0) GIF (800x600) GIFANIM (1280x1024, multi-image) UGIF (Universal Printer)
Limitations:
3 3 3
Both formats have a xed resolution of 96 DPI. The GIF standard is limited to 256 colors. Cannot be resized without a loss of quality.
4
Type EPS Advantages and Limitations Advantages:
117
Devices
3 3
Can contain a combination of vector and bitmap objects. Can be resized after it is imported into Ofce 97 or Ofce 2000.
Limitations:
3 3 3 3 3 3
UEPS (gray scale) UEPSC (color) PSEPSF (gray scale) PSEPSFA4 (gray scale) PSLEPSF (gray scale) PSLEPSFC (color)
3 3
The images should not be edited after they are imported. Because the system display does not use the PostScript language to render the graph, these graphics might be visible only when printed to a PostScript printer. Because the preview is created automatically in Ofce 2002 and later, the image should not be resized after it is imported. Although this format can store more than one image per le, an EPS le should contain only one image.
HTML
Advantages:
3 3
Can store text and graphics. In Ofce 2000 and later, and in Microsoft Word in Ofce 97, the images are loaded into the document automatically when the HTML is imported.
3 3 3 3 3
JPEG GIF and UGIF ACTIVEX ACTXIMG and JAVAIMG, which create PNG les PNG, PNGT, UPNG, and UPNGT
Limitation: In Ofce 97, the images are not loaded into a PowerPoint or Excel document when the HTML is imported. Only the text and tables are imported. RTF Advantages:
3 3
Designed specically for sharing documents between word processors. Can store both text and graphics.
3 3 3 3 3
JPEG ACTIVEX ACTXIMG and JAVAIMG, which create PNG les PNG, PNGT, UPNG, and UPNGT SASEMF and EMF
3 For EMF, use the CBACK= or IBACK= graphics options to assign the matching
color or image for the graph background. You could instead edit the EMF le after it is imported to remove the default background.
118
Chapter 8
3 For CGM, use the CBACK= graphics to assign a matching background color to the
CGM le. The CGM devices do not support the IBACK= graphics option or the IMAGE function. To have an image in the document or slide appear as the background of the graph, edit the graph after it is imported to remove the background created by SAS so that the document background shows through.
119
3 On the Insert tab, click the Picture icon in the Illustrations group. The Insert
Picture dialog box opens. 4 In the Insert Picture dialog box, select your graphics output le, and then click Insert. To insert a SAS/GRAPH document into a Microsoft Word 2007 document: 1 Do one of the following based on the type of the document you are importing from: 3 If you are importing from an HTML document, open the document in your Web browser. 3 If you are importing from an RTF document, open the document in Microsoft Word.
2 If you have not already done so, open the target document and position your
cursor where you want to insert your graph. 3 In the HTML or RTF document, right-click the graph, and then select Copy from the pop-up menu. 4 In the target document, right-click in the page area, and then select Paste from the pop-up menu. If the graph you have imported is an ActiveX graph, you can right-click on your graph in your document and change various attributes of your graph using the pop-up menu. For more information on this menu, select Help I Graph Control Help from the pop-up menu. If the graph you have imported is an animated GIF, you must convert the Microsoft Word document to HTML, and then open the HTML version of your document in your Web browser to play the animated GIF.
graph, and then select Copy from the pop-up menu. 5 In your spread sheet, right-click in the cell that you are importing to, and then select Paste from the pop-up menu.
120
Chapter 8
If the graph you have imported is an ActiveX graph, you can right-click on your graph in your spreadsheet and change various attributes of your graph using the pop-up menu. For more information on this menu, select Help I Graph Control Help from the pop-up menu.
necessary. 4 In the HTML or RTF document that you are importing from, right-click the graph, and then select Copy from the pop-up menu. 5 In your PowerPoint presentation, right-click in the slide that you are importing to, and then select Paste from the pop-up menu. 6 Adjust the size and position of the graph, if necessary. If the graph you have imported is an ActiveX graph, you can change various attributes of your graph dynamically as follows: 1 Right-click your graph, and then select SAS Graph v9 Object I Edit to activate the ActiveX Control. 2 Right-click your graph again, and then select an item from the pop-up menu to change one or more attributes of the graph. You can change the chart type, style, and so on, using this menu. For more information on this menu, select Help I Graph Control Help from the pop-up menu. 3 To deactivate the ActiveX Control, deselect your graph. If the graph you have imported is an animated GIF, you must set the PowerPoint mode to Slide Show to play the animated GIF as follows: 1 In the left panel, select the slide that contains your animated GIF. 2 Click the Slide Show tab. 3 On the Slide Show tab, click From Current Slide in the Start Slide Show group. 4 Verify that your animated GIF plays properly. 5 Press the Esc key to exit the Slide Show mode.
121
CHAPTER
9
Writing Your Graphs to a PDF File
About Writing Your Graphs to a PDF File 121 Changing the Page Layout 122 Adding Metadata to Your PDF File 122 Adding Bookmarks for Your Graphs 122 Changing the Default Compression Level for Your PDF File 123 Examples 123 Creating a Multipage PDF File with Bookmarks and Metadata 123 Creating a PDF/A-1b-Compliant File that Contains Multiple Graphs Per Page Creating a Multiple-Page PDF File Using BY-Group Processing 127 Creating a Multiple-Page PDF File Using the GREPLAY Procedure 127
125
122
Chapter 9
Times/bold/italic Symbol ITC Zapf Dingbats For more information on fonts, see Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153. By default, the ODS PDF destination writes your output to a PDF Version 1.4 le. To write your graphs to a PDF le that can be archived, add the PRINTER=PDFA option to your ODS statement. The PDFA Universal Printer shortcut device creates a PDF le that is compliant with PDF/A-1b standards and can be archived. See Chapter 6, Using Graphics Devices, on page 67 for information on the PDFA Universal Printer shortcut device. See Creating a PDF/A-1b-Compliant File that Contains Multiple Graphs Per Page on page 125 for an example of how to create an archivable PDF le.
123
bookmark for each graph procedure. If you do not specify a description, the default graph description is used. See Creating a Multipage PDF File with Bookmarks and Metadata on page 123 for an example.
Examples
This section provides the following examples: Creating a Multipage PDF File with Bookmarks and Metadata on page 123 Creating a PDF/A-1b-Compliant File that Contains Multiple Graphs Per Page on page 125 Creating a Multiple-Page PDF File Using BY-Group Processing on page 127 Creating a Multiple-Page PDF File Using the GREPLAY Procedure on page 127
/* Open the PDF destination */ ods pdf style=seaside file="MyDoc.pdf" /* Output filename */ compress=0 /* No compression */ /* Add metadata */ author="J. L. Cho" subject="Auto makers" title="Car Makers by MPG and Vehicle Type" keywords="automobiles cars MPG sedans trucks wagons SUVs"; /* Modify the PDF page properties */ options orientation=LANDSCAPE papersize=A4 leftmargin=1cm
124
Chapter 9
rightmargin=1cm bottommargin=1cm topmargin=2cm; /* Set the top-level bookmark for the first set of graphs */ ods proclabel="Makes By MPG"; /* Create the first set of graphs */ proc gchart data=sashelp.cars; pie Make / name="HighMPG" other=3 description="High-MPG"; /* Set subheading text */ title1 "30 MPG or Better"; where MPG_Highway >= 30; run; pie Make / name="MedMPG" other=3 description="Average-MPG"; /* Set subheading text */ title1 "Between 20 MPG and 29 MPG"; where MPG_Highway < 30 and MPG_Highway >= 20; run; pie Make / name="LowMPG" other=3 description="Low-MPG"; /* Set subheading text */ title1 "19 MPG or less"; where MPG_Highway < 20; run; quit; /* Set the top-level bookmark for the second set of graphs */ ods proclabel="Makes By Type"; /* Create the second set of graphs */ proc gchart data=sashelp.cars; pie Make / name="Sedans" other=3 description="Sedans"; /* Set subheading text */ title1 "Sedans"; where Type = "Sedan"; run; pie Make / name="SUVs" other=3 description="SUVs"; /* Set subheading text */ title1 "SUVs"; where Type="SUV"; run; pie Make / name="Trucks" other=3 description="Trucks"; /* Set subheading text */ title1 "Trucks"; where type="Truck"; run; pie Make / name="Wagons" other=3 description="Wagons"; /* Set subheading text */ title1 "Wagons"; where type="Wagon"; run; pie Make / name="Sports" other=3 description="Sports Cars"; /* Set subheading text */ title1 "Sports Cars";
125
where type="Sports"; run; quit; /* Close the PDF destination */ ods pdf close; ods listing; /* Reset the graphics options */ goptions reset=all;
This creates a PDF le with the bookmarks shown in the following display:
The document metadata is displayed on the Description tab of the Document Properties dialog box. To open the Document Properties dialog box, type CTRL-D anywhere in the PDF viewer window or right-click in the PDF viewer window, and then select Document Properties from the pop-up menu. The following display shows the document metadata that is displayed for this example.
126
Chapter 9
create a PDF le that is compliant with PDF/A-1b standards. To create a standard Version 1.4 PDF le, remove the PRINTER=PDFA option from the ODS statement.
/* Close the LISTING destination */ ods listing close; /* Set page options */ options orientation=portrait rightmargin=0.1in leftmargin=0.1in; goptions reset=all ftext="Helvetica/bold"; /* Open PDF */ ods pdf style=printer printer=pdfa /* Create an archivable PDF */ file="FourVbars.pdf" /* Output filename */ startpage=never; /* Do not insert a pagebreak after each graph */ /* Create a slide for the graphs */ goptions hsize=0 vsize=0; proc gslide; title1 "1997 Quarterly U.S. Sales By State"; run; /* Size each graph 4in x 4in */ goptions hsize=4in vsize=4in; title1; /* Generate the graphs */ proc gchart data=sashelp.prdsal3; /* Create the Q1 graph in the top-left quadrant */ title2 "First Quarter"; goptions horigin=0 vorigin=5; pie State / sumvar=Actual type=mean; where country="U.S.A." AND quarter=1 AND Year=1997; run; /* Create the Q2 graph in the top-right quadrant */ goptions horigin=4 vorigin=5; title2 "Second Quarter"; pie State / sumvar=Actual type=mean; where country="U.S.A." AND quarter=2 AND Year=1997; run; /* Create the Q3 graph in the bottom-left quadrant */ title2 "Third Quarter"; goptions horigin=0 vorigin=0; pie State / sumvar=Actual type=mean; where country="U.S.A." AND quarter=3 AND Year=1997; run; /* Create the Q4 graph in the bottom-right quadrant */ title2 "Fourth Quarter"; goptions horigin=4 vorigin=0; pie State / sumvar=Actual type=mean; where country="U.S.A." AND quarter=4 AND Year=1997;
4
run; quit;
127
/* Close PDF and reopen LISTING */ ods pdf close; ods listing; /* Reset the graphics options */ goptions reset=all;
128
Chapter 9
/* Specify the landscape page orientation */ options orientation=portrait; /* Close the LISTING destination */ ods listing close; /* Reset the options and set NODISPLAY */ goptions reset=all nodisplay; /* Open the PDF destination */ ods pdf style=statistical file="Mygraph.pdf"; /* Create our data set by extracting 1994 data from sashelp.prdsale */ /* and sorting by quarter */ proc sort data=sashelp.prdsale(where=(Year=1994)) out=work.prdsale; by quarter; run; /* Delete the old GRSEGs */ proc greplay igout=work.gseg nofs; delete _all_; run; /* Generate the graphs */ proc gchart data=work.prdsale; vbar product /sumvar=actual discrete type=mean mean; title1 "1994 Q1 Average Sales By Product"; where quarter=1; run; title1 "1994 Q2 Average Sales By Product"; where quarter=2; run; title1 "1994 Q3 Average Sales By Product"; where quarter=3; run; title1 "1994 Q4 Average Sales By Product"; where quarter=4; run; quit; /* Replay the graphs to the PDF file */ goptions display; proc greplay igout=work.gseg nofs; replay _all_; run; quit; /* Close the PDF destination */ ods pdf close; /* Reset the graphics options */
4
goptions reset=all;
129
130
131
CHAPTER
10
Controlling The Appearance of Your Graphs
Overview 131 Style Attributes Versus Device Entry Parameters 132 About Style Templates 133 ODS Destinations and Default Styles 133 Recommended Styles 134 Examples of Output Using Different Styles 134 Specifying a Style 137 Changing the Current Style by Using the STYLE= Option in ODS Destination Statements Changing the Default Style in the SAS Registry 137 Overriding Style Attributes With SAS/GRAPH Statement Options 138 Precedence of Appearance Option Specications 139 Viewing the List of Styles Provided by SAS 139 Using The TEMPLATE Procedure 139 Using the Templates Window 139 Modifying a Style 140 Using the TEMPLATE Procedure 140 Example: Modifying a Style Element 140 Ways to Modify Graph Fonts Or Colors Specied By Styles 141 Modifying the GraphFonts And GraphColors Style Elements 141 Graphical Style Element Reference for Device-Based Graphics 142 The GraphColors Style Element 142 The GraphFonts Style Element 143 Font Specications In The GraphFonts Style Element 144 Style Elements For Use With Device-Based SAS/GRAPH Output 144 Turning Off Styles 151 Changing the Appearance of Output to Match That of Earlier SAS Releases 152
137
Overview
The appearance of SAS/GRAPH output is determined by ODS styles by default. Along with table and page attributes, ODS styles contain a collection of graphical attributes such as color, marker shape, line pattern, fonts, and so on. Many carefully designed styles that enhance the visual impact of the graphics are shipped with SAS. In addition to creating visually appealing graphics, the styles ensure that different groups of data can be easily distinguished from one another. They also ensure that data of equal importance is given equal visual emphasis. These styles produce professional-looking graphics without additional code in your SAS programs and without modifying the styles themselves. However, you can use SAS/GRAPH statement options to override specic elements in the styles, or you can modify style elements to create a customized style for yourself or your organization.
132
Chapter 10
Table 10.1
Description Specify a style template with the STYLE= option to change the appearance of the entire graph. Requires no further modication.
Reference Changing the Current Style by Using the STYLE= Option in ODS Destination Statements on page 137 Overriding Style Attributes With SAS/GRAPH Statement Options on page 138 Modifying a Style on page 140
Specify an appearance option using SAS/GRAPH procedure options or global statement options to change various aspects of your graph. This method requires modication of your SAS/GRAPH program. Specify or change style attributes in order to modify a style element. This requires the use of PROC TEMPLATE style statements.
Medium
High
You can turn off the use of styles if needed. In this case, the default appearance of your output is controlled by device entry parameters. See Style Attributes Versus Device Entry Parameters on page 132 and Turning Off Styles on page 151 for more information. Note: This section covers only device-based graphics. See Device-Based Graphics and Template-Based Graphics on page 6. 4
133
Table 10.2
For information on device entries, see What Is a SAS/GRAPH Device? on page 68 and Viewing and Modifying Device Entries on page 85. See also Changing the Appearance of Output to Match That of Earlier SAS Releases on page 152 and Turning Off Styles on page 151.
ODS Destination DOCUMENT LISTING OUTPUT HTML LATEX PRINTER RTF Measured RTF
The default style for each destination is set in the SAS registry. Changing the style specied in the SAS registry can be a convenient way to apply a companys style to all output sent to all destinations. See Changing the Default Style in the SAS Registry on page 137. Chapter 3, Getting Started With SAS/GRAPH, on page 39 shows examples of graphs using several styles, including the default styles for the most commonly used
134
Recommended Styles
Chapter 10
destinations. Examples of Output Using Different Styles on page 134 shows examples of graphs and tables using the Printer, Rtf, Analysis, and Journal styles.
Recommended Styles
SAS provides a set of styles that have been designed by GUI experts to address the needs of different situations. Table 10.4 on page 134 describes a subset of the styles provided by SAS that are particularly well-suited to displaying graphics.
Table 10.4 Recommended Style Templates
Recommended Styles Default (Styles.Default) Analysis Statistical Listing Printer Rtf Black and White onochromePrinter Journal2 Gray Scale Journal
Comments Gray background, optimized for HTML output Yellow background White background, colored lls White background, optimized for color format on white paper White background; serif fonts; optimized for PS and PDF output Similar to Printer; optimized for RTF output Black and white output; patterned lls; optimized for PCL output Interior lled areas have no color Interior lled areas are gray scale
Note: Certain ODS styles map textures onto graph elements. For the Java devices, these textures can be applied to two-dimensional rectangles only. Therefore, styles with textures cannot be applied to three-dimensional bar and pie charts in Java graphs. 4 Chapter 3, Getting Started With SAS/GRAPH, on page 39 shows examples of graphs using several styles, including the default styles for the most commonly used destinations. Examples of Output Using Different Styles on page 134 shows examples of graphs and tables using the Printer, Rtf, Analysis, and Journal styles.
135
Figure 10.1
Figure 10.2
136
Chapter 10
Figure 10.3
Figure 10.4
Note:
The table in Figure 10.4 on page 136 was sent to the PDF destination.
137
Specifying a Style
Changing the Current Style by Using the STYLE= Option in ODS Destination Statements
Changing the current style for an ODS destination is the easiest, simplest way of changing the appearance of your output. Changing the current style requires only the use of the STYLE= option in an ODS destination statement. By specifying only STYLE=style-denition in your ODS destination statement, you can create an entirely different appearance for your graphs. For example, you can specify that ODS apply the Styles.Journal style template to all HTML output with one of the following statements:
ods html style=styles.journal; ods html style=journal;
This style is applied to all output for that destination until you change or close the destination or start a new SAS session.
If you make a mistake when you modify the SAS registry, then your system might become unstable or unusable. See Managing the SAS Registry in SAS Language Reference: Concepts. 4
Note: You many have more than one SAS registry. Each site has a SAS registry in SASHELP. Each directory from which you run SAS has an individual registry in SASUSER. If you run SAS from multiple locations, and you want to change default styles via the SAS registry, you might need to change it in multiple locations. For more information, see The SAS Registry in SAS Language Reference: Concepts. 4 For more information on ODS and the SAS registry, see Changing SAS Registry Settings for ODS in SAS Output Delivery System: Users Guide. To permanently change the default style for a particular destination:
1 Select Solutions 2 Select ODS
I Destinations.
3 Select the destination that you want to change the default style for. 4 Select Selected Style, right-click, and select Modify. The Edit String Value
window appears.
5 Type the style in the Value Data text box and click OK.
138
Chapter 10
Display 10.1
If you want to change the color of the same graphical elements that are affected by the CAXIS= option by modifying a style, then you need to modify the Color attribute of the GraphAxisLines element. See Modifying a Style on page 140 for more information.
139
Attributes that are used repeatedly might be best specied in an ODS style. However, if you have created a customized style, be aware that you might need to make this style available to anyone that you send your SAS code to. Attributes that are used only once or occasionally are best specied using SAS/GRAPH statements.
statements
3 graphics options in a GOPTIONS statement
color options in the GOPTIONS statement that control specic graph elements such as the background color or title text color b the color list specied with the COLORS= option in the GOPTIONS statement
a
4 attributes specied in the current style or, if the NOGSTYLE option is in effect,
SAS/GRAPH uses the rst specication it nds in this list. Any exceptions to this rule are noted in the documentation for the specic option as described in Overriding Style Attributes With SAS/GRAPH Statement Options on page 138.
3 Enter the odstemplates command on the SAS command line. 3 In the Results window, select the Results folder. Right-click and select
Templates to open the Templates window.
140
Modifying a Style
Chapter 10
The Templates window contains the item stores Sasuser.Templat and Sashelp.Tmplmst.
2 Double-click an item store, such as Sashelp.Tmplmst, to expand the list of
directories where ODS templates are stored. The templates that SAS provides are in the item store Sashelp.Tmplmst.
3 Double-click Styles to view the list of styles dened in the selected item store. 4 Double-click the style denition that you want to view. For example, the Default
style denition is the template store for HTML output. Similarly, the Rtf style denition is the template store for RTF output. To view the actual style denition, double-click on a style name. The style denition is displayed in the Template Browser window.
Modifying a Style
You can use the DEFINE STYLE statement in the TEMPLATE procedure to create a new style from the Default style and modify the GraphData1 style element. The following program creates the new style MyStyleDefault, which inherits all of its style elements and style attributes from the Default style, and modies the GraphData1 style element:
proc template; define style MyStyleDefault; parent=Styles.Default; style GraphData1 from GraphData1 / markersymbol = "triangle" linestyle = 2 contrastcolor = GraphColors("gcdata1")
141
The new GraphData1 uses the same colors as the original GraphData1, but species a different marker symbol and line style. To use the new MyStyleDefault style for HTML output, specify the STYLE= option:
ods html style=MyStyleDefault;
3 Modify a specic style element that controls a specic graphical element. For
example, the GraphValueText element species the font and color for tick mark values and legend value descriptions. You could change the font or color specied by the GraphValueText element for the Analysis style. Changes to specic style elements affect only the graphical elements they control and affect them in only the styles where you change them. See Style Elements For Use With Device-Based SAS/GRAPH Output on page 144 for information on the specic style elements that you can modify. 3 Modify the font or color specications in the GraphFonts or GraphColors style elements for a specic style. The settings specied in GraphFonts and GraphColors are referenced by specic style elements elsewhere in the style. Other style elements that reference the GraphFonts or GraphColors style elements use the modied settings. See The GraphFonts Style Element on page 143 and The GraphColors Style Element on page 142 for more information. A single change in the specications in the GraphFonts or GraphColors style elements can potentially change the appearance of several graphical elements and affect output of any style that refers to GraphFonts or GraphColors.
3 Modify the font settings for one or more subkeys in the SAS registry. Many styles
refer to the font settings in the SAS registry to determine the fonts to use for various graphical elements. Modifying the SAS registry settings changes the fonts used for all styles that refer to the subkeys that you change. See SAS Output Delivery System: Users Guide for information on changing SAS registry settings. (Colors used by the styles supplied by the company are not controlled through the SAS registry.)
142
Chapter 10
Each attribute, GraphDataFont, GraphValueFont, GraphLabelFont, and so on, denes a list of fonts for use by SAS/GRAPH whenever the corresponding attribute is referenced. These attributes are specied elsewhere in the style as the value of a another font attribute. (For information on the syntax used in the GraphFonts style element, see Font Specications In The GraphFonts Style Element on page 144.) For example, the GraphValueText element species the font and color for tick mark values and legend value descriptions. Suppose the GraphValueText element is dened as follows:
class GraphValueText / font = GraphFonts(GraphValueFont) color = GraphColors(gtext);
The font and color for GraphValueText are specied by elements in the GraphFonts and GraphColors style elements.
GraphFonts(GraphValueFont)
tells SAS/GRAPH to use the font specied by the GraphValueFont attribute in the GraphFonts style element.
GraphColors(gtext)
tells SAS/GRAPH to use the color specied by the gtext attribute in the GraphColors style element. To change the font and color for tick mark values and legend value descriptions, you could modify either of the following: 3 the FONT= and COLOR= attributes in the GraphValueText element 3 the GraphValueFont attribute in the GraphFonts style element and the gtext attribute in the GraphColors style element. However, because elements in GraphFonts and GraphColors are referred to by other elements in the style, changing the values in GraphFonts and GraphColors result in more extensive changes than modifying a specic style element such as GraphValueText directly. If you modify the GraphValueText element directly, your modications affect only the items controlled by GraphValueText. If you modify the GraphValueFont or gtext attributes, then your modications might affect other portions of the graph in addition to tick mark values and legend value descriptions. This list includes pie labels, regression equations, data point labels, bar labels, and graph titles. The styles supplied with SAS/GRAPH are designed to provide a consistent visual appearance for all graphical elements in your output. Modifying attributes in the GraphFonts or GraphColors elements instead of modifying several specic style elements makes it easier to maintain the consistent appearance in your output. The tables listed in Graphical Style Element Reference for Device-Based Graphics on page 142 describe the portions of SAS/GRAPH output that are affected by elements and attributes dened in the styles.
143
are dened in the GraphColors style element and the graphical elements that they affect by default.
Table 10.5
GraphColors Attribute1 gaxis gborderlines gconnectLine goor ggrid glabel glegend goutline gshadow gtext2 gwalls gdata1gdata12 gcdata1gcdata12 gramp2cstart gramp2cend gconramp2cstart gconramp2cend
1 Elements in the GraphColors style element that are not included in this table are used with template-based (ODS Graphics) output only. (See Device-Based Graphics And Template-Based Graphics in Chapter 1, Introduction to SAS/GRAPH Software.) 2 The gtext attribute does not affect text that is not rendered as part of the graph. See also Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output in Chapter 13, Managing Your Graphics With ODS.
144
Chapter 10
Table 10.6
* The GraphUnicode and GraphAnnoFont attributes are used with ODS graphics only.
<MTsans-serif>
species the font family identied by the MTsans-serif subkey in the SAS registry. The less than and greater than signs tell SAS that this is the name of a subkey in the SAS registry. Because it is the rst font listed, SAS uses this font if possible. To view the font settings in the SAS registry, select ODS I FONTS in the SAS registry. See SAS Output Delivery System: Users Guide for information on changing SAS registry settings.
Arial
species the Arial font family. If SAS cannot nd the rst font listed, it tries to nd the second font listed.
sans-serif
species the san-serif font family. If SAS cannot nd the specic fonts listed, then it looks for a font in the san-serif font family.
10pt,bold
species the weight and style that should be used. In this example, if the SAS registry entry for the MTsans-serif subkey species Albany AMT, then SAS/GRAPH rst tries to use the Albany AMT 10 point bold font. If it cannot nd this font, then it tries to use Arial 10 point bold, and so on. Note: SAS might not be able to nd a specic font unless it is registered with the FONTREG procedure. The fonts provided by SAS are already registered. If you want to add additional fonts, see SAS Language Reference: Concepts for information on registering TrueType fonts. See Base SAS Procedures Guide for information on the FONTREG procedure. 4
145
with PROC TEMPLATE, as described in Using the TEMPLATE Procedure on page 140 and Example: Modifying a Style Element on page 140. For complete documentation on the style attributes that can be specied in each style element, see Style Attributes and Their Values in the section TEMPLATE Procedure: Creating a Style Denition in SAS Output Delivery System: Users Guide.
Table 10.7
Graph size and outer border OutputWidth appearance OutputHeight BorderColor BorderWidth CellPadding CellSpacing
GraphAxisLines
GraphBackground
GraphBorderLines
Border around graph wall, legend border, borders to complete axis frame All charts within the graph
Color LineThickness LineStyle Transparency BackgroundColor Gradient_Direction StartColor EndColor BackgroundImage Image VerticalAlign TextAlign
GraphCharts
146
Chapter 10
Portion of Graph Affected Text font and color for point and line labels
GraphFloor
3D oor
GraphColors("goor") Not set Not set Not set Not set Not set Not set Not set Not set GraphFonts("GraphFootnoteFont") Not set GraphColors("gtext")
GraphFootnoteText
GraphGridLines
GraphColors("ggrid") 1 1px .5 "Auto" GraphColors("ggrid") 1 1px .5 "Auto" Colors("glegend") Not set GraphColors("goutlines") 1 1px GraphFonts("GraphTitleFont") Not set GraphColors("gtext")
GraphGridLines
GraphLegendBackground
Background color of the legend Outline properties for ll areas such as bars, pie slices, and box plots. Text font and color for titles
GraphOutlines
GraphTitleText
147
Portion of Graph Affected Text font and color for axis tick values and legend values Vertical walls bounded by axes
GraphWalls
Not set GraphColors("gwalls") Not set Not set Not set Not set Not set
Table 10.8
Line contours, markers, and StartColor data labels with segmented NeutralColor range color response EndColor Gradient contours, surfaces, StartColor markers, nad data labels NeutralColor with continuous color EndColor response Line contours, markers, and StartColor data labels with segmented EndColor range color response Gradient contours, surfaces, StartColor markers, and data labels EndColor with continuous color response
ThreeColorRamp
TwoColorAltRamp
TwoColorRamp
148
Chapter 10
Table 10.9 Style Elements Affecting Device-Based Grouped Graphical Data Representation
Style Element GraphData1 Portion of Graph Affected Primitives related to 1st grouped data items. Color applies to lled areas. ContrastColor applies to markers and lines. Default Attributes Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image GraphData2 Primitives related to 2nd grouped data items Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image GraphData3 Primitives related to 3rd grouped data items Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image Attribute Values in DEFAULT Style GraphColors("gdata1") GraphColors("gcdata1") "Circle" 1 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata2") GraphColors("gcdata2") "Plus" 4 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata3") GraphColors("gcdata3") "X" 8 Not set Not set Not set Not set Not set Not set Not set
149
Default Attributes Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
Attribute Values in DEFAULT Style GraphColors("gdata4") GraphColors("gcdata4") "triangle" 5 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata5") GraphColors("gcdata5") "square" 14 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata6") GraphColors("gcdata6") "Asterisk" 26 Not set Not set Not set Not set Not set Not set Not set
GraphData5
Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
GraphData6
Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
150
Chapter 10
Default Attributes Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
Attribute Values in DEFAULT Style GraphColors("gdata7") GraphColors("gcdata7") "Diamond" 15 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata8") GraphColors("gcdata8") Not set 20 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata9") GraphColors("gcdata9") Not set 41 Not set Not set Not set Not set Not set Not set Not set
GraphData8
Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
GraphData9
Color ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
151
Default Attributes
Attribute Values in DEFAULT Style GraphColors("gdata10") GraphColors("gcdata10") Not set 42 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata11") GraphColors("gcdata11") Not set 2 Not set Not set Not set Not set Not set Not set Not set GraphColors("gdata12") GraphColors("gcdata12") Not set Not set Not set Not set Not set Not set Not set Not set Not set
Primitives related to Color 10th grouped data items ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
GraphData11
Primitives related to Color 11th grouped data items ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
GraphData12
Primitives related to Color 12th grouped data items ContrastColor MarkerSymbol LineStyle MarkerSize LineThickness Gradient_Direction StartColor EndColor BackGroundImage Image
152
Chapter 10
3 Enter OPTIONS on the SAS command line, or select Tools I Options I System to
open the SAS System Options window. Expand Graphics, and select Driver settings. Right-click on Gstyle, select Modify value, and select 0=False as the new value.
3 Specify the NOGSTYLE system option. This option turns off the use of ODS
styles. See Turning Off Styles on page 151.
3 Specify DEVICE=ZGIF on the GOPTIONS statement when you are sending output
to the HTML destination.
153
CHAPTER
11
Specifying Fonts in SAS/GRAPH Programs
Introduction: Specifying Fonts in SAS/GRAPH Programs 153 SAS/GRAPH, System, and Device-Resident Fonts 153 TrueType Fonts That Are Supplied by SAS 154 Determining What Fonts Are Available 155 Default Fonts 155 Viewing Font Specications in the SAS Registry 156 Specifying a Font 157 Specifying Font Modiers (/bold, /italic, and /unicode) 157 Using a Registry Subkey 157 Specifying International Characters (Unicode Encoding) 157 Specifying Special Characters Using Character and Hexadecimal Codes Methods For Specifying Fonts 161 Using SAS/GRAPH Global Statement Options to Specify Fonts 162 Using GOPTIONS to Specify Fonts 162 Changing The Font Specications Used By a Style 163 Precedence of Font Specications 163
158
154
Chapter 11
system fonts fonts that can be used by any SAS procedure and by other software, such as Microsoft Word. These fonts include TrueType and Type1 fonts. Examples of system fonts include Albany AMT, Monotype Sorts, and Arial. Some system fonts, such as Helvetica, can also be present as device-resident fonts. System fonts are installed on the operating system, and then registered with SAS using the FONTREG procedure. System fonts generally provide the highest quality output. SAS/GRAPH installs and registers a set of TrueType fonts, and it is recommended that you use these fonts whenever possible. See TrueType Fonts That Are Supplied by SAS on page 154 for more information. device-resident fonts fonts that are burned into the chips in a devices hardware. These fonts are specic to the device being used and are not portable between devices. Some device-resident fonts, such as Helvetica, can also be present as system fonts.
Table 11.1
Albany AMT* Cumberland AMT* Thorndale AMT* Symbol MT Monotype Sorts Monotype Sans WT J Monotype Sans WT K Monotype Sans WT SC Monotype Sans WT TC Thorndale Duospace WT J Thorndale Duospace WT K
* Albany AMT, Cumberland AMT, Thorndale AMT, Arial Symbol, and Times New Roman Symbol are font families. Normal, bold, italic, and bold italic versions of these fonts are provided.
For more information about using TrueType fonts with SAS/GRAPH, see SAS Language Reference: Concepts.
Default Fonts
155
Default Fonts
Many of the default fonts are specied in the SAS registry. See Viewing Font Specications in the SAS Registry on page 156. The SAS registry is localized, so fonts that are specied by the SAS registry are dependent on your locale. For most devices, when you are using styles (the GSTYLE system option is in effect), fonts are specied by the current style. Each style species fonts for various graph elements such as axis labels, graph titles, tick mark labels, and so on. See Modifying the GraphFonts And GraphColors Style Elements on page 141 and The GraphFonts Style Element on page 143 for more information about the font specications in the styles. See Style Attributes Versus Device Entry Parameters on page 132 for more information on the GSTYLE system option. Table 11.2 on page 156 shows the fonts used when styles are not active (the NOGSTYLE system option is in effect).
156
Chapter 11
Table 11.2
Device
GIF, JPEG, PNG, TIFF, SVG, SASBMP, SASPRTx, GIFANIM, PCL, PS, PDF BMP, ZGIF, ZPNG, ZJPEG, ZTIFF in all environments except z/OS EMF and WMF on Windows Display devices for Graph window: WIN, XCOLOR, IBMPCGX SASEMF, SASWMF, EMF and WMF in other operating environments JAVAMETA CGM, ZPCL, ZPS, ZPDF
Swiss
Font specied by <MTmonospace> subkey in the SAS registry Font specied in the Chartype 1 eld in the device entry Font specied by the device entry
The DMS font is controlled by the FONT= option on Windows, by the Xdefaults X resources on UNIX, and by the host display code on z/OS. For more information, see the SAS documentation for your operating environment. Note: In some cases, SAS/GRAPH can switch to Simulate. When styles are turned off (the NOGSTYLE system option is in effect), the only default font that is scalable is the font used for TITLE1. If the height specied for other fonts is not equal to one, then SAS/GRAPH switches to Simulate. See The SIMULATE Font on page 1644 for more information. 4 The Java and ActiveX devices ignore the NOGSTYLE system option; they always use styles. When you are using the Java and ActiveX devices (which always use styles), the fonts are determined at run time. The fonts are resolved based on the fonts available on the system where the graph is viewed. When you use the JAVA or ACTIVEX device, the fonts specied by the styles are also specied in the HTML or RTF le that is generated. When the le is viewed, if a font is not available, the font mapper on the system where the le is viewed determines the font that is substituted. See Specifying a Font on page 157 and Methods For Specifying Fonts on page 161 for information on how to override default font specications.
I Accessories Editor or by issuing the command REGEDIT in the command line. I Fonts.
I Registry
Each entry in the registry consists of a name, such as <MTsans-serif> or <MTmonospace> followed by its value, such as Albany AMT or Cumberland AMT. Note: The Fonts key contains subkeys that specify which fonts to use based on the locale. 4 For more information, see The SAS Registry in SAS Language Reference: Concepts.
157
Specifying a Font
To specify a font in your SAS program, include a font name, enclosed in quotes, anywhere fonts are supported. For example, you can specify Thorndale AMT as the font for legend labels as follows:
legend label=(font="Thorndale AMT" "Generation Source");
You can change between fonts, specify font modiers such as /bold, and specify special characters. Font names are not case-sensitive. For example, the following FOOTNOTE . statement prints
footnote font="Thorndale AMT/bold" "E=mc" font="Albany AMT" "b2"x;
species special characters using Unicode code points. See Specifying International Characters (Unicode Encoding) on page 157 for more information. Note: The /unicode modier is not supported by the Java or ActiveX devices.
Note: With the ACTIVEX and ACTXIMG devices you can specify only one modier at a time. Specifying font modiers is not supported by the JAVA or JAVAIMG devices. 4 Note: You cannot specify font modiers if you specify the font using a registry subkey. 4
The font specied by the <MTsans-serif> registry subkey will be used for the title. The SAS registry is localized. If you specify a font using a registry subkey, the actual font that is used will be the localized value specied in your registry. See also Viewing Font Specications in the SAS Registry on page 156 and Font Specications In The GraphFonts Style Element on page 144.
158
Chapter 11
For example, the following statement uses the /unicode modier and a hexadecimal code (see Specifying Special Characters Using Character and Hexadecimal Codes on page 158) to display the symbol for the Euro sign.
title "Euro Symbol" font="Albany AMT/unicode" "20ac"x;
Unicode Character Code Charts can be found on the Unicode Web site at http:// www.unicode.org/charts. See also SAS Language Reference: Concepts for information on printing international characters. The Java and ActiveX devices do not support the /unicode modier.
Hexadecimal values are any two-digit hexadecimal numbers enclosed in quotation marks, followed by the letter x. For example, 3Dx. (In double-byte character sets, the hexadecimal values contain four digits, for example, 4E60x. Unicode characters also contain four digits.) You display characters with hexadecimal values the same way that you display them with character codes. You specify the font that contains the special character and place the hexadecimal value in the text string. For example, this TITLE statement uses hexadecimal A9 to produce in the Albany AMT font.
title font="Albany AMT" "a9"x;
Note: The character code or hexadecimal value associated with characters in a font might be dependent on the key map that is currently being used. Keymaps are not used if the /unicode modier is specied, a symbol font is specied, or NOKEYMAP is specied in the font header. Contact Technical Support if you need assistance with creating or modifying key maps. 4 To determine the hexadecimal codes that you need to specify for a specic character, you can use the program shown in Example Code 11.1 on page 159. This program displays 224 characters of a font together with the hexadecimal codes for each character. As shown here, it displays the characters in the Symbol font. You can change the font displayed by this program to any font available on your system. Also, some fonts have many more characters than those displayed by the program below. Note: Some fonts, such as Albany AMT, display variations due to the national characters for that locale. Symbol fonts, such as Monotype Sorts, are not affected by
159
your locale encoding. For double-byte encodings, the second half of the table might be blank or show small rectangles. 4
Example Code 11.1 SAS Program For Displaying Hexadecimal Codes For Special Characters goptions reset=all; /***************************************************/ /* Generate the hexadecimal values. The A values */ /* do not include 0 and 1 because these values are */ /* reserved for commands in most hardware fonts. */ /***************************************************/ data one; do a="2","3","4","5","6","7","8","9","a","b","c","d","e","f"; do b="0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"; char=input(a||b,$hex3.); output; end; end; run; /***************************************************/ /* Create annotation data set to show the */ /* hexadecimal values and the corresponding font */ /* characters underneath the hexadecimal value. */ /***************************************************/ data anno; length text $2. style $ 25.; retain xsys "3" ysys "3" tempy 95 x 0 size 1.5 count 0 y 0 position "6"; set one; count = count + 1; x = x + 4; y = tempy; text = compress(a||b); style = "Albany AMT/bold"; output; y = tempy - 3; function = "label"; /* Modify this statement to use the */ /* font that you want to display. */ style = "Monotype Sorts"; text = char; output; if int(count/16) = (count/16) then do;
160
Chapter 11
x = 0; tempy = tempy - 6; end; run; /****************************************************/ /* Create the table. The symbol is shown below its */ /* hexadecimal value. For example, a circle with */ /* the number one inside is the hexadecimal value */ /* AC in the Monotype Sorts system font. To use */ /* this symbol, specify: */ /* font="Monotype Sorts" "AC"x; */ /****************************************************/ proc ganno anno=anno; run; quit;
Figure 11.1 on page 160 and Figure 11.2 on page 161 show the output of the program above for the TrueType fonts Symbol MT and Monotype Sorts.
Figure 11.1
Symbol MT Font
161
Figure 11.2
3 Many procedures support font options that enable you to specify the fonts for
certain graph elements. For example, with the GCHART procedure, you can use the FONT= suboption with the PLABEL= option to control the font for the pie slice labels. With the GKPI procedure, you can use the BFONT= option to specify the font for boundary labels. Changes specied using procedure options affect the output of the current invocation of the procedure only. For information on the font options that are available for a specic procedure, see the documentation for the procedure.
3 You can specify fonts in the AXIS, LEGEND, or SYMBOL global statements.
Fonts specied with these statements affect the output of any procedure that references those statements. See Using SAS/GRAPH Global Statement Options to Specify Fonts on page 162.
3 You can specify fonts in the GOPTIONS statement. The GOPTIONS statement is
also a global statement, and specications in the GOPTIONS statement affect all
162
Chapter 11
output in the current SAS session. Using the FTEXT= graphics option is frequently the best solution if you are dealing with any of the following situations.
3 3 3 3
You want to specify the fonts only for the current SAS session. You want to specify the fonts only for a specic application. You do not need all of your output to use the same style. You do not want your code to be dependent on registry settings or a customized style. For example, you might want to run your program as a stored process or send it to others who might not have the same registry settings.
See Using GOPTIONS to Specify Fonts on page 162. 3 If you want all of your output to use the same ODS style, you can create a new style by copying and modifying an existing style and changing the font settings. Your new style can be used for all your ODS output at your site to ensure a consistent appearance. If you always want all of your output to have a specic appearance, then modifying a style might be the best alternative. See Changing The Font Specications Used By a Style on page 163.
3 axis labels, reference line labels, and tick mark values 3 legend labels and legend value descriptions 3 contour line labels and plot point labels
For example, the following statement could be used to label contour lines:
symbol value="Deep" font="CUMBERLAND AMT/bold/italic";
See Example 2 on page 1116 for an example that uses SYMBOL statements to label contour lines. As with the options specied in the GOPTIONS statement, options specied with these global statements remain in effect until you change them or until you start a new SAS session. For specic information on each of the global statements, see Chapter 14, SAS/ GRAPH Statements, on page 195.
3 FBY= sets the BY line font in your graphs. 3 FTEXT= sets the font for all the text in your graphs. 3 FTITLE= sets the font for the rst title in your graphs.
For example, to specify Cumberland AMT for all of the text in your graphs, use
goptions ftext="Cumberland AMT";
Settings specied in the GOPTIONS statement remain in effect until you change them, until you specify reset=all, or until you close the SAS session. If you want most or all of the text in your output to use a single font, specifying this font with the FTEXT= graphics option is frequently the best alternative. Using the
163
FTEXT= option in the GOPTIONS statement instead of adding font specications to several procedure action statements in addition to other global statements makes your code easier to maintain. Note: The FBY= option is not supported by the Java or ActiveX devices. For specic information on the GOPTIONS statement, see GOPTIONS Statement on page 219. Information for specic graphics options is in Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329. 4 Note: When you are sending SAS/GRAPH output to the HTML or RTF destinations (MARKUP destinations), titles and footnotes can be rendered as part of your graph image or as part of the HTML or RTF les. Where your titles and footnotes are rendered determines the fonts that are used for them. See Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192 for information on the GTITLE and GFOOTNOTE destination options and the ODS USEGOPT statement. 4
164
165
CHAPTER
12
SAS/GRAPH Colors and Images
Using SAS/GRAPH Colors and Images 165 Specifying Colors in SAS/GRAPH Programs 166 Specifying Colors in a GOPTIONS Statement 166 Dening and Using a Color List 167 Introduction to the Color Lists 167 Using a Devices Color List 167 Building a Color List with the GOPTIONS COLORS= Option 167 Color-Naming Schemes 168 Introduction to Color-Naming Schemes 168 RGB Color Codes 169 CMYK Color Codes 169 HLS Color Codes 170 HSV (or HSB) Color Codes 172 Gray-Scale Color Codes 173 SAS Color Names and RGB Values in the SAS Registry 173 Color Naming System Values 174 Using the Color Utility Macros 175 Processing Limitations For Colors 178 Maximum Number of Colors Displayed on a Device 178 Replaying Graphs on a Device That Displays Fewer Colors 178 Specifying Images in SAS/GRAPH Programs 179 Image File Types Supported by SAS/GRAPH 179 Displaying an Image in a Graph Background 180 Displaying an Image in Graph Frame 182 Displaying Images on Data Elements 183 Displaying Images Using Annotate 185 Displaying Images using DSGI 186 Disabling and Enabling Image Output 188
166
Chapter 12
using ODS styles or you have turned styles off, you can the change these colors as described in Specifying Colors in SAS/GRAPH Programs on page 166. You can add images to your output as described in Specifying Images in SAS/GRAPH Programs on page 179.
3 specify colors in procedure action statements for any procedures that create
graphics output. For example, the CAXIS= option in the HBAR statement species a color for the response and midpoint axis lines. These options are described in the documentation for the individual procedures.
3 use options in the GOPTIONS statement that dene colors for specic graphics
elements. See Specifying Colors in a GOPTIONS Statement on page 166.
3 dene a color list with the GOPTIONS COLORS= option. See COLORS on page
342
3 specify a different style, modify an existing style, or create a custom style. See
Chapter 10, Controlling The Appearance of Your Graphs, on page 131 for more information on styles.
3 modify the color list in the device entry for the device that you want to use.
However, the colors listed in the device entry are not used unless styles are turned off. See Using a Devices Color List on page 167 and Chapter 38, The GDEVICE Procedure, on page 1125 for more information. See Precedence of Appearance Option Specications on page 139 for information on which settings take precedence when colors are set in more than one way.
167
You can also use the COLORS= option in a GOPTIONS statement to specify a list of colors rather than specic colors for individual graphical elements. Refer to Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for complete information about each of these graphics options.
168
Color-Naming Schemes
Chapter 12
You can specify colors in any color-naming schemes described in Color-Naming Schemes on page 168. Each value specied in a color list must be one of the following: 3 a valid color name, not to exceed 64 characters 3 a valid color code, not exceed eight characters Note: The COLORS= graphics option provides only a default lookup table. Any time you explicitly select any other colors in your SAS/GRAPH program, those colors are used to draw the graphical elements for which you have specied them. 4 See COLORS on page 342 for more information.
Color-Naming Schemes
Introduction to Color-Naming Schemes
The valid color-naming schemes are as follows: 3 RGB (red green blue) 3 CMYK (cyan magenta yellow black) 3 HLS (hue lightness saturation) 3 HSV (hue saturation brightness), also called HSB 3 Gray scale 3 SAS color names (from the SAS Registry) 3 SAS Color Naming System (CNS) Table 12.1 on page 168 shows examples of each color-naming scheme.
Table 12.1 Examples of Specifying Colors
Color-Naming Scheme RGB CMYK HLS HSV Gray Scale SAS Registry Colors CNS Color Names
Example COLORS=(cx98FB98 cxDDA0DD cxFFDAB9 cxDB7093 cxB0E0E6) COLORS=("FF00FF00" "00FFFF00" "FFFFFF00") COLORS=(H14055FF H0F060FF H0B485FF H07880FF) COLORS=(V0F055FF v010FFFF v03BFFFF v12C55E8) COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3) COLORS=(palegreen plum peachpuff palevioletred powderblue) COLORS=("very light purplish blue" "light vivid green" "medium strong yellow" "dark grayish green")
You can also mix color-naming schemes in the same statement, for example:
goptions colors=(cxEE0044 "vivid blue" darkgreen);
Note: Hardware characteristics of your output device might cause some colors with different color denitions to appear the same. The same color is likely to appear different on different devices and might not appear correctly on some devices. To determine whether your device supports a specic color-naming scheme, refer to your graphics device documentation. 4 Each of the color-naming schemes supported by SAS/GRAPH has its advantages and disadvantages based on how the output is used. For example, if you are creating a
Color-Naming Schemes
169
report that will be viewed online only, then specifying colors using the RGB naming scheme or the SAS color names dened in the registry might produce better results. If you are creating a report for publishing in printed form, you might want to use the CMYK color-naming scheme. The color utility macros enable you to create colors for a specic color-naming scheme. These macros convert color values between color-naming schemes. See Using the Color Utility Macros on page 175. Note: Invalid color names, such as a misspelled color name, are mapped to gray, and a NOTE is issued to the SAS log. A valid color name that is not supported by the current device is mapped to the closest color that is supported by the device. 4
3 3 3 3
CX indicates to SAS that this is an RGB color specication. rr is the red component. gg is the green component. bb is the blue component.
The components are given as hexadecimal numbers in the range 00 through FF (0% to 100%), where lower values are darker and higher values are lighter. This scheme allows for up to 256 levels of each color component (over 16 million different colors).
Table 12.2
Color red green blue white black
Any combination of the color components is valid. Some combinations match the colors produced by predened SAS color names. See Using the SAS Registry to Control Color in SAS Language Reference: Concepts for information on viewing the RGB combinations that match predened SAS color names.
170
Color-Naming Schemes
Chapter 12
To specify the colors from a printers Pantone Color Look-Up Table, you can use the CMYK color-naming scheme. Specify colors in terms of their cyan, magenta, yellow, and black components. Color names are of the form ccmmyykk, where the following is true:
3 3 3 3
cc is the cyan component. mm is the magenta component. yy is the yellow component. kk is the black component.
The components are given as hexadecimal numbers in the range 00 through FF, where higher values are darker and lower values are brighter. This scheme allows for up to 256 levels of each color component. Quotation marks are required when the color value starts with a number instead of a letter.
Table 12.3
Color red green blue white
process black (using cyan, magenta, and yellow ink) pure black (using only black ink)
Note: You can specify a CMY value by making the kk, the colors black component, zero (00). 4 CMYK color specications are for devices that support four colors. If a CMYK color is used on a three-color device, the device processes the color specication. The resulting colors might not be as expected. Different CMYK colors might map to the same device color because a four-color space supports more colors than a three-color space.
3 3 3 3
H indicates that this is an HLS color specication. hhh is the hue component. ll is the lightness component. ss is the saturation component.
The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the lightness and saturation components are hexadecimal and scaled to a range of 0 to 255 expressed with values of 00 through FF (0% to 100%). Thus, they provide 256 levels for each component.
Color-Naming Schemes
171
Table 12.4
Color red green blue light gray white* black*
* When the saturation is set to 00, the color is a shade of gray that is determined by the lightness value. Therefore, white is dened as HxxxFF00 and black as Hxxx0000, where xxx can be any hue.
172
Color-Naming Schemes
Chapter 12
Figure 12.1
3 3 3 3
V indicates that this is an HSV color specication. hhh is the hue component. ss is the saturation component. vv is value or brightness component.
The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the saturation and value (brightness) components are hexadecimal, scaled to a
Color-Naming Schemes
173
range of 0 to 255, and expressed with values of 00 through FF. Thus, they provide 256 levels for each component.
Table 12.5
Color red green blue light gray* white* black*
* When the saturation is set to 00, the color is a shade of gray. The value component determines the intensity of gray level. The xxx can be any hue.
Table 12.6
Color white light gray dark gray black
SAS prints the output in the SAS log. You can also create your own color values by adding them to the registry. For more information on viewing and modifying the list of color names, see Using the SAS Registry to Control Color in SAS Language Reference: Concepts.
174
Color-Naming Schemes
Chapter 12
Table 12.7
Lightness Black Very Dark Dark Medium Light Very Light White
Follow these rules when you are determining the CNS color name:
3 The lightness values black and white should not be used with saturation or hue
values.
3 If not specied, medium is the default lightness value and vivid is the default
saturation value.
3 Gray is the only saturation value that can be used without a hue. 3 Unless the color you want is black, white, or some form of gray, you must specify
at least one hue. One or two hue values can be used in the CNS color name. When using two hue values, the hues must be adjacent to each other in the following list: blue, purple, red, orange/brown, yellow, green, and then returning to blue. When two hues are used, the resulting color is a combination of both colors. Use the sufx ish to reduce the effect of a hue when two hues are combined. Reddish purple is less red than red purple. If you are using a color with an ish sufx, this color must precede the color without the ish sufx. Color names can be written in the following ways:
3 without space separators between words 3 with an underscore to separate words 3 with a space to separate words, enclosed in quotation marks
For example, the following are all valid color specications:
3 Include a space to separate the words. 3 Enclose the entire color name in quotation marks.
Color-Naming Schemes
175
Table 12.8
Use...
When the color utility macros are invoked, the calculated color value is directed to the SAS log. The calculated color can also be used to perform in-place substitutions in the code.
Table 12.9 %CMY(cyan, magenta, yellow);
Usage Example Entering the following code into your Program Editor: %COLORMAC; data _null_; put "%CMY(100,0,100)"; run; Returns the RGB value CX00FF00 which is green.
Description Replace cyan, magenta, yellow with numeric values to create an RGB color value. The numeric values that are used in place of cyan, magenta, yellow indicate the percentage of each color to be included in the RGB value.
176
Color-Naming Schemes
Chapter 12
Table 12.10
Description
Replace cyan, magenta, yellow, black with numeric values to create a CMYK color value. The numeric values that are used in place of cyan, magenta, yellow, black indicate the percentage of each color to include in the CMYK color value. See CMYK Color Codes on page 169 for more information on the color value produced by using this macro.
Note: In the PUT statement, %CMYK(cyan, magenta, yellow, black), should not be placed in quotations. 4
Table 12.11
Description
%CNS (colorname);
Usage Example Entering the following code into your Program Editor: %COLORMAC; data _null_; put "%CNS(GRAYISH REDDISH PURPLE)"; run; Returns the HLS value H04B8040 which is grayish reddish purple.
Replace colorname with a color-naming scheme color name to create an HLS color value. See HLS Color Codes on page 170 for more information on HLS color values. For more information on valid color-naming scheme color names see Color Naming System Values on page 174 or enter the following into the command-line of the Program Editor: %HELPCLR(CNS);
Note: The %CNS macro accepts only CNS color names where a space is used to separate the words in the color name. 4
Color-Naming Schemes
177
178
Chapter 12
Table 12.16
Description
%RGB2HLS(rgb);
Usage Example Entering the following code into your Program Editor: %COLORMAC; data _null_; put "%RGB2HLS(CX9F5F8F)"; run; Returns the HLS value H04C7F40 which is grayish reddish purple.
Replace rgb with an RGB color value to create an HLS color value. See RGB Color Codes on page 169 and HLS Color Codes on page 170 for more information.
Note: Round-trip conversions using the HLS2RGB and RGB2HLS macros might produce ultimate output values that differ from the initial input values. For example, converting CXABCDEF (a light blue) using %RGB2HLS produces H14ACDAD. Converting this value back to RGB using %HLS2RGB returns CXAACCEE. While not identical, the colors are very similar on the display, and when printed. 4 For additional information on color-naming schemes. See Effective Color Displays: Theory and Practice by David Travis and Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, and Hughes.
179
3 Colors are specied that the device does not support. 3 More colors are specied than the device can display at one time.
If you specify colors on a device that does not support the colors requested, the colors are remapped to gray. A note is issued to the SAS log telling you when a color is mapped gray. The number of colors that your device can display affects the actual colors displayed. If your graphics output device can create a maximum of 64 distinct colors, and your graph contains 256 colors, then the 65th through the 256th color specications are remapped to the colors specied in the current style. If the NOGSTYLE system option is in effect, the colors are remapped to the devices available colors and might not display as the color you specify. You can use the TARGETDEVICE= graphics option to preview the way a graph is going to look on a different device. Set the device entry name of the device driver to this graphics option. The graph is displayed as close as possible to the display when the other device is used. Note: When you use the TARGETDEVICE= graphics option, SAS/GRAPH uses the color list of the target device as the default color list; any color that you explicitly use is displayed when you preview the graph, although the color might be mapped by the target device. Refer to TARGETDEVICE on page 426 for complete information about the TARGETDEVICE= graphics option. 4
DIB (Microsoft Windows Device Independent Bitmap) GIF (Graphics Interchange Format) JPEG (Joint Photographic Experts Group)
180
Chapter 12
Description supports gray, color, RGB, and bitmap les. The Portable Bitmap Utilities is a set of free utility programs that were primarily developed by Jeff Poskanzer. Kodak Photo CD format which supports multiple image resolutions. supports bitmap, color-mapped, and true color images. PCX and PC Paintbrush are owned by Zsoft Corporation. supports truecolor, gray-scale, and 8-bit images. supports true color images. Targa is owned by Truevision, Inc. internally supports a number of compression types and image types, including bitmap, color-mapped, gray-scale, and true color. TIFF was developed by Aldus Corporation and Microsoft Corporation. supports bitmap images only. XBM is owned by MIT X Consortium. supports all X visual types (bitmap, color-mapped, and true color.) XWD is owned by MIT X Consortium.
PNG (Portable Network Graphic) TGA (Targa) TIFF (Tagged Image File Format)
For example, the following program creates a pie chart with a background image:
goptions reset=all htitle=1.25 colors=(cx7c95ca cxde7d6f cx66ada0 cxb689cd cxa9865b cxbabc5c) iback="external-image-file"; title "Projected Automobile Sales"; data sales; input Month Amount; informat month monyy.; datalines; jan08 200 feb08 145 mar08 220 apr08 180 may08 155
181
jun08 250 ; proc sort; by month; proc gchart; format month monname8.; pie month / discrete freq=amount value=inside noheading coutline=black; run; quit;
Because the default value for the IMAGESTYLE= graphics option is TILE, the image is copied as many times as needed to ll the background area.
You can specify IMAGESTYLE=FIT in the GOPTIONS statement to stretch the image so that a single image ts within the entire background area.
182
Chapter 12
For example, the following program creates a vertical bar chart and adds an image to the graph frame:
goptions reset=all htitle=1.25 colors=(yellow cxde7d6f); title "Projected Automobile Sales"; data sales; input Month Amount; informat month monyy.; datalines; jan08 200 feb08 145 mar08 220 apr08 180 may08 155 jun08 250 ; proc sort; by month; proc gchart; format month monname8.; vbar month / discrete freq=amount inside=freq coutline=black iframe="external-image-file"; run;
183
quit;
Because the default value for the IMAGESTYLE= graphics option is TILE, the image is copied as many times as needed to ll the frame area.
You can specify IMAGESTYLE=FIT in the GOPTIONS statement to stretch the image so that a single image ts within the entire frame area.
184
Chapter 12
On the IMAGE= option of the PATTERN statement, specify either the path to the image le in quotation marks or a leref that has been dened to point to the image le.
pattern image=fileref | "external-image-file";
By default, the image is tiled on the bar, which means that the image is copied as many times as needed to ll each bar. Specify IMAGESTYLE=FIT in the PATTERN statement to stretch the image as needed to ll each bar.
pattern image="external-image-file" imagestyle=fit;
To tile subsequent images, reset the PATTERN statement or by specify IMAGESTYLE=TILE. Note: Images are supported on bar charts generated by the HBAR and VBAR statements. If an image is specied on a PATTERN statement that is used with another type of chart, then the PATTERN statement is ignored and default pattern rotation is affected. If you submit a PIE statement when an image has been specied in the PATTERN= option, the default ll pattern is used for the pie slices. Each pie slice displays the same ll pattern. 4 The following example places an image on the bars of a vertical bar chart:
goptions reset=all htitle=1.25 colors=(yellow cxde7d6f); title "Projected Automobile Sales"; data sales; input Month Amount; informat month monyy.; datalines; jan08 200 feb08 145 mar08 220 apr08 180 may08 155 jun08 250 ; proc sort; by month; pattern1 image="external-image-file"; proc gchart; format month monname8.; vbar month / discrete freq=amount inside=freq coutline=black; run; quit;
185
If the PATTERN IMAGESTYLE=FIT option is used, the image is stretched to ll each bar.
pattern=fileref | "external-image-file" imagestyle=fit;
3 Specify the image le in quotation marks on the IMGPATH variable. 3 Set the image coordinates with the X and Y variables. 3 Specify the IMAGE function.
186
Chapter 12
One corner of the image is located by the current X and Y position. The opposite corner is located by the X and Y variables associated with the IMGPATH variable.
goptions reset=all border htitle=1.25 hsize=5.5in vsize=4.2in; data my_anno; length function $8; xsys="3"; ysys="3"; when="a"; function="move"; x=55; y=55; output; function="image"; style="fit"; imgpath="external-image-file"; x=x+15; y=y+18; output; run; title1 "GMAP with Annotated Image"; proc gmap data=maps.us map=maps.us anno=my_anno; id state; choro state/ levels=1 nolegend statistic=freq; run; quit;
The style="fit" variable on the IMAGE function stretches the image as needed to ll the area.
To tile the image to ll the area, set the STYLE variable equal to "tile".
187
This code displays the image in the screen coordinates (20, 20) to (40, 40). The last parameter, FIT, indicates how to display the image.
rc=gdraw("image", "external-image-file", 20, 20, 40, 40, "fit");
Image File Types Supported by SAS/GRAPH on page 179 shows the supported image le formats.
goptions reset=all ftext="Albany AMT/bold" htitle=1.25 hsize=5.5in vsize=4.2in; title "DSGI with Image"; data image; rc=ginit(); rc=graph("clear"); rc=gdraw("image","external-image-file", 5, 5, 90, 90,"tile"); rc=graph("update"); rc=gterm(); run; quit;
If you specify the TILE keyword for the GDRAW(IMAGE,...) function, the image is copied as many times as needed to ll the specied area.
rc=gdraw("image","external-image-file", 5, 5, 90, 90,"tile");
If you specify the FIT keyword for the GDRAW(IMAGE,...) function, the image is stretched to t within the entire area.
rc=gdraw("image","external-image-file", 5, 5, 90, 90,"fit");
188
Chapter 12
To enable image output, reset the GOPTIONS statement or specify the IMAGEPRINT graphics option.
goptions imageprint;
189
CHAPTER
13
Managing Your Graphics With ODS
Introduction 189 Managing ODS Destinations 189 Specifying a Destination 190 ODS Destination Statement Options 190 ODS and Procedures that Support RUN-Group Processing 192 Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output Controlling Where Titles and Footnotes are Rendered 192 Controlling the Text Font, Size, and Color 193 Using Graphics Options with ODS (USEGOPT) 193
192
Introduction
The Output Delivery System (ODS) manages all output created by procedures and enables you to display the output in a variety of forms, such as HTML, PDF, and RTF. The ODS destination statements provide options for control of many relevant features.
190
Specifying a Destination
Chapter 13
Table 13.1
Printer for PDF Embedded PNG and PS, monochromePrinter for PCL RTF Embedded PNG
RTF
200
Measured RTF
RTF
Embedded
200
Specifying a Destination
To generate output from SAS, a valid ODS destination must be open. By default, the LISTING destination is open. You can use an ODS destination statement, such as ODS HTML, to open a different destination. You can also specify options, such as the HTML lename or the path to an output directory, on the ODS destination statement. ODS destination < option(s);> The options available vary with the destination that is specied.
191
3 species that other output les (for example, the HTML le) be written to the
directory C:\myfiles\
3 species that the name of the initial HTML le that is displayed is barGraph.htm 3 changes the style to Analysis.
ods html path="c:\myfiles\" gpath="c:\myfiles\images" (url="http://www.sas.com/images/") body="barGraph.htm" style=analysis;
The following ODS HTML statement species that the output is sent to the HTML destination. Because it does not specify either the PATH= or GPATH= options, all output is sent to the default SAS folder.
ods html body="barGraph.html";
The HTML output is written to the le specied by the BODY= option, barGraph.html. At start up, the SAS current folder is the same directory in which you start your SAS session. If you are running SAS with the windowing environment in the Windows operating system, then the current folder is displayed in the status bar at the bottom of the main SAS window. If you do not specify a lename for your output, then SAS provides a default le that is determined by the ODS destination. This le is saved in the SAS current folder. You can check the SAS log to verify the name of the le in which your output is saved. For complete documentation on ODS destinations, see SAS Output Delivery System: Users Guide. Options that you might want to specify on ODS destination statements are the following: GPATH= location (URL= UniformResourceLocator | NONE) species the location for all graphics output that is generated while the destination is open. You can specify an external le or a leref. You can use the URL= suboption to specify a URL that is used in links and references to output les. The GPATH= option is valid for the Listing destination and the Markup family of destinations. If the GPATH option is not specied, the images are written to the location specied by the PATH option. For complete documentation on GPATH= option, see the ODS LISTING statement and the ODS MARKUP statement in SAS Output Delivery System: Users Guide. species the location of an external le or a SAS catalog for all markup les. You can specify an external le or a leref. You can use the URL= suboption to specify a URL that is used in links and references to output les. The PATH= option is valid for the RTF, Measured RTF, and Markup family of destinations. If the PATH option is not specied, images are written to the current working directory. For complete documentation on PATH= option, see the ODS LISTING statement, ODS MARKUP statement, or TAGSET.RTF statement in SAS Output Delivery System: Users Guide. species the image resolution in DPI for the output images sent to PRINTER family destinations. The default value for the PRINTER destination is 150. For complete documentation on the DPI= option, see the valid ODS PRINTER statement in SAS Output Delivery System: Users Guide.
DPI=
192
Chapter 13
STYLE= style-denition
species a style to be used for the output. Each ODS destination has a default style for the formatting of output. The style species a collection of visual attributes that are used for the rendering of the output. The STYLE= option is valid for all ODS destinations except the Document destination and the Output destination. For complete documentation on the STYLE= option, see the ODS statements in SAS Output Delivery System: Users Guide. For more information on using the STYLE= option with SAS/GRAPH output, see Chapter 10, Controlling The Appearance of Your Graphs, on page 131.
Note: If you specify the PATH= or GPATH= options, the directory name that you specify is used to refer to images that are generated as part of your output. For example, if you are sending output to the HTML destination, and you specify path="C:\myfiles\", then all HTML image tags use that path to refer to your images:
<img src="C:\myfiles\myoutput.png">
If your browser implements strict security regarding access to local les, you might have problems viewing the images. You can avoid these problems by specifying the URL= suboption. 4
Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output
When you use ODS to send your graphs to an HTML destination, you can choose whether titles and footnotes are rendered as part of the HTML body le, as they are with tabular output, or the graphical image that appears in the Web page. Where titles and footnotes are rendered determines how you control their font, size, and color.
193
/* direct titles and footnotes to the HTML file */ ods html body="filename.htm" nogtitle nogfootnote;
If the title or footnote is being output through an ODS markup destination (such as HTML) and the corresponding ODS option NOGTITLE or NOGFOOTNOTE is specied, then the title or footnote is rendered in the body of the HTML le rather than in the graphic itself. Specifying NOGTITLE or NOGFOOTNOTE results in increasing the amount of space allowed for the procedure output area, which can result in increasing the size of the graph. Space that would have been used for the title or footnote is devoted instead to the graph. You might need to be aware of this possible difference if you are using annotate or map coordinates.
statement. For more information, see Using Graphics Options with ODS (USEGOPT) on page 193.
3 SAS looks for information specied in the current style.
When titles and footnotes are rendered as part of the graphic image, SAS looks rst for options on the TITLE and FOOTNOTE statement and then for options in the GOPTIONS statement. When titles and footnotes are rendered as part of the graphic image, you do not need to specify the ODS USEGOPT statement. When titles and footnotes are rendered as part of the body of the HTML le, font sizes that are specied as a percentage are interpreted as a percentage of the size specied by the current style. When titles and footnotes are rendered as part of the image, fonts sizes that are specied as a percentage are interpreted as a percentage of graphics output area. For more information about specifying fonts and font sizes, refer to
3 3 3 3
FTEXT on page 365 and FTITLE on page 365 HTEXT on page 387 and HTITLE on page 387 GUNIT on page 380 TITLE, FOOTNOTE, and NOTE Statements on page 278.
3 3 3 3 3 3
194
Chapter 13
For example, the following code generates two graphs. The title for the rst graph uses the text color and font as dened by the current style (ASTRONOMY). The title for the second graph uses the font size and color specied by the HTITLE and CTEXT options.
ods html file="myout.htm" style=astronomy; goptions reset=all dev=activex htitle=8 ctext="black"; ods nousegopt; title "My title"; footnote "My footnote"; proc gchart data=sashelp.class; pie age / discrete legend; run; ods usegopt; pie age / discrete legend; run; quit; ods nousegopt; ods html close;
While ODS USEGOPT is in effect, the settings for these graphics options affect all of the titles and footnotes rendered by ODS. To turn off the use of these graphics option settings for non-graphic output, specify the ODS NOUSEGOPT statement. The default setting is ODS NOUSEGOPT.
195
CHAPTER
14
SAS/GRAPH Statements
Overview 195 AXIS Statement 196 BY Statement 214 FOOTNOTE Statement 218 GOPTIONS Statement 219 LEGEND Statement 223 NOTE Statement 236 ODS HTML Statement 237 PATTERN Statement 238 SYMBOL Statement 250 TITLE, FOOTNOTE, and NOTE Statements 278 Example 1. Ordering Axis Tick Marks with SAS Date Values 294 Example 2. Specifying Logarithmic Axes 296 Example 3. Rotating Plot Symbols Through the Color List 299 Example 4. Creating and Modifying Box Plots 301 Example 5. Filling the Area between Plot Lines 304 Example 6. Enhancing Titles 307 Example 7. Using BY-group Processing to Generate a Series of Charts 309 Example 8. Creating a Simple Web Page with the ODS HTML Statement 313 Example 9. Combining Graphs and Reports in a Web Page 315 Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web 321 Details 325 Building an HREF value 325 Creating an image map 326 Referencing SAS/GRAPH Output 326
Overview
SAS/GRAPH programs can use some of the SAS language statements that you typically use with the Base SAS procedures or with the DATA step, such as LABEL, WHERE, and FORMAT. These statements are described in the SAS Language Reference: Dictionary. In addition, SAS/GRAPH has its own set of statements that affect only graphics output generated by the SAS/GRAPH procedures and the graphics facilities Annotate and DSGI. Most of these statements are global statements. That is, they can be specied anywhere in your program and remain in effect until explicitly changed or canceled. These are the SAS/GRAPH global statements: AXIS modies the appearance, position, and range of values of axes in charts and plots.
196
AXIS Statement
Chapter 14
FOOTNOTE adds footnotes to graphics output. This statement is like the TITLE statement and is described in that section. GOPTIONS submits graphics options that control the appearance of graphics elements by specifying characteristics such as colors, ll patterns, fonts, or text height. Graphics options can also temporarily change device settings. LEGEND modies the appearance and position of legends generated by procedures that produce charts, plots, and maps. NOTE adds text to the graphics output. This statement is an exception because it is not global but local, meaning that it must be submitted within a procedure. Otherwise, the NOTE statement is like the TITLE statement and is described in that section. PATTERN controls the color and ll of patterns assigned to areas in charts, maps, and plots. SYMBOL species the shape and color of plot symbols as well the interpolation method for plot data. It also controls the appearance of lines in contour plots. TITLE adds titles to graphics output. The section describing the TITLE statement includes the FOOTNOTE and NOTE statements. The above statements are described in this chapter, as well as the following two Base language statements that have a special effect when used with SAS/GRAPH procedures: BY processes data according to the values of a classication (BY) variable and produces a separate graph for each BY-group value. This statement is not a global statement. It must be specied within a DATA step or a PROC step. ODS HTML generates one or more les written in Hypertext Markup Language (HTML). If you use it with SAS/GRAPH procedures, you can specify one of the device drivers GIF, ACTIVEX, or JAVA. ACTIVEX and JAVA are available only with GCHART, GCONTOUR, GMAP, GPLOT, and G3D. With the GIF device driver, the graphics output is stored in GIF les. With the ACTIVEX device driver, graphics output is stored as XML input to ActiveX controls. With the JAVA device driver, graphics output is stored as XML input to Java applets. The HTML les that are generated reference the graphics output. When viewed with a Web browser, the HTML les can display graphics and non-graphics output together on the same Web page. For more information on the BY, LABEL, OPTIONS, and WHERE statements in Base SAS software, see SAS Language Reference: Dictionary.
AXIS Statement
Controls the location, values, and appearance of the axes in plots and charts.
Used by:
SAS/GRAPH Statements
AXIS Statement
197
Restriction:
For the G3D procedure, the AXIS statement is supported by the JAVA and ActiveX devices only.
Type: Global
Syntax
AXIS< 1...99> <options>; option(s) can be one or more options from any or all of the following categories:
3 appearance options:
COLOR=axis-color LENGTH=axis-length <units > NOBRACKETS NOPLANE OFFSET=(<n1 ><,n2 >)<units > | (<n1<units>><,n2<units >>) ORIGIN=(<x><,y >)<units> | (<x<units >><,y<units>>) STAGGER STYLE=line-type WIDTH=thickness-factor
3 text options:
LABEL=(text-argument(s) )| NONE REFLABEL=(text-argument(s) )| NONE SPLIT=split-char VALUE=(text-argument(s) )| NONE
Description
AXIS statements specify the following characteristics of an axis:
3 3 3 3
the way the axis is scaled how the data values are ordered the location and appearance of the axis line and the tick marks the text and appearance of the axis label and major tick mark values
AXIS denitions are used only when they are explicitly assigned by an option in a procedure that produces graphs with axes. Figure 14.1 on page 198 illustrates the terms associated with the various parts of axes.
198
AXIS Statement
Chapter 14
Figure 14.1
Parts of Axes
Options
When the syntax of an option includes units, use one of these: CELLS CM IN PCT PT character cells centimeters inches percentage of the graphics output area points
COLOR=axis-color species the color for all axis components (the axis line, all tick marks, and all text) unless you include a more explicit AXIS statement color specication. The following table lists the SAS/GRAPH statement options that can be used to override the COLOR= specication. The table also lists the name of the style reference associated with each of the options.
Table 14.1
Graph Element
Style Reference
axis label
GraphLabelText
reference-line labels
GraphValueText
SAS/GRAPH Statements
AXIS Statement
199
Graph Element
Style Reference
all axis text (AXIS label and major tick mark value descriptions)
GraphLabelText
CAXIS=
GraphAxisLines
If you omit all color options, the AXIS statement looks for a color specication in this order:
1 The CTEXT= graphics option in a GOPTIONS statement. 2 If the CTEXT= option is not used, the color of all axis components is the color
C=
Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on
page 294 INTERVAL=EVEN | UNEVEN | PARTIAL The INTERVAL option affects the LOGBASE option in the AXIS statement. Specifying the option INTERVAL=UNEVEN and LOGBASE=10, permits non-base10 values to be specied for the ORDER option, while retaining a logarithmic scale for the axis. Note: PARTIAL is an alias for UNEVEN. They have the same effect.
Restriction:
LABEL=(text-argument(s)) | NONE modies an axis label. Text-argument(s) denes the appearance or the text of an axis label, or both. NONE suppresses the axis label. Text-argument(s) can be one or more of these: text-string provides up to 256 characters of label text. By default, the text of the axis label is either the variable name or a previously assigned variable label. Enclose each string in quotes. Separate multiple strings with blanks. text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be ANGLE=degrees COLOR=text-color FONT=font | NONE HEIGHT=text-height <units > JUSTIFY=LEFT | CENTER | RIGHT ROTATE=degrees See Text Description Suboptions on page 208 for a complete description. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
200
AXIS Statement
Chapter 14
Color attribute of the GraphLabelText style element Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294, Example 2. Specifying Logarithmic Axes on page 296 , and Example 7. Using BY-group Processing to Generate a Series of Charts on page 309 Restriction: Partially supported by Java and ActiveX.
Style Reference:
LENGTH=axis length <units > species the length of the axis in number of units. If you request a length that cannot t the display, a warning message is written to the log and your graph may produce unexpected results. This option is not supported by the GRADAR Procedure. Style Reference: Color attribute of the GraphLabelText graph element. Restriction: Not supported by Java. Featured in: Example 2. Specifying Logarithmic Axes on page 296 and Example 9. Combining Graphs and Reports in a Web Page on page 315 . LOGBASE=base | E | PI scales the axis values logarithmically according to the value specied. Base must be greater than 1. The number of minor tick marks is a function of the logbase, and is calculated as the logbase minus 2. For example, if logbase=10, there are 8 minor tick marks. If logbase=2, then there are no minor tick marks. Because the value of logbase=e (2.718281828) is so close to 2, it also results in no minor tick marks. How the values are displayed on the axis depends on the LOGSTYLE= option. For example, LOGBASE=10 with the default LOGSTYLE=EXPAND generates an axis like the one in Figure 14.2 on page 200.
Figure 14.2
NUM e ** 4 e ** 3 e ** 2 e ** 1 e ** 0
This option is not supported by the GRADAR Procedure. Featured in: Example 2. Specifying Logarithmic Axes on page 296 Restriction: Not supported by Java LOGSTYLE=EXPAND | POWER species whether the values displayed on the logarithmic axis are the values of the base or the values of the power. LOGSTYLE= is meaningful only when you use LOGBASE=.
SAS/GRAPH Statements
AXIS Statement
201
LOGSTYLE=EXPAND species that the values displayed are the values of the base raised to successive powers and that the minor tick marks are logarithmically placed. For example, if the base is 10, the values displayed are 10, 100, 1000, 10000, and so on. The default is LOGSTYLE=EXPAND. This statement generates an axis like the one in part (a) of Figure 14.3 on page 201:
axis logbase=10 logstyle=expand;
LOGSTYLE=POWER species that the values displayed are the powers to which the base is raised (for example, 1, 2, 3, 4, 5, and so on). For example, this statement generates an axis like the one in part (b) of Figure 14.3 on page 201:
axis logbase=10 logstyle=power;
Figure 14.3
NUM 100000 10000 1000 100 10
If you use the ORDER= option with a logarithmic axis, the values specied by the ORDER= option must match the style specied by the LOGSTYLE= option. For example, if you specify a logarithmic axis with a base of 2 and you want to display the rst ve expanded values, use this statement:
axis logbase=2 logstyle=expand order=(2 4 8 16 32);
If you use LOGSTYLE=POWER, the values in the ORDER= option must represent the powers to which the base is raised, as in this example:
axis logbase=2 logstyle=power order=(1 2 3 4 5);
If the values that are specied by ORDER= do not match the type of values specied by LOGSTYLE=, the request for a logarithmic axis is ignored. This option is not supported by the GRADAR Procedure. Featured in: Example 2. Specifying Logarithmic Axes on page 296 Restriction: Not supported by Java MAJOR=(tick-mark-suboption(s) )| NONE modies the major tick marks. Tick-mark-suboption(s) denes the color, size, and number of the major tick marks. NONE suppresses all major tick marks, although the values represented by those tick marks are still displayed. Tick-mark-suboption can be COLOR=tick-color HEIGHT=tick-height <units > NUMBER=number-of-ticks
202
AXIS Statement
Chapter 14
WIDTH=thickness-factor See Tick Mark Description Suboptions on page 212 for complete descriptions. List all suboptions and their values within the parentheses. AXIS denitions assigned to the group axis of a bar chart by the GAXIS= option ignore MAJOR= because the axis does not use tick marks. Note: By default, tick marks are now placed at three intervals on the spokes of a GRADAR chart. They are placed at the minimum value, maximum value, and at one value in between. The tick marks on the 12 oclock spoke are also labeled by default. HEIGHT is not supported by Java or ActiveX. WIDTH is not supported by Java. 4 Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294 , Example 2. Specifying Logarithmic Axes on page 296, and Example 7. Using BY-group Processing to Generate a Series of Charts on page 309 Restriction: Partially supported by Java and ActiveX
Featured in:
MINOR=(tick-mark-suboption(s) )| NONE modies the minor tick marks that appear between major tick marks. Tick-mark-suboption(s) denes the color, number, or size of the minor tick marks. NONE suppresses all minor tick marks. Tick-mark-suboption can be COLOR=tick-color HEIGHT=tick-height <units > NUMBER=number-of-ticks WIDTH=thickness-factor See Tick Mark Description Suboptions on page 212 for complete descriptions. List all suboptions and their values within the parentheses. AXIS denitions assigned to the group axis of a bar chart by the GAXIS= option ignore MINOR= because the axis does not use tick marks. This option is not supported by the GRADAR Procedure. HEIGHT is not supported by Java or ActiveX.
Featured in:
Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294, Example 2. Specifying Logarithmic Axes on page 296, and Example 7. Using BY-group Processing to Generate a Series of Charts on page 309 Partially supported by Java and ActiveX
Restriction:
NOBRACKETS suppresses the printing of group brackets drawn around the values on the group axis in a bar chart. NOBRACKETS applies only to the group axis of bar charts. This option is not supported by the GRADAR Procedure.
See also:
NOPLANE removes either the horizontal or vertical three-dimensional axis plane in bar charts produced by the HBAR3D and VBAR3D statements. NOPLANE affects only the axis to which the AXIS statement applies. To remove selected axis elements such as lines, values or labels, use specic AXIS statement options. To remove all axis elements except the three-dimensional planes use the NOAXIS option in the procedure. To remove the backplane, use the NOFRAME option in the procedure. This option is not supported by the GRADAR Procedure.
Featured in:
SAS/GRAPH Statements
AXIS Statement
203
OFFSET=(<n1><,n2>)<units > | (<n1<units>><,n2<units>>) species the distance from the rst and last major tick marks or bars to the ends of the axis line. The value of (n1) is the distance from the beginning (origin) of the axis line to the rst tick mark or middle of the rst bar. The value of (n2) is the distance from the end of the axis line to the last tick mark or middle of the last bar. On a horizontal axis, the (n1) offset is measured from the left end of the axis line and the (n2) offset is measured from the right end. On a vertical axis, the (n1) offset is measured up from the bottom of the axis line and the (n2) offset is measured down from the top of the line. To specify the same offset for both n1 and n2, use one value, with or without a following comma. For example, either option sets both n1 and n2 to 4 centimeters:
offset=(4 cm) offset=(4 cm,)
To specify different offsets, use two values, with or without a comma separating them. For example:
offset=(4 cm, 2 cm)
To specify only the second offset, use only one value preceded by a comma. This option offsets the last major tick mark or bar three centimeters from the right-hand end of the axis line:
offset=(,3 cm)
You can specify units for the n1,n2 pair or for the individual offset values. This option is not supported by the GRADAR Procedure.
Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on
page 294
Restriction:
ORDER=(value-list ) species the order in which data values appear on the axis. The values specied by the ORDER= option are the major tick mark values. You can modify the appearance of these values with the VALUE= option. The way you specify value-list depends on the type of variable:
204
AXIS Statement
Chapter 14
If the specied range is not evenly divisible by the increment value, the highest value displayed on the axis is the last incremental value below the ending value for the range. For example, this value list produces a maximum axis value of 9:
order=(0 to 10 by 3)
Observations can be inadvertently excluded if entries in the value-list are misspelled or if the case does not match exactly. 3 For date and time values, value-list can have the following forms: SAS-valuei <...SAS-valuei> SAS-valuei TO SAS-valuei <BY interval> SAS-valuei is any SAS date, time, or datetime value described for the SAS functions INTCK and INTNX. Enclose the value in quotes and specify one of the following for i: D T DT date time datetime
interval is one of the valid arguments for the INTCK or INTNX functions. These are the default intervals: DAY SECOND default interval for date default interval for time
DTSECOND default interval for datetime These value lists use SAS date and time values:
order=("25MAY98"d "04JUL98"d "07SEP98"d) order=("01JUL97"d to "01AUG97"d) order=("01JUL97"d to "01JAN98"d by week) order=("9:25"t to "11:25"t by minute) order=("04JUN97:12:00:00"dt to "10JUN97:12:00:00"dt by dtday)
With SAS date and time values, use a FORMAT statement so that the tick mark values have an understandable form. For more information on SAS date and time values, see the SAS Language Reference: Dictionary. With any type of value-list, specifying values that are not distributed uniformly or are not in ascending or descending order, generates a warning message in the SAS log. The specied values are spaced evenly along the axis even if the values are not distributed uniformly.
SAS/GRAPH Statements
AXIS Statement
205
Using the ORDER= option to restrict the values displayed on the axis can result in clipping. For example, if the data range is 1 to 10 and you specify ORDER=(3 TO 5), only the data values from 3 to 5 appear on the plot or chart. For charts, the omitted values are still included in the statistic calculation. Note: Values out of range do not always produce a warning message in the SAS log. 4 CAUTION:
The ORDER= option does not calculate midpoint values; as a result it is not interchangeable with the MIDPOINTS= option in the GCHART procedure. 4
You can use the ORDER= option to specify the order in which the midpoints are displayed on a chart, but do not use it to calculate midpoint values. Make sure that the values you specify match the midpoint values that are calculated either by default by the GCHART procedure or by the MIDPOINTS= option. For details, see the description of the MIDPOINTS= option for the appropriate statement in Chapter 36, The GCHART Procedure, on page 989. The ORDER= option overrides the suboption NUMBER= described in Tick Mark Description Suboptions on page 212. The ORDER= option is not valid with the ASCENDING, DESCENDING, and NOZEROS options used with the bar chart statements in the GCHART procedure. This option is not supported by the GRADAR procedure. Note: The Java applet supports the ORDER= option for numeric axes, but does not support the ORDER= option for categorical, character, midpoint, or group axes. The ActiveX control supports only simple order lists. Non-uniform interval values, such as dates, are not supported. Only maximum and minimum values are supported with a default interval of one day. 4 Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294, Example 5. Filling the Area between Plot Lines on page 304, and Example 7. Using BY-group Processing to Generate a Series of Charts on page 309 Restriction: Partially supported by Java and ActiveX ORIGIN=(<x><,y>)<units> | (<x<units>><,y<units>>) species the x coordinate and the y coordinate of the origin of the axis. The origin of the horizontal axis is the left end of the axis, and the origin of the vertical axis is the bottom of the axis. The ORIGIN= option explicitly positions the axis anywhere on the graphics output area. If you specify only one value, with or without a comma following it, only the x coordinate is set to that value. For example, this specication sets x to 4 centimeters:
origin=(4 cm,)
If you specify two values, with or without a comma separating them, the rst value sets the x coordinate and the second value sets the y coordinate:
origin=(2 pct, 4 pct)
If you specify one value preceded by a comma, only the y coordinate is set to that value, as shown here:
origin=(,3 pct)
You can specify units for the x,y pair or for the individual coordinates. This option is not supported by the GRADAR Procedure. Restriction: Not supported by Java and ActiveX
206
AXIS Statement
Chapter 14
REFLABEL=(text-argument(s)) | NONE creates and denes the appearance of a reference-line label. Text-argument(s) denes the appearance or the text of the label, or both. NONE suppresses the reference-line label. Text-argument(s) can be one or more of these: text-string provides up to 256 characters of label text. By default, a reference line does not have a label. Enclose each string in quotes. Separate multiple strings with blank spaces. The strings are applied to the reference lines specied by the VREF or HREF option. text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be ANGLE=degrees AUTOREF COLOR=text-color FONT=font | NONE HEIGHT=text-height <units > JUSTIFY=LEFT | CENTER | RIGHT POSITION=TOP| MIDDLE| BOTTOM ROTATE=degrees T=n See Text Description Suboptions on page 208 for a complete description. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses. REFLABEL is not supported by the GRADAR Procedure.
Style Reference:
STAGGER offsets the axis values on a horizontal axis. This option is useful when values overlap on an axis. When specifying the Java and ActiveX devices, the STAGGER option must sometimes be used in conjunction with the ORDER statement. SPLIT=split-char species the split character that the AXIS statement uses to break axis values into multiple lines. Split-char can be any character value that can be specied in a SAS character variable. The split character must be embedded in the variable values in the data set or in an associated format. When the AXIS statement encounters the split character, it automatically breaks the value at that point and continues on the next line. For example, suppose the data set contains the value Berlin, Germany, and you specify SPLIT=,. The value would appear on the axis as follows:
Berlin Germany
Note that the split character itself is not displayed. Axis values specied with VALUE= do not use the split character. For example, suppose you specify this statement:
axis1 split="," value=(tick=1 "December, 1999");
The value appears on the axis on one line as December, 1999. However, any other axis values containing a comma honors the split character. This option is not supported by the GRADAR Procedure.
SAS/GRAPH Statements
AXIS Statement
207
Featured in: Example: Creating Bar Charts with Drill-Down for the Web on
page 620
Restriction: Not supported by Java and ActiveX
STYLE=line-type species a line type for the axis line. Valid values for line-type are 0 through 46. If you specify STYLE=0, the axis line is not drawn. The default is 1, a solid line. Note: In order for the axis line to be altered by the STYLE= option, the NOFRAME option must also be set. If only the STYLE=option is set, the axis frame is modied. 4 Note: See also: Figure 14.22 on page 276 for examples of the available line types. 4
Style Reference:
VALUE=(text-argument(s) )| NONE modies the major tick mark values. That is, this option modies the text that labels the major tick marks on the axis. Text-argument(s) denes the appearance or the text of a major tick mark value, or both. NONE suppresses the major tick mark values, although the major tick marks are still displayed. Text-argument(s) can be one or more of these: text-string provides up to 256 characters of text for the major tick mark value. By default, the value is either the variable value or an associated format value. Enclose each string in quotes and separate multiple strings with blanks. Specied text strings are assigned to major tick marks in order. If you specify only one text string, only the rst tick mark value changes, and all the other tick mark values display the default. If you specify multiple strings, the rst string is the value of the rst major tick mark, the second string is the value of the second major tick mark, and so on. For example, to change default tick mark values 1, 2, and 3 to First, Second, and Third, use this option:
value=("First" "Second" "Third")
Note: Although the VALUE= option changes the text displayed at a major tick mark, it does not affect the actual value represented by the tick mark. To change the tick mark values, use the ORDER= option. Also note that with the Java or ActiveX devices, it is necessary to use the ORDER= option to ensure that the same number of tick marks are displayed as are with graphics rendered with the other device drivers. For example, specify ORDER=(1 to 12) to ensure that tick marks for all twelve months are displayed. To change the value of midpoints in bar charts produced with the GCHART procedure, use the MIDPOINTS= option in the procedure. 4 text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be ANGLE=degrees COLOR=text-color FONT=font | NONE HEIGHT=text-height <units >
208
AXIS Statement
Chapter 14
JUSTIFY=LEFT | CENTER | RIGHT ROTATE=degrees TICK=n. For a complete description, see Text Description Suboptions on page 208. Place text description suboptions before the text strings they modify. Suboptions not followed by a text string affect the default values. To specify and describe the text for individual values or to produce multi-line text, use the TICK= suboption. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses. Note: If an end user viewing a graph in the Java applet or ActiveX control zooms in on a particular part of a graph for which the VALUE= option is specied, the values are not readjusted in coordination with the zooming. 4 Style Element: Color attribute of the GraphLabelText graph element Featured in: Example 2. Specifying Logarithmic Axes on page 296, Example 7. Using BY-group Processing to Generate a Series of Charts on page 309, and Example 9. Combining Graphs and Reports in a Web Page on page 315 Restriction: Partially supported by Java WIDTH=thickness-factor species the thickness of the axis line. Thickness increases directly with the value of thickness-factor. By default, WIDTH=1. Note: In order for the axis line to be altered by the WIDTH= option, the NOFRAME option must also be set. If only the WIDTH=option is set, the axis frame is modied. Java does not support the WIDTH option. ActiveX ignores the WIDTH option for the vertical axis of an AXIS statement with GPLOT and GCONTOUR. 4 Style Reference: LineThickness attribute of the GraphAxisLines element Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294 Restriction: Not supported by Java and partially supported by ActiveX
SAS/GRAPH Statements
AXIS Statement
209
AUTOREF automatically labels each reference line on an axis with the response value at the reference lines position. The AUTOREF option is used only with the REFLABEL= option. The automatic labels are applied only to reference lines that do not have specic labels assigned to them. For example, the following option uses the response-axis value as the label for every reference line except the second reference line, which is assigned the label two:
reflabel=(autoref t=2 "two")
Note, however, that if you simultaneously request automatic labeling with a PLOT or BUBBLE statement (using the AUTOHREF or AUTOVREF option), then the automatic labeling can write on top of the custom label you specied using the AXIS statement. You must ensure that your custom labels specied using the AXIS statement are not at the same position as automatic labels requested with a different statement. Restriction: Not supported by Java, ActiveX, and GIF COLOR=text-color species the color for the text. If you omit the COLOR= suboption, a color specication is searched for in this order: 1 the CTEXT= option for the procedure 2 the CTEXT= option in a GOPTIONS statement 3 the color of the default style. Alias: C= FONT=font | NONE species the font for the text. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for details on specifying font. If you omit FONT=, a font specication is searched for in this order: 1 the FTEXT= option in a GOPTIONS statement 2 the default style font, NONE. Alias: F= Restriction: Partially supported by Java HEIGHT=text-height <units > species the height of the text characters in number of units. By default, HEIGHT=1 CELL. If you omit the HEIGHT= option, a text height specication is searched for in this order: 1 the HTEXT= option in a GOPTIONS statement 2 the default style value, 1. Alias: H= JUSTIFY=LEFT | CENTER | RIGHT species the alignment of the text. The default depends on the option with which it is used and the text it applies to. 3 With the LABEL= option: 3 for a left vertical axis label, the default is JUSTIFY=RIGHT 3 for a right vertical axis label, the default is JUSTIFY=LEFT 3 for a horizontal axis label, the default is JUSTIFY=CENTER.
3
With the REFLABEL= option: 3 for a reference line that intersects a vertical axis, the default is JUSTIFY=CENTER. RIGHT places the text string on the right end of
210
AXIS Statement
Chapter 14
the line, CENTER places the text string in the middle of the line, and LEFTplaces the text string to the left of the line. 3 for a reference line that intersects a horizontal axis, the default is JUSTIFY=RIGHT for all procedures except the BAR statement in GBARLINE. For the BAR statement in GBARLINE the default is JUSTIFY=LEFT. RIGHT places the text string just to the right of the line, CENTER is centered on top of the line, and LEFT places the text string just to the left of the line.
3 With the VALUE= option: 3 for numeric variables on a vertical axis, the default is JUSTIFY=RIGHT 3 for character variables on a vertical axis, the default is JUSTIFY=LEFT 3 for all variables on a horizontal axis, the default is JUSTIFY=CENTER.
Note: With output using Java and ActiveX, text justication is relative to the text string, not the tick mark. For example, left justication means that the left end of the text string is justied with respect to the drawing location, as well as other strings in a multiline label. Because the text is left justied with respect to the drawing location and not the tick mark, the text string can be placed to the right of a tick mark. 4 You can use the JUSTIFY= option to print multiple lines of text by repeating the JUSTIFY= option before the text string for each line. You can also use JUSTIFY= to specify multi-line text at specied major tick marks. For example, this statement produces an axis label and major tick mark values like those shown in Figure 14.4 on page 210.
axis label=("Current" justify=c "Sales Projections") value=(tick=1 "JAN" justify=c tick=2 "FEB" justify=c tick=3 "MAR" justify=c tick=4 "APR" justify=c tick=5 "MAY" justify=c
Figure 14.4
JAN 1997
FEB 1997
APR 1997
MAY 1997
Specify additional suboptions before any string. J=L | C | R Restriction: Not supported by Java See also: the suboption TICK= on page 211
Alias:
POSITION=TOP | MIDDLE | BOTTOM species the position of a reference-line label relative to the reference line. The default is TOP for both vertical and horizontal reference lines. The POSITION= option is available only on the REFLABEL= option.
SAS/GRAPH Statements
AXIS Statement
211
3 For horizontal reference lines, TOP places the label just above the reference
line, MIDDLE places the label on the reference line, and BOTTOM places the label just below the reference line.
3 For vertical reference lines, TOP places the label at the top end of the
reference line, MIDDLE places the label in the middle of the line, and BOTTOM places the label at the bottom end of the line.
Restriction:
ROTATE=degrees species the angle at which each character of text is rotated with respect to the baseline of the text string. A positive value for degree rotates the character counterclockwise; a negative value moves it clockwise. By default, ROTATE=0 (parallel to the baseline) unless the text is automatically angled or rotated to avoid overlapping.
Alias:
TICK=n species the n reference line or tick mark value. Used only with the REFLABEL= option or the VALUE= option. If neither one is specied, then the TICK= option is ignored.
3 With the REFLABEL= option, the TICK= option species the nth reference
line. It is used to limit modications to individual reference lines when there are multiple reference lines on an axis. For example, the following option changes the color of only the third reference lines label and leaves all other reference-line labels unchanged:
reflabel=(autoref t=3 color=red)
Suboptions that precede the TICK= option affect all the reference-line labels on an axis. Suboptions that follow the TICK= option affect only the specied lines label. For example, the following option assigns the color green to all the reference-line labels on an axis, but left-justies only the third reference lines label:
reflabel(c=green "one" "two" t=3 j=left "three")
For the options to be applied to a text string, they must precede the quoted string. In the following option, the j=left is ignored because it follows the string:
reflabel(c=green "one" "two" t=3 "three" j=left)
3
Note: The Java and ActiveX device drivers do not support the REFLABEL option.
With the VALUE= option, the TICK= option species the nth major tick mark value. It is used to designate the tick mark value whose text and appearance you want to modify. For example, the following option changes the color of only the third tick mark value and leaves all others unchanged:
value=(tick=3 color=red)
Suboptions that precede the TICK= option affect all the major tick mark values. Suboptions that follow the TICK= option affect only the specied value. For example, the following option makes all the major tick mark
212
AXIS Statement
Chapter 14
values four units high and colors all of them blue except for the third one, which is red:
value=(height=4 color=blue tick=3 color=red)
Alias:
T=n
FONT=SWISS applies to both Weight and (in tons). HEIGHT=4 affects Weight, but is respecied as HEIGHT=3 for (in tons). JUSTIFY=RIGHT affects only (in tons).
Alias:
C=tick-mark color
HEIGHT=tick-height <units> species the height of the tick mark. The defaults for the HEIGHT= suboption depend on the option with which it is used:
3 With the MAJOR= option the default height .5 CELLS. 3 With the MINOR= option the default height .25 CELLS.
If you specify a negative number, tick marks are drawn inside the axis.
Alias:
Restriction:
NUMBER=number-of-ticks species the number of tick marks to be drawn. With the MAJOR= option, number-of-ticks must be greater than 1. With the MINOR= option, number-of-ticks must be greater than 0. With the MAJOR= option, the NUMBER= suboption can be overridden by a major tick mark specication in the procedure, which in turn can be overridden by the ORDER= option. With the MINOR= option, the NUMBER= suboption can be overridden by a minor tick mark specication in the procedure. The NUMBER= option is not valid with logarithmic axes.
Alias:
N=number-of-ticks
SAS/GRAPH Statements
AXIS Statement
213
WIDTH=thickness-factor species the thickness of the tick mark, where thickness-factor is a number. Thickness increases directly with thickness-factor. By default, WIDTH=1.
Style Reference: Alias:
Restriction:
Canceling one AXIS statement does not affect any other AXIS denitions. To cancel all current AXIS statements, use the RESET= option in a GOPTIONS statement:
goptions reset=axis;
Specifying RESET=GLOBAL or RESET=ALL cancels all current AXIS denitions as well as other settings. To display a list of current AXIS denitions in the LOG window, use the GOPTIONS procedure with the AXIS option:
proc goptions axis nolist; run;
Procedure GBARLINE
Option that assigns an AXIS denition MAXIS= RAXIS= GAXIS= MAXIS= RAXIS= HAXIS= VAXIS=
GCHART
HBAR | VBAR
GCONTOUR
PLOT
214
BY Statement
Chapter 14
Procedure GPLOT
GRADAR
CHART
star axis
Some types of axes cannot use certain AXIS statement options: 3 Group and midpoint axes ignore the LOGBASE=, MAJOR=, and MINOR= options. 3 Midpoint, horizontal and vertical axes ignore the NOBRACKETS option.
BY Statement
Processes data and orders output according to the BY group.
Used by: GAREABAR, GCHART, GBARLINE, GCONTOUR, GMAP, GPLOT, GRADAR, GREDUCE, G3D, G3GRID procedures
Syntax
BY< DESCENDING> variable <...< DESCENDING> variable-n> <NOTSORTED>;
Description
The BY statement divides the observations from an input data set into groups for processing. Each set of contiguous observations with the same value for a specied variable is called a BY group. A variable that denes BY groups is called a BY variable and is the variable that is specied in the BY statement. When you use a BY statement, the graphics procedure performs the following operations: 3 processes each group of observations independently 3 generates a separate graph or output for each BY group 3 automatically adds a heading called a BY line to each graph identifying the BY group represented in the graph 3 adds BY statement information below the Description eld of the catalog entry. By default, the procedure expects the observations in the input data set to be sorted in ascending order of the BY variable values. Note: The BY statement in SAS/GRAPH is essentially the same as the BY statement in Base SAS: however, the effect on the output is different when it is used with SAS/GRAPH procedures. 4
Required Arguments
variable species the variable that the procedure uses to form BY groups. You can specify more than one variable. By default, the procedure expects observations in the data
SAS/GRAPH Statements
BY Statement
215
set to be sorted in ascending order by all the variables that you specify or to be indexed appropriately.
Options
DESCENDING indicates that the data set is sorted in descending order by the specied variable. The option affects only the variable that immediately follows the option name, and must be repeated before every variable that is not sorted in ascending order. For example, this BY statement indicates that observations in the input data set are arranged in descending order of VAR1 values and ascending order of VAR2 values:
by descending var1 var2;
This BY statement indicates that the input data set is sorted in descending order of both VAR1 and VAR2 values:
by descending var1 descending var2;
NOTSORTED species that observations with the same BY value are grouped together, but are not necessarily sorted in alphabetical or numeric order. The observations can be grouped in another way, for example, in chronological order. NOTSORTED can appear anywhere in the BY statement and affects all variables specied in the statement. NOTSORTED overrides DESCENDING if both appear in the same BY statement. The requirement for ordering or indexing observations according to the values of BY variables is suspended when you use the NOTSORTED option. In fact, the procedure does not use an index if you specify NOTSORTED. For NOTSORTED, the procedure denes a BY group as a set of contiguous observations that have the same values for all BY variables. If observations with the same value for the BY variables are not contiguous, the procedure treats each new value it encounters as the rst observation in a new BY group and creates a graph for that value, even if it is only one observation.
Controlling BY Lines
By default, the BY statement prints a BY line above each graph that contains the variable name followed by an equal sign and the variable value. For example, if you specify BY SITE in the procedure, the default heading when the value of SITE is London would be SITE=London.
216
BY Statement
Chapter 14
To suppress the entire BY line, use the NOBYLINE option in an OPTION statement or specify HBY=0 in the GOPTIONS statement. See Example 7. Using BY-group Processing to Generate a Series of Charts on page 309.
Suppressing the name of the BY variable To suppress the variable name and the equal sign in the heading and leave only the BY value, use the LABEL statement to assign a null label ("00"X) to the BY variable. For example, this statement assigns a null label to the SITE variable:
label site="00"x;
To control the color, font, and height of the BY lines, use the following graphics options in a GOPTIONS statement:
See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a complete description of each option.
When you use BY-group processing with the GCHART procedure, you can do the following tasks: 3 With the BLOCK, HBAR, and VBAR statements, you can use the PATTERNID=BY option to assign patterns according to BY groups. With PATTERNID=BY, each BY group uses a different PATTERN denition, but all bars or blocks within a BY group use the same pattern. For further information, see Example: PATTERN and SYMBOL Denitions with BY Groups in the GCHART Procedure on page 218.
SAS/GRAPH Statements
BY Statement
217
3 With the BLOCK statement, you can use the BLOCKMAX= option to produce the
same block-height scaling in all block charts in a BY group.
3 With the HBAR or VBAR statement, you can use the RAXIS= option to produce the
same response axis scaling in all horizontal or vertical bar charts in a BY group. With the PIE and STAR statements, the effect of a BY statement is similar to that of the GROUP= option, except that the GROUP= option enables you to put more than one graph on a single page while the BY statement does not. Do not use a BY variable as the group variable in STAR or PIE statements.
With the GMAP Procedure By default, BY-group processing affects both the map data set and the response data set. This means that you get separate, individual output for each map area common to both data sets. For example, if the map data set REGION contains six states and the response data set contains the same six states, and you specify BY STATE in the GMAP procedure, you get six graphs with one state on each graph. If you use the ALL option in the PROC GMAP statement and you also use the BY statement, you get one output for each map area in the response data set, but that output displays all the map areas in the map data set. Only one map area per output contains response data information; the others are empty. For example, if you create a block map using the data sets REGION and SALES, specify BY STATE, and include the ALL option in the PROC GMAP statement, you get six graphs with six states on each graph. One state per graph has a block; the remaining ve are empty. The UNIFORM option applies colors and heights uniformly across all BY-groups. With the GPLOT Procedure You can use the UNIFORM option in the PROC GPLOT statement to produce the same axis scaling for all graphs in a BY group. By default, the range of the axes can vary from graph to graph, but UNIFORM forces the scaling to be the same for all graphs generated by the procedure. The UNIFORM option applies colors and heights uniformly across all BY-groups. With the RUN Groups
If you use the BY statement with a procedure that processes data and supports RUN-group processing (the GCHART, GMAP, and GPLOT procedures), then each time you submit an action statement or a RUN statement you get a separate graph for each value of the BY variable. For example, each of these two RUN-groups produces a separate plot for every value of the BY variable SITE:
/* first run group*/ proc gplot data=sales; title1 "Sales Summary"; by site; plot sales*model_a; run; /* second run group */ plot sales*model_b; run; quit;
The BY statement stays in effect for every subsequent RUN group until you submit another BY statement or exit the procedure. Variables in subsequent BY statements replace any previous BY variables. You can also turn off BY-group processing by submitting a null BY statement (BY;) in a RUN group, but when you do this, the null BY statement turns off BY-group processing and the RUN group generates a graph. For more information, see RUN-Group Processing on page 56.
218
FOOTNOTE Statement
Chapter 14
With the Annotate Facility If a procedure that is using BY-group processing also species annotation with the ANNOTATE= option in the PROC statement, the same annotation is applied to every graph generated by the procedure. If you specify annotation with the ANNOTATE= option in the action statements for a procedure, the BY-group processing is applied to the Annotate data set. In this way, you can customize the annotation for the output from each BY group by including the BY variable in the Annotate data set and by using each BY-variable value as a condition for the annotation to be applied to the output for that value. With TITLE, FOOTNOTE, and NOTE Statements
TITLE, FOOTNOTE, and NOTE statements can automatically include the BY variable name, BY variable values, or BY lines in the text they produce. To insert BY variable information into the text strings used by these statements, use the #BYVAR, #BYVAL, and #BYLINE substitution options. For an example, see Example 7. Using BY-group Processing to Generate a Series of Charts on page 309.
With PATTERN and SYMBOL Denitions By default, when using a BY statement, the graph for each BY group uses the same patterns or symbols in their dened order. For example, if the BY variable contains four values and there are two response levels for each BY value, the PATTERN1 and PATTERN2 or SYMBOL1 and SYMBOL2 statements are used for each graph. Each BY-group starts over with PATTERN1 or SYMBOL1. The UNIFORM option in the GMAP procedure changes this behavior. Example: PATTERN and SYMBOL Denitions with BY Groups in the GCHART Procedure The GCHART procedure, when used with SYMBOL or PATTERN
denitions, assigns the symbols or patterns in order to each BY group. For example, if the BY variable REGION has four valuesEast, North, South, and Westthe patterns are assigned to the BY-groups in this order:
1 PATTERN1 is assigned to East 2 PATTERN2 is assigned to North 3 PATTERN3 is assigned to South 4 PATTERN4 is assigned to West.
If you create sets of graphs from several data sets containing the variable REGION, and if you want the same pattern assigned to the same region each time, you must be sure that REGION always has the same four values. Otherwise, the patterns may not be the same across graphs. For example, if the value North is missing from the data, the patterns are assigned as follows:
1 PATTERN1 is assigned to East 2 PATTERN2 is assigned to South 3 PATTERN3 is assigned to West.
In this case, South is assigned pattern 2 instead of pattern 3 and West is assigned pattern 3 instead of pattern 4. To avoid this, include the value North for the variable REGION, but assign it a missing value for all other variables.
FOOTNOTE Statement
Writes up to 10 lines of text at the bottom of the graph.
See:
SAS/GRAPH Statements
GOPTIONS Statement
219
Syntax
FOOTNOTE<1...10> <text-argument(s)>;
GOPTIONS Statement
Temporarily sets default values for many graphics attributes and device parameters used by SAS/GRAPH procedures.
Used by: all statements and procedures in a SAS session
Syntax
GOPTIONS <options-list>; options-list can be one or more options from any or all of the following categories: 3 reset option RESET=ALL | GLOBAL | statement-name | (statement-name(s))
3 options that affect the appearance of the display area and the graphics output
ASPECT=scaling-factor ALTDESC | NOALTDESC AUTOSIZE=ON | OFF | DEFAULT BORDER | NOBORDER CELL | NOCELL GSIZE=lines HORIGIN=horizontal-offset <IN | CM> HPOS=columns HSIZE=horizontal-size <IN | CM> IBACK= leref | external-le IMAGESTYLE = TILE | FIT IMAGEPRINT | NOIMAGEPRINT ROTATE=LANDSCAPE | PORTRAIT ROTATE | NOROTATE TARGETDEVICE=target-device-entry VORIGIN=vertical-offset <IN | CM> VPOS=rows VSIZE=vertical-size <IN | CM> XMAX=width <IN | CM> XPIXELS=width-in-pixels YMAX=height <IN | CM> YPIXELS=height-in-pixels
220
GOPTIONS Statement
Chapter 14
CBY=BY-line-color COLORS=<(colors-list | NONE)> CPATTERN=pattern-color CSYMBOL=symbol-color CTEXT=text-color CTITLE=title-color PENMOUNTS=active-pen-mounts PENSORT | NOPENSORT options that control font selection or text appearance CHARTYPE=hardware-font-chartype FASTTEXT | NOFASTTEXT FBY=BY-line-font FCACHE=number-fonts-open FONTRES=NORMAL | PRESENTATION FTEXT=text-font FTITLE=title-font FTRACK=LOOSE | NONE | NORMAL | TIGHT | TOUCH | V5 HBY=BY-line-height <units> HTEXT=text-height <units> HTITLE=title-height <units> RENDER=APPEND | DISK | MEMORY | NONE | READ RENDERLIB=libref SIMFONT=software-font options that set defaults for procedures and global statements GUNIT=units INTERPOL=interpolation-method OFFSHADOW=(x <units>, y <units> | (x,y) <units> V6COMP | NOV6COMP image animation options DELAY=delay-time DISPOSAL=NONE | BACKGROUND | PREVIOUS | UNSPECIFIED INTERLACED | NONINTERLACED ITERATION=iteration-count TRANSPARENCY | NOTRANSPARENCY options that affect how your SAS/GRAPH program runs DISPLAY | NODISPLAY ERASE | NOERASE GWAIT=seconds GRAPHRC | NOGRAPHRC IMAGEPRINT | NOIMAGEPRINT PCLIP | NOPCLIP POLYGONCLIP | NOPOLYGONCLIP options that control how output is sent to devices or les ADMGDF | NOADMGDF DEVADDR=device-address
SAS/GRAPH Statements
GOPTIONS Statement
221
DEVICE=device-entry DEVMAP=device-map-name | NONE EXTENSION=le-type FILECLOSE=DRIVERTERM | GRAPHEND FILEONLY | NOFILEONLY GACCESS=output-format | output-format > destination GEND=string <...string-n> GEPILOG=string <...string-n> GOUTMODE=APPEND | REPLACE GPROLOG=string <...string-n> GPROTOCOL=module-name GSFLEN=record-length GSFMODE=APPEND | PORT | REPLACE GSFNAME=leref GSFPROMPT | NOGSFPROMPT GSTART=string <...string-n> HANDSHAKE=HARDWARE | NONE | SOFTWARE | XONXOFF KEYMAP=map-name | NONE POSTGEPILOG=string POSTGPROLOG=string PREGEPILOG=string PREGPROLOG=string PROMPTCHARS=prompt-chars-hex-stringX 3 options that specify hardware capabilities of the device CHARACTERS | NOCHARACTERS CIRCLEARC | NOCIRCLEARC DASH | NODASH DASHSCALE=scaling-factor FILL | NOFILL FILLINC=0...9999 LFACTOR=line-thickness-factor PIEFILL | NOPIEFILL POLYGONFILL | NOPOLYGONFILL SYMBOL | NOSYMBOL 3 options that control printer hardware features AUTOCOPY | NOAUTOCOPY AUTOFEED | NOAUTOFEED BINDING=DEFAULTEDGE | LONGEDGE | SHORTEDGE COLLATE | NOCOLLATE DUPLEX | NODUPLEX GCOPIES=(<current-copies><,max-copies>) PAPERDEST=bin PAPERFEED=feed-increment <IN | CM> PAPERLIMIT=width <IN | CM> PAPERSIZE=size-name | (width,height)
222
GOPTIONS Statement
Chapter 14
Description
The GOPTIONS statement species values for graphics options. Graphics options control characteristics of the graph, such as size, colors, type fonts, ll patterns, and symbols. If GOPTIONS are specied, they override the default style. In addition, they affect the settings of device parameters, which are dened in the device entry. Device parameters control such characteristics as the appearance of the display, the type of output produced, and the destination of the output. The GOPTIONS statement enables you to change these settings temporarily, either for a single graph or for the duration of your SAS session. You can use the GOPTIONS statement to do the following tasks:
3 override default values for graphics options that control either graphics attributes
or device parameters for a single graph or for an entire SAS session
3 reset individual graphics options or all graphics options to their default values 3 cancel denitions for AXIS, FOOTNOTE, PATTERN, SYMBOL, and TITLE
statements To change device parameters permanently, you must use the GDEVICE procedure to modify the appropriate device entry or to create a new one. See Chapter 38, The GDEVICE Procedure, on page 1125 for details. To review the current settings of all graphics options, use the GOPTIONS procedure. See Chapter 44, The GOPTIONS Procedure, on page 1309 for details.
Options
See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a complete description of all graphics options used by the GOPTIONS statement.
SAS/GRAPH Statements
LEGEND Statement
223
To reset only the background color specication to the default and keep the remaining values, use this GOPTIONS statement:
goptions cback=;
Alternatively, you can use RESET=ALL, but it also cancels any global statement denitions in addition to resetting all graphics options to default values.
Note: Not every graphics attribute can be set in all three places. See the statement and procedure chapters for the options that can be used with each. 4 Some graphics options are supported for specic devices or operating environments only. See the SAS Help facility for SAS/GRAPH or the SAS companion for your operating environment for more information.
LEGEND Statement
Controls the location and appearance of legends on two-dimensional plots, contour plots, maps, and charts.
224
LEGEND Statement
Chapter 14
Used by: GAREABAR, GCHART, GBARLINE, GCONTOUR, GMAP, GPLOT procedures Type:
Global
Syntax
LEGEND<1...99> < options>; option(s) can be one or more options from any or all of the following categories:
3 appearance options
ACROSS=number-of-columns CBLOCK=block-color CBORDER=frame-color CFRAME=background-color CSHADOW=shadow-color DOWN=number-of-rows FRAME FWIDTH=thickness-factor REPEAT=1 | 2 | 3 ROWMAJOR | COLMAJOR SHAPE=BAR(width,height) <units> | LINE(length) <units> | SYMBOL(width,height) <units>
3 position-options
MODE=PROTECT | RESERVE | SHARE OFFSET=(<x ><,y >)<units > | (<x <units >><,y <units >>) ORIGIN=(<x ><,y >)<units > | (<x <units >><,y <units >>) POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT> <INSIDE | OUTSIDE>)
3 text-options
LABEL=(text-argument(s)) | NONE ORDER=(value-list) VALUE=(text-argument(s)) | NONE
Description
LEGEND statements specify the characteristics of a legend but do not create legends. The characteristics are as follows:
3 the position and appearance of the legend box 3 the text and appearance of the legend label 3 the appearance of the legend entries, including the size and shape of the legend
values
SAS/GRAPH Statements
LEGEND Statement
225
Figure 14.5
Parts of a Legend
legend label legend value legend entry
Department
offset origin legend frame
Parts
border of graph
Repairs
Tools
legend value description
Options
When the syntax of an option includes units, use one of these: CELLS CM IN PT PCT Note: character cells centimeters inches points percentage of the graphics output area The Java applet does not support CM, IN, or PT.
If you omit units, a unit specication is searched for in this order: 1 GUNIT= in a GOPTIONS statement 2 the default unit, CELLS ACROSS=number-of-columns species the number of columns to use for legend entries. If there are multiple rows and columns in a legend, use the ROWMAJOR and COLMAJOR options to specify the arrangement of legend entries. Specify the ROWMAJOR option to arrange entries (from lowest to highest) starting from left to right, and then top to bottom. Specify the COLMAJOR option to arrange entries starting from top to bottom, and then left to right. Featured in: Example 8. Creating a Simple Web Page with the ODS HTML Statement on page 313 See also: ROWMAJOR, COLMAJOR CBLOCK=block-color generates and colors a three-dimensional block effect behind the legend. The size and position of the block are controlled by the graphics option OFFSHADOW=(x,y). The CBLOCK= and CSHADOW= options are mutually exclusive. If both are present, SAS/GRAPH software uses the last one specied. The CBLOCK= option is usually used in conjunction with the FRAME, CFRAME=, or CBORDER= options. The Java applet treats the CBLOCK option like the CSHADOW option. See also: The OFFSHADOW=OFFSHADOW on page 396 graphics option and Creating Drop Shadows and Block Effects on page 236 Restriction: Not supported by Java. CBORDER=frame-color draws a colored frame around the legend. This option overrides the FRAME option. CBORDER= can be used in conjunction with the CFRAME= option. Style Reference: Color attribute of the GraphBorderLines graph element CFRAME=background-color species the background color of the legend. This option overrides the FRAME option. If both the CFRAME= and FRAME= options are specied, only the solid
226
LEGEND Statement
Chapter 14
background produced by the CFRAME= option is displayed. The CFRAME= option can be used in conjunction with the CBORDER= option.
Style Reference:
CSHADOW=shadow-color generates and colors a drop shadow behind the legend. The size and position of the shadow is controlled by the graphics option OFFSHADOW=(x,y). The CSHADOW= and CBLOCK= options are mutually exclusive. If both are present, SAS/GRAPH uses the last one specied. The CSHADOW= option is usually specied in conjunction with the FRAME, CFRAME=, or CBORDER= options.
See also:
the OFFSHADOW=OFFSHADOW on page 396 graphics option and Creating Drop Shadows and Block Effects on page 236.
DOWN=number-of-rows species the number of rows to use for legend entries. If there are multiple rows and columns in a legend, use the ROWMAJOR and COLMAJOR options to specify the arrangement of legend entries. Specify the ROWMAJOR option to arrange entries (from lowest to highest) starting from left to right, and then top to bottom. Specify the COLMAJOR option to arrange entries starting from top to bottom, and then left to right. The ROWMAJOR option is the default. FRAME draws a frame around the legend. The color of the frame is the rst color in the color list. FWIDTH=thickness-factor species the thickness of the frame, where thickness-factor is a number. The thickness of the line increases directly with thickness-factor. By default, FWIDTH=1.
Restriction: Not supported by Java and ActiveX
LABEL=(text-argument(s)) | NONE modies a legend label. Text-argument(s) denes the appearance or the text of a legend label, or both. NONE suppresses the legend label. By default, the text of the legend label is either the variable name or a previously assigned variable label (except in the case of GPLOT with OVERLAY. In that case the default label is PLOT). Text-argument(s) can be one or more of these: text-string provides up to 256 characters of label text. Enclose each string in quotes. Separate multiple strings with blanks. text-description-suboption modies a characteristic such as the font, color, or size of the text strings that follows it. Text-description-suboption can be as follows: COLOR=text-color FONT=font | NONE HEIGHT=text-height <units> JUSTIFY=LEFT | CENTER | RIGHT POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT>) Note: The Java applet does not support the POSITION= suboptionit draws legend labels at the top-left of the legend. Also, it does not support multiple values for the JUSTIFY= suboption (only the rst is honored). The
SAS/GRAPH Statements
LEGEND Statement
227
ActiveX control supports the POSITION= option but does not support multiple values for the JUSTIFY suboption (only the rst is honored). 4 See Text Description Suboptions on page 231 for complete descriptions. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Style Reference: Color attribute of the GraphLabelText graph element Featured in: Example 3. Rotating Plot Symbols Through the Color List on
page 299 and Example 8. Creating a Simple Web Page with the ODS HTML Statement on page 313
Restriction:
MODE=PROTECT | RESERVE | SHARE species whether the legend is drawn in the procedure output area or whether legend elements can overlay other graphics elements. MODE= can take one of these values: PROTECT draws the legend in the procedure output area, but a blanking area surrounds the legend, preventing other graphics elements from being displayed in the legend. (A blanking area is a protected area in which no other graphics elements are displayed.) takes space for the legend from the procedure output area, thereby reducing the amount of space available for the graph. If MODE=RESERVE is specied in conjunction with OFFSET=, the legend can push the graph off the graphics output area. RESERVE is valid only when POSITION=OUTSIDE. If POSITION=INSIDE is specied, a warning is issued and MODE= value is changed to PROTECT.
RESERVE
SHARE
draws the legend in the procedure output area. If the legend is positioned over elements of the graph itself, both graphics elements and legend elements are displayed. By default, MODE=RESERVE unless POSITION=INSIDE. In this case, the default changes to MODE=PROTECT.
See also:
Positioning the Legend on page 235 Not supported by Java and ActiveX
Restriction:
OFFSET=(<x><,y>)<units> | (<x <units>><,y <units>>) species the distance to move the entire legend; x is the number of units to move the legend right (positive numbers) or left (negative numbers), and y is the number of units to move the legend up (positive numbers) or down (negative numbers). To set only the x offset, specify one value, with or without a following comma:
offset=(4 cm,)
To set both the x and y offset, specify two values, with or without a comma separating them:
offset=(2 pct, 4 pct)
The OFFSET= option is usually used in conjunction with the POSITION= option to adjust the position of the legend. Moves are relative to the location specied by the POSITION= option, with OFFSET=(0,0) representing the initial position. You can also apply the OFFSET= option to the default legend position.
228
LEGEND Statement
Chapter 14
The OFFSET= option is unnecessary with the ORIGIN= option since the ORIGIN= option explicitly positions the legend and requires no further adjustment. However, if you specify both options, the OFFSET= values are added to the ORIGIN= values,l and the LEGEND is positioned accordingly.
See also: Positioning the Legend on page 235 and the option POSITION= on
page 229
Restriction: Not supported by Java and ActiveX
ORDER=(value-list) selects or orders the legend values that appear in the legend. The way you specify value-list depends on the type of variable that generates the legend:
ORIGIN=(<x><,y>)<units> | (<x <units >><,y <units>>) species the x coordinate and the y coordinate of the lower-left corner of the legend box. The ORIGIN= option explicitly positions the legend anywhere on the graphics output area. It is possible to run a legend off the page or overlay the graph. To set only the x coordinate, specify one value, with or without a following comma:
origin=(4 cm,)
To set both the x and y coordinates, specify two values, with or without a comma separating them:
origin=(2 pct, 4 pct)
The ORIGIN= option overrides the POSITION= option if both are used. Although using the OFFSET= option with the ORIGIN= option is unnecessary, if the OFFSET= option is also specied, it is applied after the ORIGIN= request has been processed.
See also: Positioning the Legend on page 235 Restriction: Not supported by Java and ActiveX
SAS/GRAPH Statements
LEGEND Statement
229
POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT> <OUTSIDE | INSIDE>) positions the legend on the graph. Values for POSITION= are OUTSIDE or INSIDE BOTTOM or MIDDLE or TOP species the location of the legend in relation to the axis area. species the vertical position.
species the horizontal position. LEFT or CENTER or RIGHT By default, POSITION=(BOTTOM CENTER OUTSIDE). You can change one or more settings. If you supply only one value the parentheses are not required. If you specify two or three values and omit the parentheses, SAS/GRAPH accepts the rst value and ignores the others. Once you assign the initial legend position, you can adjust it with the OFFSET= option. The ORIGIN= option overrides the POSITION= option. The value of the MODE= option can affect the behavior of the POSITION= option. Note: The Java applet defaults to BOTTOM-CENTER and supports all possible combinations of BOTTOM | MIDDLE | TOP with LEFT | CENTER | RIGHT except for MIDDLE-CENTER (which would overwrite the map.) The Java applet does not support INSIDE for positioning. 4 See also: OFFSET= option on page 227 and MODE= option on page 227 Restriction: Partially supported by Java REPEAT=1 | 2 | 3 Use the REPEAT= option to specify how many times the plot symbol is repeated in the legend. Valid values are 1 to 3, with 3 being the default. ROWMAJOR | COLMAJOR species the arrangement of legend entries when there are multiple rows and multiple columns. Specify the ROWMAJOR option (the default) to arrange entries (from lowest to highest) starting from left to right, and then top to bottom. Specify the COLMAJOR option to arrange the entries starting from top to bottom, and then left to right. See also: ACROSS=, DOWN= SHAPE=BAR(width<units>,height<units>) <units> | LINE(length) <units> | SYMBOL(width<units>,height<units>) <units> species the size and shape of the legend values displayed in each legend entry. The SHAPE= value you specify depends on which procedure generates the legend. BAR(width,height)<units> is used with the GCHART and GMAP procedures, with the GPLOT procedure if you use the AREAS= option, and with the GCONTOUR procedure if you use the PATTERN option. Each legend value is a bar of the specied width and height. By default, width is 5, height is 0.8, and units are CELLS. You can specify units for the width,height pair or for the individual coordinates. LINE(length) <units> is used with the GPLOT and GCONTOUR procedures. Each legend value is a line of the length you specify. Plotting symbols are omitted from the legend values. By default, length is 5 and units are CELLS. You can specify units for length.
230
LEGEND Statement
Chapter 14
SYMBOL(width<units>,height<units>) <units> is used with the GPLOT procedure. Each legend value (not each symbol) is the width and height you specify. For example, this specication produces legend values like the ones in Figure 14.6 on page 230(a):
shape=symbol(.5,.5)
This specication produces legend values like the ones in Figure 14.6 on page 230(b):
shape=symbol(2,.5)
Minn
Minn
CITY CITY
Phoenix
CITY CITY
Phoenix
Raleigh
Raleigh
a.
b.
By default, width is 5, height is 1, and units are CELLS. You can specify units for the width,height pair or for the individual coordinates.
Restriction: Not supported by Java and ActiveX
VALUE=(text-argument(s) )| NONE modies the legend value descriptions. Text-argument(s) denes the appearance or the text of the value descriptions. By default, value descriptions are the values of the variable that generates the legend or an associated format value. Numeric values are right-justied and character values are left-justied. NONE suppresses the value descriptions although the legend values (bars, lines, and so on) are still displayed. (NONE is not supported by Java or ActiveX). Text-argument(s) can be one or more of these: text-string provides up to 256 characters of text for the value description. Enclose each string in quotes. Separate multiple strings with blanks. Specied text strings are assigned to the legend values in order. If you submit only one string, only the rst legend entry uses the value of that string. If you specify multiple strings, the rst string is the text for the rst entry; the second string is the text for the second entry; and so on. For example, this specication produces legend entries like those shown in Figure 14.7 on page 230:
value=("1986" "1987" "1988")
Year
1986
1987
1988
SAS/GRAPH Statements
LEGEND Statement
231
text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be as follows: COLOR=text-color FONT=font | NONE HEIGHT=text-height <units > JUSTIFY=LEFT | CENTER | RIGHT TICK=n See Text Description Suboptions on page 231 for complete descriptions. Place text description suboptions before the text strings they modify. Suboptions not followed by a text string affect the default values. To specify and describe the text for individual values or to produce multi-line text, use the TICK= suboption. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses. To order or select legend entries, use the ORDER= option. See also: Text Description Suboptions on page 231 and the option ORDER= on page 228 Restriction: Partially supported by Java and ActiveX
232
LEGEND Statement
Chapter 14
Associating a character format with a numeric variable does not change the default justication of the variable. You can use the JUSTIFY= suboption to print multiple lines of text by repeating the suboption before the text string for each line. For example, this statement produces a legend label and value descriptions like those shown in Figure 14.8 on page 232:
legend label=(justify=c justify=c value=(tick=1 justify=c justify=c tick=2 justify=c justify=c tick=3 justify=c justify=c "Distribution" "Centers") "Portland," "Maine" "Paris," "France" "Sydney," "Australia");
Figure 14.8
Distribution Centers
Specify additional suboptions before any string. See also: the suboption TICK= on page 233. Alias: J=L | C | R POSITION=(<BOTTOM | MIDDLE | TOP> <LEFT | CENTER | RIGHT>) places the legend label in relation to the legend entries. The POSITION= suboption is used only with the LABEL= option. By default, POSITION=LEFT. The parentheses are not required if only one value is supplied. If you specify two or three values and omit the parentheses, SAS/GRAPH accepts the rst value and ignores the others. Figure 14.9 on page 233 shows some of the ways the POSITION= suboption affects a multiple-line legend label in which the entries are stacked in a column (ACROSS=1). This gure uses a label specication such as the following:
label=("multi-" justify=left "line" justify=left "label" position=left)
In this specication, the POSITION= suboption species the default value, LEFT, which is represented by the rst legend in the gure. The POSITION= value is indicated above each legend. The default justication is used unless you also use the JUSTIFY= suboption.
SAS/GRAPH Statements
LEGEND Statement
233
Figure 14.9
POSITION=LEFT (default)
multiline label
POSITION=(TOP) JUSTIFY=CENTER
multiline label
POSITION=(TOP LEFT)
multiline label + + + ONE TWO x x x THREE # # # FOUR $ $ $ FIVE
POSITION=TOP JUSTIFY=LEFT
multiline label + + + ONE TWO x x x THREE # # # FOUR $ $ $ FIVE
POSITION=(MIDDLE LEFT)
multiline label + + + ONE TWO x x x THREE # # # FOUR $ $ $ FIVE
POSITION=TOP JUSTIFY=RIGHT
multiline label + + + ONE TWO x x x THREE # # # FOUR $ $ $ FIVE
POSITION=(BOTTOM LEFT)
+ + + ONE TWO x x x THREE # # # FOUR $ $ $ FIVE
multiline label
POSITION In addition, specifying POSITION=RIGHT mirrors the effect of POSITION=LEFT, and specifying POSITION=BOTTOM mirrors the effect of POSITION=TOP.
Restriction: Not supported by Java. Partially supported by ActiveX.
TICK=n species the nth legend entry. The TICK= suboption is used only with the VALUE= option to designate the legend entry whose text and appearance you want to modify. For example, to change the text of the third legend entry to Minneapolis, specify the following code:
value=(tick=3 "Minneapolis")
234
LEGEND Statement
Chapter 14
If you use the TICK= suboption when you designate text for one legend entry, you must also use it when you designate text for any additional legend entries. For example, this option changes the text of both the second and third legend entries:
value=(tick=2 "Paris" tick=3 "Sydney")
If you omitted TICK=3, the text of the second legend entry would be
ParisSydney.
Text description suboptions that precede the TICK= suboption affect all the value descriptions for the legend unless the same suboption (with a different value) follows a TICK= specication. Text description suboptions that follow the TICK= suboption affect only the specied legend entry. For example, suppose you specify this option for a legend with three entries:
value=(color=red font=swiss tick=2 color=blue)
The text of all three entries would use the Swiss font; the rst and third entries would be red and only the second entry would be blue.
Alias:
T=n
FONT=ALBANY applies to both Weight and (in tons). HEIGHT=4 affects Weight, but is respecied as HEIGHT=3 for (in tons). JUSTIFY=RIGHT affects only (in tons).
Canceling one LEGEND statement does not affect any other LEGEND denitions. To cancel all current LEGEND statements, use RESET= in a GOPTIONS statement:
goptions reset=legend;
Specifying RESET=GLOBAL or RESET=ALL cancels all current LEGEND denitions as well as other settings. To display a list of current LEGEND denitions in the LOG window, use the GOPTIONS procedure with the LEGEND option:
proc goptions legend nolist; run;
SAS/GRAPH Statements
LEGEND Statement
235
There are two ways you can position the legend on the graphics output area: 3 Describe the general location of the legend with the POSITION= option. If necessary, ne-tune the position with the OFFSET= option. 3 Position the legend explicitly with the ORIGIN=option. The values of the POSITION= option affect the legend in two ways: 3 OUTSIDE and INSIDE determine whether the legend is located outside or inside the axis area. 3 BOTTOM or MIDDLE or TOP (vertical position) and LEFT or CENTER or RIGHT (horizontal position) determine where the legend is located in relation to its OUTSIDE or INSIDE position. Figure 14.10 on page 235 shows the legend positions inside the axis area.
Figure 14.10
axis
legend positions
Figure 14.11 on page 235 shows legend positions outside the axis area.
Figure 14.11
legend positions
The default combination is POSITION=(BOTTOM CENTER OUTSIDE). The combination (OUTSIDE MIDDLE CENTER) is not valid. Use OFFSET=(x,y) to adjust the position of the legend specied by the POSITION= option. The x value shifts the legend either left or right and the y value shifts the legend either up or down. The offset values are always applied after the POSITION= request. For example, if POSITION=(TOP RIGHT OUTSIDE), the legend is located in the upper right corner of
236
NOTE Statement
Chapter 14
the graphics output area. If OFFSET=(0,0) is specied, the legend does not move. If OFFSET=(-5,-8)CM, the legend moves 5 centimeters to the left and 8 centimeters down.
Using ORIGIN=
Use ORIGIN=(x,y) to specify the coordinates of the exact location of the lower left corner of the legend box. Because ORIGIN=(0,0) is the lower left corner of the graphics output area, the values of x and y must be positive. If you specify negative values, a warning is issued and the default value is used.
By default, the legend is inside the procedure output area and the space it occupies reduces the size of the graph itself. To control the way the legend relates to the other elements of the graph, use the MODE= option. These are values for the MODE= option:
3 RESERVE reserve space for the legend outside the axis area and move the graph
to make room for the legend. This is the default setting and is valid only when POSITION=OUTSIDE.
3 PROTECT prevents the legend from being overwritten by the procedure output.
PROTECT blanks out graphics elements, allowing only legend elements to be displayed in the legends space.
3 SHARE displays both graphics elements and legend elements in the same space.
This setting is usually used when the legend is positioned inside the axis area. SHARE is useful when the graph has a space that the legend can t into.
You cannot specify both POSITION=INSIDE and MODE=RESERVE because MODE=RESERVE assumes that the legend is outside the axis area, and POSITION=INSIDE positions the legend inside the axis area. Therefore, when you specify POSITION=INSIDE, change the value of the MODE= option to SHARE or PROTECT. Otherwise, SAS/GRAPH issues a warning and automatically changes the MODE= value to PROTECT.
NOTE Statement
Writes lines of text in the output.
See:
Syntax
NOTE <text-arguments(s)>;
SAS/GRAPH Statements
237
Syntax
ODS HTML < (<ID=>identier)> < action>; ODS HTML < (<ID=>identier)> < option(s)>;
Description
This section describes the ODS HTML statement as it relates to SAS/GRAPH procedures. For complete information on the ODS HTML statement, see SAS Output Delivery System: Users Guide The ODS HTML statement opens or closes the HTML destination. If the destination is open, the procedure produces output that is written in Hypertext Markup Language in the form of an HTML le. If no device is specied, SAS/GRAPH, by default, creates a PNG le containing the graph. The HTML le references the PNG le in order to display the graph in a Web page. If DEVICE=JAVAMETA, graphics output is produced as metagraphics data. The browser passes the metacodes as a parameter to the Metaview applet. The Metaview applet renders the output dened by the metacodes, and displays the interactive graph in a Web page. For more information on DEVICE=JAVAMETA see Developing Web Presentations for the Metaview Applet on page 533. You can also use the DEVICE=JAVA and DEVICE=ACTIVEX options to create interactive graphics presentations for the Web. SAS/GRAPH adds datatip text to some graphs depending on the device specied. These datatips are generated by default using the values of elds in a SAS data set. You can specify the DESCRIPTION= option on the SAS/GRAPH procedure to change or remove the datatip text. For more information on using data tips see Data Tips for Web Presentations on page 600. The FILE= option identies the le that contains the HTML version of the procedure output. With SAS/GRAPH, the body le contains references to the graphs. If DEVICE=PNG, the graphs are stored in separate PNG les. When you view the body le in a browser, the graphs are automatically displayed. By default with ODS processing, the PNG les are stored in the current directory. To specify a destination for all the HTML and PNG les, use the PATH= option. To store thePNG les in a different location than the HTML les, use the GPATH= option to specify a location for thePNG les, and the PATH= option to specify the location of the HTML les. In both cases,the destination must be an aggregate storage location.
Anchors
ODS HTML automatically creates an anchor for every piece of output generated by the SAS procedures. An anchor species a particular location within an HTML le. In SAS/GRAPH, an anchor usually denes a link target such as a graph whose location is dened in an IMG element.
238
PATTERN Statement
Chapter 14
In order for the links from the contents, page, or frame le to work, each piece of output in the body les must have a unique anchor to link to. The anchor for the rst piece of output in a body le acts as the anchor for that le. These anchors are used by the frame and contents les, if they are created, to identify the targets for the links that ODS HTML automatically generates. For more information about using anchors with the ODS HTML statement see SAS Output Delivery System: Users Guide. .
PATTERN Statement
Denes the characteristics of patterns used in graphs.
Used by: GCHART, GBARLINE, GCONTOUR, GMAP, GPLOT procedures; SYMBOL statement; Annotate facility. Type:
Global
Syntax
PATTERN<1...255> <COLOR=pattern-color |_style_> <REPEAT=number-of-times> <VALUE=bar/block-pattern | map/plot-pattern | pie/star-pattern >;
Description
PATTERN statements create PATTERN denitions that dene the color and type of area ll for patterns used in graphs. These are the procedures and the graphics areas that they create that use PATTERN denitions: GCHART color, ll pattern, or image for the bars in two-dimensional bar charts; color and ll pattern for the segments of three-dimensional bar charts, pie charts, and star charts. contour levels in contour plots map areas in choropleth, block, and prism maps; blocks in block maps areas beneath or between plotted lines
SAS/GRAPH Statements
PATTERN Statement
239
In addition, the SYMBOL statement and certain Annotate facility functions and macros can use pattern specications. For details see the SYMBOL Statement on page 250 and Chapter 29, Using Annotate Data Sets, on page 643. You can use the PATTERN statement to control the ll and color of a pattern, and whether the pattern is repeated. There are three types of patterns: 3 bar and block patterns 3 map and plot patterns 3 pie and star patterns Pattern lls can be solid or empty, or composed of parallel or crosshatched lines. For two-dimensional bar charts, the PATTERN statement can specify images to ll horizontal or vertical bars. In addition, you can specify device-dependent hardware patterns for rectangle, polygon, and pie lls on devices that support hardware patterns. If you do not create PATTERN denitions, SAS/GRAPH software generates them as needed and assigns them to your graphs by default. Generally, the default behavior is to rotate a solid pattern through the current color list. For details, see About Default Patterns on page 246.
Options
COLOR=pattern-color | _style_ species the color of the ll. Pattern-color is any SAS/GRAPH color name. The _STYLE_ value species the appropriate color based on the current style. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 the SAS/GRAPH: Reference for more information on specifying colors and images. Note: ActiveX assigns colors in a different order from Java, so the same data can appear differently with those two drivers. 4 Using the COLOR= option with a null value cancels the color specied in a previous PATTERN statement of the same number without affecting the values of other options. The COLOR= option overrides the CPATTERN= graphics option. The CFILL= option in the PIE and STAR statements overrides the COLOR= option. For details, see Controlling Slice Patterns and Colors on page 1053. CAUTION:
Omitting the COLOR= option in a PATTERN statement can cause the PATTERN statement to generate multiple PATTERN denitions. 4
If no color is specied for a PATTERN statement, that is, if neither the COLOR= nor the CPATTERN= option is used, the PATTERN statement rotates the specied ll through each color in the color list before the next PATTERN statement is used. . Alias: C=pattern-color See also: Working with PATTERN Statements on page 247 Featured in: Example 7. Using BY-group Processing to Generate a Series of Charts on page 309 Restriction: Partially supported by Java and ActiveX IMAGE= leref | external-le species an image le that is used to ll one or more bars of a bar chart, as generated by the HBAR, HBAR3D, VBAR, and VBAR3D statements of the GCHART procedure. The format of the external le specication varies across operating environments. See also the IMAGESTYLE= option. Note: When you specify an image le to ll a bar, the bar is not outlined. Also, the COLOR= and VALUE= options are ignored. 4
240
PATTERN Statement
Chapter 14
Note: If an image is specied on a PATTERN statement that is used with another type of chart, then the PATTERN statement is ignored and default pattern rotation is affected. For example, if you submit a PIE statement when an image has been specied in a PATTERN statement, the default ll pattern is used for the pie slices, with each slice in the pie displaying the ll pattern in the same color. For DEVICE=ACTIVEX and DEVICE=ACTXIMG, if you do not specify a pathname to the image, then the ActiveX control searches a predened list of locations to try to nd the image. If all else fails, the ActiveX control looks for the image on the Web. It is recommended that you specify the pathname to the image. For DEVICE=JAVA and DEVICE=JAVAIMG, the IMAGE= option works only for the VBAR and HBAR statements. 4
See also:
page 183
Restriction: Partially supported by Java and ActiveX
IMAGESTYLE = TILE | FIT species how the image specied in the IMAGE= option is to be applied to ll a bar in a bar chart. The TILE value, which is the default, repeats the image as needed to ll the bar. The FIT value stretches a single instance of the image to ll the bar.
Restriction: Partially supported by Java and ActiveX
REPEAT=number-of-times species the number of times that a PATTERN denition is applied before the next PATTERN denition is used. By default, REPEAT=1. The behavior of the REPEAT= option depends on the color specication:
3 If you use both the COLOR= and the REPEAT= options in a PATTERN
statement, the pattern is repeated the specied number of times in the specied color. The ll can be either the default solid or a ll specied with the VALUE= option.
3 If you omit both the COLOR= and CPATTERN= options, and use the
REPEAT= option either alone (generates default solids) or with the VALUE= option in a PATTERN statement, the resulting pattern is rotated through each color in the color list, and then the entire group generated by this cycle is repeated the number of times specied in the REPEAT= option. Thus, the total number of patterns produced depends on the number of colors in the current color list. Using REPEAT= with a null value cancels the repetition specied in a previous PATTERN statement of the same number without affecting the values of other options. Note that in most cases, it is preferable to use LEVELS=1 in the GMAP procedure rather than using this option in the PATTERN statement.
Alias:
R=number-of-times
See also: Understanding Pattern Sequences on page 249 Restriction: Partially supported by Java and ActiveX
SAS/GRAPH Statements
PATTERN Statement
241
3 the front surface of blocks in block charts produced by the BLOCK statement
in the GCHART procedure.
3 the blocks in block maps produced by the BLOCK statement in the GMAP
procedure. (The map area from which the block rises takes a map pattern as described on the option VALUE= on page 242). See also About Block Maps and Patterns on page 1258. Values for bar/block-pattern are as follows: EMPTY E SOLID S style<density> an empty pattern. Neither the Java applet nor the ActiveX control supports EMPTY. a solid pattern (the only valid value for three-dimensional charts). a shaded pattern. Note: style<density> is not supported by the Java or ActiveX device drivers. 4 Style species the direction of the lines: L R X left-slanting lines. right-slanting lines. crosshatched lines. Density species the density of the patterns shading: 1 produces the lightest shading and 5 produces the heaviest shading. Figure 14.12 on page 241 shows all of the patterns available for bars and blocks. 1...5
If no valid patterns are available, default bar and block ll patterns are selected in this order:
1 SOLID 2 X1 X5
242
PATTERN Statement
Chapter 14
3 L1 L5 4 R1 R5
Each ll is used once with every color in the color list unless a pattern color is specied. The entire sequence is repeated as many times as required to provide the necessary number of patterns. V=bar/block-pattern Restriction: Partially supported by Java and ActiveX
Alias:
3 contour levels in contour plots produced by the GCONTOUR procedure 3 map area surfaces in block, choropleth, and prism maps produced by the
BLOCK, CHORO, AND PRISM statements in the GMAP procedure. 3 areas under curves in plots produced by the AREAS= option in the PLOT statement in the GPLOT procedure. Values for map/plot-pattern are as follows: MEMPTY ME MSOLID MS an empty pattern. EMPTY or E are also valid aliases, except when used with the map areas in block maps created by the GMAP procedure. a solid pattern. SOLID or S are also valid aliases, except when used with the map areas in block maps created by the GMAP procedure.
Mdensity<style<angle>> a shaded pattern. Note: Mdensity<style<angle>> is not supported by the Java or ActiveX device drivers. 4 Density species the density of the patterns shading: 1...5 1 produces the lightest shading and 5 produces the heaviest shading.
Style species the type of the pattern lines: N X parallel lines (the default). crosshatched lines. Angle species the angle of the pattern lines: the degrees at which the parallel lines are drawn, measured from the horizontal. By default, angle is 0 (lines are horizontal). Figure 14.13 on page 243 shows some typical map and plot patterns. 0...360
SAS/GRAPH Statements
PATTERN Statement
243
M3N0
M3X0
45o
M3N45
M3X45
90
M3N90
M3X90
135o
M3N135
M3X135
If no valid patterns are available, default map and plot ll patterns are selected in this order:
1 MSOLID 2 M2N0 3 M2N90 4 M2X45 5 M4N0 6 M4N90 7 M4X90
Each ll is used once with every color in the color list unless a pattern color is specied. The entire sequence is repeated as many times as required to provide the necessary number of patterns.
Alias: V=map/plot-pattern Restriction: Partially supported by Java and ActiveX.
VALUE=pie/star-pattern species patterns for pie and star charts produced by the PIE and STAR statements in the GCHART procedure. Values for pie/star-pattern are PEMPTY PE PSOLID PS an empty pattern. EMPTY or E are also valid aliases. a solid pattern. SOLID or S are also valid aliases.
Pdensity<style<angle>> a shaded pattern. Note: Pdensity<style<angle>> is not supported by the Java or ActiveX device drivers. 4
244
PATTERN Statement
Chapter 14
Density species the density of the patterns shading: 1...5 1 produces the lightest shading and 5 produces the heaviest shading.
Style species the type of the pattern lines: N X parallel lines (the default). crosshatched lines. Angle species the angle of the pattern lines: the angle of the lines, measured in degrees from perpendicular to the radius of the slice. By default, angle is 0. The FILL= option in the PIE and STAR statements in the GCHART procedure overrides VALUE=. Figure 14.14 on page 244 shows some typical pie and star patterns. 0...360
P3N0 45o
P3X0
P3N45 90o
P3X45
P3N90 135
o
P3X90
P3N135
P3X135
If no valid patterns are available, default pie and star ll patterns are selected in this order: 1 PSOLID 2 P2N0 3 P2N90 4 P2X45 5 P4N0
SAS/GRAPH Statements
PATTERN Statement
245
6 P4N90 7 P4X90
Each ll is used once with every color in the color list unless a pattern color is specied. The entire sequence is repeated as many times as required to provide the necessary number of patterns. Note: If you use hatch patterns and request a legend instead of slice labels, the patterns in the slices are oriented to be visually equivalent to the legend. 4 Alias: V=pie/star-pattern Restriction: Partially supported by Java and ActiveX
Altering or Canceling PATTERN Statements PATTERN statements are additive. If you dene a PATTERN statement and later submit another PATTERN statement with the same number, the new PATTERN statement redenes or cancels only the options that are included in the new statement. Options not included in the new statement are not changed and remain in effect. For example, assume you dene PATTERN4 as follows:
pattern4 value=x3 color=red repeat=2;
This statement cancels only REPEAT= without affecting the rest of the denition:
pattern4 repeat=;
Add or change options in the same way. This statement changes the color of the pattern from red to blue:
pattern4 color=blue;
Cancel individual PATTERN statements by dening a PATTERN statement of the same number without options (a null statement):
pattern4;
246
PATTERN Statement
Chapter 14
Canceling one PATTERN statement does not affect any other PATTERN denitions. To cancel all current PATTERN statements, use the RESET= option in a GOPTIONS statement:
goptions reset=pattern;
Specifying RESET=GLOBAL or RESET=ALL cancels all current PATTERN denitions as well as other settings. To display a list of current PATTERN denitions in the LOG window, use the GOPTIONS procedure with the PATTERN option:
proc goptions pattern nolist; run;
3 uses patterns, colors, and outlines that are dened by PATTERN statements,
graphics options, and procedure options. In order to understand how SAS/GRAPH generates and assigns patterns dened with PATTERN statements it is helpful to understand how it generates and assigns default patterns. The following sections describe the default pattern behavior for all procedures. See Working with PATTERN Statements on page 247 for details about dening patterns.
In general, the default pattern that the SAS/GRAPH uses is a solid ll. The default colors are determined by the current style and the device. SAS/GRAPH uses default patterns when no PATTERN statements are dened. The default colors are determined by the current style and the device. Because the system option-GSTYLE-is in effect by default, the procedure uses the styles default bar ll colors, plot line colors, widths, symbols, patterns, and outline colors when producing output. Specically, SAS/GRAPHuses the default values when you do not specify any of the following:
3 any PATTERN statements 3 the CPATTERN= graphics option 3 the COLORS= graphics options (that is, you use the devices default color list and
it has more than one color)
3 selects the rst default ll for the appropriate pattern, which is always solid, and
rotates it once through the list of colors available in the current style, generating one solid pattern for each color. If you use the default style colors and the rst color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, then the procedure uses all the colors in the list to generate the patterns. Note: The one exception to the default solid pattern is the map area pattern in a block map produced by the GMAP procedure, which uses a hatch ll by default. By default the map areas and their outlines use the rst color in the color list,
SAS/GRAPH Statements
PATTERN Statement
247
regardless of whether the list is the default device list or one specied with COLORS= in the GOPTIONS statement. 4 3 uses the styles outline color to outline every patterned area. If a procedure needs additional patterns, SAS/GRAPH selects the next default pattern ll appropriate to the graph and rotates it through the color list, skipping the foreground color as before. SAS/GRAPH continues in this fashion until it has generated enough patterns for the chart.
Things That Affect Default Patterns Changing any of these conditions can change or override the default behavior: 3 If you specify a color list with the COLORS= option in a GOPTIONS statement and the list contains more than one color, SAS/GRAPH rotates the default lls, beginning with SOLID, through that list. In this case, it uses every color, even if the foreground color is black (or white). The default outline color remains the foreground color. 3 If you specify either COLORS=(one-color) or the CPATTERN= graphics option, the default ll changes from SOLID to the appropriate list of hatch patterns. SAS/GRAPH uses the specied color to generate one pattern denition for each hatch pattern in the list.
For a description of these graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
Explicitly Specifying Patterns To explicitly specify all the patterns in your graph, you need to do one of the following for every pattern your graph requires: 3 Provide a PATTERN statement that uses the COLOR= option to specify the pattern color, for example:
pattern1 color=red;
3 Provide a PATTERN statement that uses both the COLOR= option and the
VALUE= option to specify the ll, for example:
pattern1 color=blue value=r3;
Including the COLOR= option in the PATTERN statement is the simplest way to assure that you get exactly the patterns you want. When you use the COLOR= option,
248
PATTERN Statement
Chapter 14
the PATTERN statement generates exactly one PATTERN denition for that statement. If you also use the REPEAT= option, the PATTERN denition is repeated the specied number of times.
Generating Multiple Pattern Denitions You can also use PATTERN statements to generate multiple PATTERN denitions. To do this use the VALUE= option to specify the type of ll you want but omit the COLOR= option for example:
pattern1 value=r3;
In this case, the PATTERN statement rotates the R3 ll through all the colors in the color list. For more information on pattern rotation, see Understanding Pattern Sequences on page 249.
Use this type of ll VALUE= bar/block-pattern on page 240 VALUE=map/plot-pattern on page 242 VALUE=pie/star-pattern on page 243
Note: If you specify a ll that is inappropriate for the type of graph you are generating (for example, if you specify VALUE=L1 in a PATTERN statement for a choropleth map), SAS/GRAPH ignores the PATTERN statement and continues searching for a valid pattern. If it does not nd a denition with a valid ll specication, it uses default patterns instead. 4
Controlling Outline Colors Whenever you use PATTERN statements, the default outline color uses the styles outline color to outline every patterned area. To change the outline color of any pattern, whether the pattern is default or user-dened, use the COUTLINE= option in the action statement that generates the chart. The Effect of the CPATTERN= Graphics Option Although the CPATTERN= graphics option is used most often with default patterns, it does affect the PATTERN statement. With default patterns (no PATTERN statements specied) it does the following: 3 species the color for all patterns 3 causes default patterns to use hatched lls instead of the default SOLID.
In conjunction with the PATTERN statement it does the following: 3 With a PATTERN statement that only species a ll (VALUE=), the CPATTERN= option determines the color of that ll. For example, these statements produce two green, hatched patterns:
goptions cpattern=green; pattern1 value=x3; pattern2 value=x1;
3 With a PATTERN statement that only species a color (COLOR=), the COLOR=
option overrides the CPATTERN= color, but CPATTERN= causes the ll to be
SAS/GRAPH Statements
PATTERN Statement
249
hatched, not the default SOLID. For example, these statements produce one red, hatched pattern:
goptions cpattern=green; pattern1 color=red;
Generating Pattern Sequences SAS/GRAPH generates pattern sequences when a PATTERN statement uses VALUE= to specify a ll and all of the following conditions are also true:
3 The COLOR= option is not used in the PATTERN statement. 3 The CPATTERN= graphics option is not used. 3 The color list, either default or user-specied, contains more than one color.
In this case, the PATTERN statement rotates the ll specied by the VALUE= option through every color in the color list, generating one PATTERN denition for every color in the list. After every color has been used once, SAS/GRAPH goes to the next PATTERN statement. For example, suppose you specied the following color list and PATTERN statements for bar/block patterns:
goptions pattern1 pattern2 pattern3 colors=(blue red green) ctext=black; color=red value=x3; value=r3; color=blue value=l3;
Here, PATTERN1 generates the rst PATTERN denition. PATTERN2 omits the COLOR= option, so the specied ll is rotated through all three colors in the color list before the PATTERN3 statement is used. This table shows the color and ll of the PATTERN denitions that would be generated if nine patterns were required:
Denition Number Source 1 2 3 4 5 6 7 8 9 PATTERN1 PATTERN2 PATTERN2 PATTERN2 PATTERN3 rst default rst default rst default second default Characteristics: Color Fill red blue red green blue blue red green blue x3 r3 r3 r3 l3 solid solid solid x1
250
SYMBOL Statement
Chapter 14
Notice that after all the PATTERN statements are exhausted, the procedure begins using the default bar and block patterns, beginning with SOLID. Each ll from the default list is rotated through all three colors in the color list before the next default ll is used.
Repeating Pattern Sequences If you use the REPEAT= option but not the COLOR= option, the sequence generated by cycling the denition through the color list is repeated the number of times specied by the REPEAT= option. For example, these statements illustrate the effect of the REPEAT= option on PATTERN statements both with and without explicit color specications:
goptions colors=(red blue green); pattern1 color=gold repeat=2; pattern2 value=x1 repeat=2;
Here, PATTERN1 is used twice and PATTERN2 cycles through the list of three colors and then repeats this cycle a second time:
Characteristics: Color gold gold red blue green red blue green
Sequence Number 1 2 3 4 5 6 7 8
SYMBOL Statement
Denes the characteristics of symbols that display the data plotted by a PLOT statement used by PROC GBARLINE, PROC GCONTOUR, and PROC GPLOT.
Used by: GBARLINE, GCONTOUR, GPLOT procedures Type
Global
Syntax
SYMBOL< 1...255> <COLOR=symbol-color|_style_> <MODE=EXCLUDE | INCLUDE> <REPEAT=number-of-times> <STEP=distance<units>> <appearance-option(s)> <interpolation-option> <SINGULAR=n>; appearance-options can be one or more of these: BWIDTH=box-width
SAS/GRAPH Statements
SYMBOL Statement
251
CI=line-color|_style_ CO=color CV=value-color|_style_ FONT=font HEIGHT=symbol-height<units> LINE=line-type POINTLABEL<=(label-description(s)) | NONE> VALUE=special-symbol | text-string | NONE WIDTH=thickness-factor interpolation-option can be one of these:
3 general methods
INTERPOL=JOIN INTERPOL=map/plot-pattern INTERPOL=NEEDLE INTERPOL=NONE INTERPOL=STEP<placement><J><S>
Description
SYMBOL statements create SYMBOL denitions, which are used by the GPLOT, GBARLINE and GCONTOUR procedures. For the GPLOT and GBARLINE procedure, SYMBOL denitions control the following:
3 the appearance of plot symbols and plot lines, including bars, boxes, condence
limit lines, and area lls
3 the appearance and text of contour labels 3 the appearance of contour lines
If you create SYMBOL denitions, they are automatically applied to a graph by the procedure. If you do not create SYMBOL denitions, these procedures generate default denitions and apply them as needed to your plots.
252
SYMBOL Statement
Chapter 14
Options
When the syntax of an option includes units, use one of these: CELLS CM IN PCT PT character cells centimeters inches percentage of the graphics output area points.
BWIDTH=box-width species the width of the box generated by either the INTERPOL=BOX or INTERPOL=HILOB option. Box-width can be any number greater than 0. By default, the value of box-width is the same as the value of the WIDTH= option, whose default value is 1. Therefore, if you specify a WIDTH= value for and omit the BWIDTH= option, the width of the box changes accordingly.
Featured in:
CI=line-color|_style_ species a color for an interpolation line (GPLOT and GBARLINE) or a contour line (GCONTOUR). The _STYLE_ value species the appropriate color based on the current style. If you omit the CI= option but specify the CV= option, the CI= option assumes the value of the CV= option. In this case, the CI= and CV= options specify the same color, which is the same as specifying the COLOR= option alone. If you omit the CI= option, the color specication is searched for in this order:
1 the COLOR= option 2 the CV= option 3 the CSYMBOL= option in a GOPTIONS statement 4 each color in the color list sequentially before the next SYMBOL denition is
used.
See also: Using Color on page 274 Featured in:
3 outlines of lled areas generated by the INTERPOL=map/plot-pattern option 3 condence limit lines generated by the INTERPOL=R series option 3 staffs, boxes, and bars generated by the high-low interpolation methods:
INTERPOL=HILO, INTERPOL=BOX, and INTERPOL=STD If you omit the CO= option, the search order for a color specication depends on the interpolation method being used.
See also: Using Color on page 274 Featured in:
Example 5. Filling the Area between Plot Lines on page 304 and Example 4. Creating and Modifying Box Plots on page 301
SAS/GRAPH Statements
SYMBOL Statement
253
COLOR=symbol-color | _style_ species a color for the entire denition, unless it is followed by a more explicit specication. For the GPLOT and GBARLINE procedures, this includes plot symbols, the plot line, condence limit lines, and outlines. For the GCONTOUR procedure, this includes contour lines and labels. The _STYLE_ value species the appropriate color from the current style. Using the COLOR= option is exactly the same as specifying the same color for both the CI= and CV= options. If COLOR= precedes the CI= or CV= option in the same statement, the CI= or CV= option is used instead. If you do not use the COLOR=, CI=, CV=, or CO= option, the color specication is searched for in this order:
1 the CSYMBOL= option in a GOPTIONS statement 2 each color in the color list sequentially before the next SYMBOL denition is
used. If you do not use a SYMBOL statement to specify a color for each symbol, but you do specify a color list in a GOPTIONS statement, then Java and ActiveX assign colors to symbols differently than other devices. To ensure consistency on all devices, you should specify the desired color of each symbol. If you do not specify a symbol color, SAS/GRAPH uses the rst default color and the rst symbol. It uses each color in the list of default colors until the list is exhausted. SAS/GRAPH then selects the next symbol and begins again with the rst default color. It rotates the new symbol through the list of default colors before selecting another symbol. It continues selecting new symbols and colors until no more symbols are needed. Note: Neither the Java applet nor the ActiveX control supports using COLOR= with PROC GCONTOUR. 4
Style Reference: Color attribute of the GraphLabelText style element. Alias: C=symbol-color See also:
3 plot symbols in the GPLOT procedure 3 the lled areas generated by the INTERPOL=map/plot-pattern option 3 contour labels in the GCONTOUR procedure
The _STYLE_ value species the appropriate color based on the current style. If you omit the CV= option but specify the CI=, the CV= option assumes the value of the CI= option. In this case, the CV= and CI= options specify the same color, which is the same as specifying the COLOR= option alone. If you omit the CV= option, the color specication is searched for in this order:
1 the COLOR= option 2 the CI= option 3 the CSYMBOL= option in a GOPTIONS statement 4 each color in the color list sequentially before the next SYMBOL denition is
used. Note: Neither the Java applet nor the ActiveX control supports using the CV= option with PROC GCONTOUR. 4
See also:
254
SYMBOL Statement
Chapter 14
Featured in:
Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294, Example 5. Filling the Area between Plot Lines on page 304, and Example 4. Creating and Modifying Box Plots on page 301
FONT=font species the font for the plot symbol (GPLOT, GBARLINE) or contour labels (GCONTOUR) specied by the VALUE= option. The font specication must be enclosed in quotes and can include the /bold and /italic font modiers. By default, the symbol specied by the VALUE= option is taken from the special symbol table shown in Figure 14.21 on page 270. To use symbols from the special symbol table, you must omit the FONT= option. To use a symbol that is not in that special symbol table, specify the font containing the symbol and the character code or hexadecimal code of the symbol that you want to use. You can also specify text instead of special symbols. For example:
symbol font="Albany AMT" value="80"x; /* hexadecimal code for the Euro symbol */ symbol font="Monotype Sorts" value="s"; /* character code for a filled triangle */ symbol font="Cumberland AMT/bo" value="F"; /* prints the letter F in bold */
To cancel a font specication and return to the default special symbol table, enter a null font specication:
symbol font= value=dot;
Alias:
F=font
See also: the VALUE= option on page 267, Specifying Plot Symbols on page
273, and Specifying Special Characters Using Character and Hexadecimal Codes on page 158.
Featured in: Restriction:
HEIGHT=symbol-height<units> species the height in number of units of plot symbols (GPLOT, GBARLINE) or contour labels (GCONTOUR). Note: The HEIGHT= option affects only the height of the symbols and labels on the plot; it does not affect the height of any symbols that might appear in a legend. The HEIGHT option overrides the MarkerSize attribute in graph styles. For more information on graph styles, see SAS Output Delivery System: Users Guide. 4 Note: With the Java device driver, the minimum height is two pixels; with ActiveX a symbol can be so small as to be invisible. Neither the Java applet nor the ActiveX control supports HEIGHT= with PROC GCONTOUR. 4
Alias:
H=symbol-height<units>
See also: the option SHAPE= on page 229 in the LEGEND statement Featured in:
Example 4. Creating and Modifying Box Plots on page 301and Example 3. Rotating Plot Symbols Through the Color List on page 299
INTERPOL=BOX<option(s)><00...25> produces box and whisker plots. The bottom and top edges of the box are located at the sample 25th and 75th percentiles. The center horizontal line is drawn at the 50th percentile (median). By default, INTERPOL=BOX. In this case the
SAS/GRAPH Statements
SYMBOL Statement
255
vertical lines, or whiskers, are drawn from the box to the most extreme point less than or equal to 1.5 interquartile ranges. (An interquartile range is the distance between the 25th and the 75th sample percentiles.) Any value more extreme than this is marked with a plot symbol. Values for option(s) are one or more of these: F J T lls the box with the color specied by CV= and outlines the box with the color specied by CO= joins the median points of the boxes with a line
draws tops and bottoms on the whiskers. In addition, you can specify a percentile to control the length of the whiskers within the range 00 through 25. These are examples of percentile specications and their effect: 00 01 05 10 25 high/low extremes. INTERPOL=BOX00 is not the same as the default, INTERPOL=BOX. 1st percentile low, 99th high 5th percentile low, 95th high 10th percentile low, 90th high 25th percentile low, 75th high; since the box extends from the 25th to the 75th percentile, no whiskers are produced. Figure 14.15 on page 255 shows the type of plot INTERPOL=BOX produces.
Note: If you use the HAXIS= or VAXIS= options in the PLOT statement or the ORDER= option in an AXIS denition to restrict the range of axis values, by default any observations that fall outside the axis range are excluded from the interpolation calculation. See the MODE= option on page 264 4 You cannot use the GPLOT procedure PLOT statement option AREAS= with INTERPOL=BOX. To increase the thickness of all box plot lines, including the box, whiskers, join line, and top and bottom ticks, use the WIDTH= option. To increase the width of the box itself, use the BWIDTH= option. By default the value of the BWIDTH= option is the same as the value of the WIDTH= option. Therefore, if you specify a value for the WIDTH= option and omit BWIDTH=, the width of the box changes.
256
SYMBOL Statement
Chapter 14
For a scatter effect with the box, use a multiple plot request, as in this example:
symbol1 i=none v=star color=green; symbol2 i=box v=none color=blue; proc gplot data=test; plot (y y)*x / overlay;
Note: When using DEVICE=JAVA and DEVICE=JAVAIMG with overlaid plots, different interpolations are supported per overlay unless any of the interpolations is BOX, HILO or STD. When any of these interpolations are encountered, the rst interpolation specied becomes the only interpolation that is used for all overlays. All other interpolations are ignored. 4 Alias: I=BOX<option(s)><00...25> Featured in: Example 4. Creating and Modifying Box Plots on page 301 INTERPOL=HILO<C><option> species that a solid vertical line connect the minimum and maximum Y values for each X value. The data should have at least two values of Y for every value of X; otherwise, the single value is displayed without the vertical line. By default, for each X value, the mean Y value is marked with a tick. This is shown in Figure 14.16 on page 257. To specify high, low, close stock market data, include this option: C draws tick marks at the close value instead of at the mean value. Specifying C assumes that there are three values of Y (HIGH, LOW, and CLOSE) for every value of X. If more or fewer than three Y values are specied, the mean is ticked. The Y values can be in any order in the input data set. In addition, you can specify one of these values for option: connects the minimum and maximum Y values with bars instead of lines. Use the BWIDTH= option to increase the width of the bars. joins the mean values or the close values (if HILOC is specied) with a line. This point is not marked with a tick mark. You cannot use the PLOT statement option AREAS= with INTERPOL=HILOJ. adds tops and bottoms to each line. connects maximum and minimum values with a bar and joins the mean or close values.
T BJ TJ
adds tops and bottoms to the lines and joins the mean or close values. Figure 14.16 on page 257 shows the type of plot INTERPOL=HILO produces. Plot symbols in the form of dots have been added to this gure.
SAS/GRAPH Statements
SYMBOL Statement
257
Y 50 40 30 20 10 0 A B X C
To increase the thickness of all lines generated by the INTERPOL=HILO option, use the WIDTH= option. Note: If you use the HAXIS= or VAXIS= options in the PLOT statement or the ORDER= option in an AXIS denition to restrict the range of axis values, by default any observations that fall outside the axis range are excluded from the interpolation calculation. See the option MODE= on page 264. 4 When using DEVICE=JAVA and DEVICE=JAVAIMG with overlaid plots, different interpolations are supported per overlay unless any of the interpolations is BOX, HILO or STD. When any of these interpolations are encountered, the rst interpolation specied becomes the only interpolation that is used for all overlays. All other interpolations are ignored. Alias: I=HILO<C><option> Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294 Restriction: Partially supported by Java INTERPOL=JOIN connects data points with straight lines. Points are connected in the order they occur in the input data set. Therefore, the data should be sorted by the independent (horizontal axis) variable. If the data contain missing values, the observations are omitted. However, the plot line is not broken at missing values unless the SKIPMISS option is used. Alias: I=JOIN See also: the SKIPMISS on page 1348 option and Missing Values on page 1321 INTERPOL=L<degree><P><S> species a Lagrange interpolation to smooth the plot line. Specify one of these values for degree: 1|3|5 species the degree of the Lagrange interpolation polynomial. By default, degree is 1. In addition, you can specify one or both of these: species a parametric interpolation
P S
sorts a data set by the independent variable before plotting its data. The Lagrange methods are useful chiey when data consist of tabulated, precise values. A polynomial of the specied degree (1, 3, or 5) is tted through the nearest 2, 4, or 6 points. In general, the rst derivative is not continuous. If the
258
SYMBOL Statement
Chapter 14
values of the horizontal variable are not strictly increasing, the corresponding parametric method (L1P, L3P, or L5P) is used. Specifying INTERPOL=L1P, INTERPOL=L3P, or INTERPOL=L5P results in a parametric Lagrange interpolation of degree 1, 3, or 5, respectively. Both the horizontal and vertical variables are processed with the Lagrange method and a parametric interpolation of degree 1, 3, or 5, using the distance between points as a parameter. INTERPOL=map/plot-pattern I=map/plot-pattern species that a pattern ll the polygon that has been dened by the data points. Values for map/plot-pattern are as follows: MEMPTY ME an empty pattern. EMPTY and E are valid aliases. The Java applet does not support this option. MSOLID MS a solid pattern. SOLID and S are valid aliases Mdensity<style<angle>> a shaded pattern. (The Java applet does not support this option.) Density species the density of the patterns shading: 1...5 1 produces the lightest shading and 5 produces the heaviest. Style species the direction of pattern lines: parallel lines (the default) crosshatched lines. Angle species the starting angle for parallel or crosshatched lines:
N X
the degree at which the parallel lines are drawn. By default, angle is 0 (lines are parallel to the horizontal axis). The INTERPOL=map/plot-pattern option only works if the data are structured so that the data points and, consequently, the plot lines form an enclosed area. The plot lines should not cross each other. Alias: I=L<degree><P><S> See also: the PATTERN Statement on page 238
Featured in:
0...360
INTERPOL=NEEDLE draws a vertical line from each data point to a horizontal line at the 0 value on the vertical axis or the minimum value on the vertical axis. The horizontal line is drawn automatically. Figure 14.17 on page 259 shows the type of plot INTERPOL=NEEDLE produces. Plot symbols are not displayed in this gure.
SAS/GRAPH Statements
SYMBOL Statement
259
Y 20 10 0 10 20 1 2 3 X 4 5 6
You cannot use the PLOT statement option AREAS= with INTERPOL=NEEDLE. Alias: I=NEEDLE INTERPOL=NONE I=NONE suppresses any interpolation and, if the VALUE= option is not specied, also suppresses plot points. If no interpolation method is specied in a SYMBOL statement and if the graphics option INTERPOL= is not used, INTERPOL=NONE is the default. You cannot use the PLOT statement option AREAS= with INTERPOL=NONE. INTERPOL=R<type><0><CLM | CLI<50...99>> species that a plot is a regression analysis. By default, regression lines are not forced through plot origins and condence limits are not displayed. Type species the type of regression. Specify one of these values for type: L requests linear regression representing the regression equation Y= 0 + 1 X Q requests quadratic regression representing the regression equation Y= 0 + 1 X + 2 X C
2
Note: When least-square solutions for the parameters are not unique, the SAS/GRAPH uses a quadratic equation by default for the interpolation whereas the Java and ActiveX device drivers might pick a cubic solution to use. 4 By default, type is L. The regression line is drawn in the line type specied in the LINE= option. By default, the type of the regression line is 1. Note: You must specify type if you use either 0, or CLI, or CLM.
260
SYMBOL Statement
Chapter 14
To force the regression line through a (0,0) origin, specify: 0 eliminates the 0 parameter, or intercept, from the regression equation. If the origin is at (0,0), also forces the regression line through the origin. For example, if you specify 0 for a linear regression, the plot line represents the equation Y= 1 X Note: To force the regression line through the origin (0,0) when the data ranges do not place the origin at (0,0), use the GPLOT procedure options HZERO and VZERO (ignored if the data contain negative values), or use the HAXIS= and VAXIS= options to specify axes ranges from 0 to maximum data value. If the data ranges contain negative values and the HAXIS= and VAXIS= options specify ranges starting at 0, only values within the displayed range are used in the interpolation calculations. 4 To display condence limits, specify one of these: CLM displays condence limits for mean predicted values
CLI displays condence limits for individual predicted values. You can specify condence levels from 50% to 99%. By default, the condence level is 95%. Include a condence level specication only if you use CLM or CLI. The line type used for the condence limit lines is determined by adding 1 to the values of LINE=. By default, the line type of condence limit lines is 2. Figure 14.18 on page 260 shows the type of plot INTERPOL=RCCLM95 produces (cubic regression analysis with 95% condence limits).
Y 30 20 10 0 40
** * * * ** *
60
* ** * * * *
* * *
Alias:
Featured in:
INTERPOL=SM<nn><P><S> species that a smooth line is t to data using a spline routine. INTERPOL=SM is a method for smoothing noisy data. The points on the plot do not necessarily fall on the line.
SAS/GRAPH Statements
SYMBOL Statement
261
The relative importance of plot values versus smoothness is controlled by nn. Values for nn are as follows: 0...99 produces a cubic spline that minimizes a linear combination of the sum of squares of the residuals of t and the integral of the square of the second derivative (Reinsch 1967)*. The greater the nn value, the smoother the tted curve. By default, the value of nn is 0. In addition, specify one or both of these: species a parametric cubic spline
P S
sorts data by the independent variable before plotting. Restriction: Not supported by Java INTERPOL=SPLINE<P><S> species that the interpolation for the plot line use a spline routine. INTERPOL=SPLINE produces the smoothest line and is the most efcient of the nontrivial spline interpolation methods. Spline interpolation smoothes a plot line using a cubic spline method with continuous second derivatives (Pizer 1975)**This method uses a piecewise third-degree polynomial for each set of two adjacent points. The polynomial passes through the plotted points and matches the rst and second derivatives of neighboring segments at the points. Specify one or both of these: P species a parametric spline interpolation method. This interpolation uses a parametric spline method with continuous second derivatives. Using the method described earlier for the spline interpolation, a parametric spline is tted to both the horizontal and vertical values. The parameter used is the distance between points
= (x2 + y2)
If two points are so close together that the computations overow, the second point is not used. S sorts a data set by the independent variable before plotting its data.
Note: When points on the graph are out of range of the axis values, the curve is clipped. If an end point is out of range, no curve is drawn. Out-of-range conditions can be caused by restricting the range of axis values with the HAXIS= or VAXIS= option in the PLOT statement or the ORDER= option in an AXIS denition. Note: When points on the graph are close together and a spline interpolation is used, the Java applet is unable to draw some line types correctly. 4
4
Alias: I=SPLINE<P><S>
* Reinsch, C.H. (1967), Smoothing by Spline Functions, Numerische Mathematik, 10, 177183. ** Pizer, Stephen M. (1975), Numerical Computing and Mathematical Analysis, Chicago: Science Research Associates, Inc.,
Chapter 4.
262
SYMBOL Statement
Chapter 14
INTERPOL=STD<1 | 2 | 3><variance><option(s)> species that a solid line connect the mean Y value with 1, 2, or 3 standard deviations for each X. Note: By default, two standard deviations are used. 4 The sample variance is computed about each mean, and from it, the standard deviation sy is computed. Variance can be one or both of these: M P computes sy , computes sample variances using a pooled estimate, as in a one-way ANOVA model. In addition, specify one of these values for option(s): connects the minimum and maximum Y values with bars instead of lines. connects the means from bar to bar with a line. adds tops and bottoms to each line. connects maximum and minimum values with a bar and joins the mean values.
B J T BJ
TJ adds tops and bottoms to the lines and joins the mean values. Figure 14.19 on page 262 shows the type of plot INTERPOL=STD produces. A horizontal tick is drawn at the mean.Plot symbols in the form of dots have been added to this gure.
Y 60 50 40 30 20 10 0 A B X C
Note: By default, the vertical axis ranges from the minimum to the maximum Y value in the data. If the requested number of standard deviations from the mean covers a range of values that exceeds the maximum or is less than the minimum, the STD lines are cut off at the minimum and maximum Y values. When this cutoff occurs, rescale the axis using VAXIS= in the PLOT statement or ORDER= in an AXIS denition so that the STD lines are shown. 4 If you restrict the range of axis values by using the HAXIS= or VAXIS= option in a PLOT statement or the ORDER= option in an AXIS denition, by default any observations that fall outside the axis range are excluded from the interpolation calculation. See the MODE= option on page 264 option. To increase the thickness of all lines generated by the INTERPOL=STD option, use the WIDTH= option. You cannot use the PLOT statement option AREAS= with INTERPOL=STD.
SAS/GRAPH Statements
SYMBOL Statement
263
When using DEVICE=JAVA and DEVICE=JAVAIMG with overlaid plots, different interpolations are supported per overlay unless any of the interpolations is BOX, HILO or STD. When any of these interpolations are encountered, the rst interpolation specied becomes the only interpolation that is used for all overlays. All other interpolations are ignored.
Alias: I=STD<1 | 2 | 3><variance><option(s)> Restriction: Partially supported by Java
INTERPOL=STEP<placement><J><S> species that the data are plotted with a step function. By default, the data point is on the left of the step, the steps are not joined with a vertical line, and the data are not sorted before processing. Specify one of these values for placement: L R C displays the data point on the left of the step. displays the data point on the right of the step. displays the data point in the center of the step. Note: When a step is retraced in order to locate its center point, the GIF, JPEG, PNG, ACTXIMG, Java, and JAVAIMG devices treat this as effectively not drawing that part of the step at all. ActiveX, however, draws each part of the stepresulting in a somewhat different graph. 4 In addition, specify one or both of these: J S produces steps joined with a vertical line.
sorts unordered data by the independent variable before plotting. Figure 14.20 on page 263 shows the type of plot INTERPOL=STEPJR produces. Plot symbols in the form of dots have been added to this gure.
Y 100 75 50 25 0
4 X
Alias: I=STEP<placement><J><S>
264
SYMBOL Statement
Chapter 14
LINE=line-type L=line-type species the line type of the plot line in the GPLOT procedure, or the contour line in the GCONTOUR procedure: 1 a solid line.
2...46 a dashed line. Line types are shown in Figure 14.22 on page 276. By default, LINE=1. Note: This option overrides the LineStyle attribute in graph styles. Neither the Java applet nor ActiveX control supports GCONTOUR. 4
Restriction: Partially supported by Java and ActiveX
MODE=EXCLUDE | INCLUDE species that any interpolation method exclude or include data values that are outside the range of plot axes. By default, MODE=EXCLUDE prevents values outside the axis range from being displayed. If you control the range of values displayed on an axis by using HAXIS= and VAXIS= in the GPLOT procedure, or ORDER= in an AXIS denition, any data points that lie outside the range of the axes are discarded before interpolation is applied to the data. Using these options to control value ranges has a particularly noticeable effect on the high-low interpolation methods, which include INTERPOL=HILO, INTERPOL=BOX, and INTERPOL=STD. Regression analysis also represents only part of the original data.
Restriction: Not supported by Java and partially supported by ActiveX See also: Values Out of Range on page 1321
POINTLABEL<=(label-description(s)) | NONE> labels plot points. The labels always use the format that is assigned to the variable or variables whose values are used for the labels. POINTLABEL without any specied descriptions labels points with the Y value. NONE suppresses the point labels. Label-description(s) can be used to change the variable whose values are used to label points, and to change features of the label text, such as the color, font, or size of the text. Note: If you do not specify a color on a SYMBOL statement, the symbol denition is rotated through the color list before the next SYMBOL statement is used. Thus, if your plot contains multiple plot lines and you want to limit your POINTLABEL specication to a single line, you must specify a color in the SYMBOL statement that contains the POINTLABEL description. 4 Label-description(s) can be one or more of these: COLOR=text-color species the color of the label text. The default is the rst color from the color list.
Alias: C=text-color
DROPCOLLISIONS | NODROPCOLLISIONS specify DROPCOLLISIONS to drop new labels if they collide with a label already in use. Specify NODROPCOLLISIONS to retain all labels. The default is DROPCOLLISIONS. The algorithm for the placement of markers tries to avoid placing labels such that they collide. If the algorithm is unable to avoid a collision, then the default DROPCOLLISIONS is to drop the new label, whereas NODROPCOLLISIONS retains even colliding labels.
SAS/GRAPH Statements
SYMBOL Statement
265
FONT=font | NONE species the font for the text. See Chapter 11, Specifying Fonts in SAS/ GRAPH Programs, on page 153 for details on specifying font. If you omit FONT=, a font specication is searched for in this order:
1 the FTEXT= option in a GOPTIONS statement 2 the default hardware font, NONE.
HEIGHT=text-height <units > species the height of the text characters in number of units. By default, HEIGHT=1 CELL. If you omit HEIGHT=, a text height specication is searched for in this order: 1 the HTEXT= option in a GOPTIONS statement
2 the default value, 1.
JUSTIFY=CENTER | LEFT | RIGHT species the horizontal alignment of the label text. The default is CENTER. The location of the point label is relative to the location of the corresponding data point. POSITION=TOP | MIDDLE | BOTTOM species the vertical placement of the label text. The default is TOP. The location of the point label is relative to the location of the corresponding data point.
Alias: J=C | L | R
#var | #x:#y <$char> | #y:#x <$char> species the variable or variables whose values label the plot points. The variable specication must be enclosed in either single or double quotation marks. The rst specied variable must be prexed with a pound sign (#). If a second variable is specied, it must be prexed with a colon and a pound sign (:#). When you specify both the X and Y variables, you can also specify the character to display as the delimiter between variable values in the plot label. By default if the POINTLABEL= option is specied without naming a label variable, the Y values label the plot points. You can change the default by using #var to specify a different variable whose values should label the points. For example, you might specify the name of the X variable. The following option species the variable SALES as the variable whose values label plot points:
POINTLABEL=("#sales")
Alternatively, you can label the plot points with the values of the X and Y variables, in either order. The order that you specify X and Y in the variable specication determines the order that the values are displayed in the label. The following option species variables HEIGHT and WEIGHT; in the label, the value for HEIGHT is displayed, followed by the value for WEIGHT:
POINTLABEL=("#height:#weight")
266
SYMBOL Statement
Chapter 14
By default when you specify both the X and Y variables, a colon (:) displays in the label to separate the values in each label. To change the character that displays as the delimiter, use the $ syntax to specify an alternative character. The following option species a vertical bar (|) as the delimiter in the label:
POINTLABEL=("#height:#weight $|")
The $ syntax must be within the same quotation marks as the variable specication. The $ specication can precede or follow the variable specication, but it must be separated from the variable specication by at least one space. Note: Specifying a delimiting character with the $ only changes the character that displays in the label. It does not change the syntax of the variable specication, which requires a colon and pound sign (:#) to precede the second variable. 4 Note: There is a sixteen character length limit for each variable. A maximum character length limit of thirty-three characters is possible. This can be composed of X and Y variables, any other valid data set variable, and a separator as required. 4 When creating output using the ActiveX or Java devices, the variables that you specify in the POINTLABEL= option must be for the plots X and Y variables. Specifying any other variables causes unexpected labeling. Specify as many label-description suboptions as you want. Enclose them all within a single set of parentheses, and separate each suboption from the others by at least one space.
Restriction: Partially supported by Java and ActiveX
REPEAT=number-of-times species the number of times that a SYMBOL denition is applied before the next SYMBOL denition is used. By default, REPEAT=1. The behavior of REPEAT= depends on whether any of the SYMBOL color options (CI=, CV=, CO=, and COLOR=) or the CSYMBOL= graphics option also is used:
3 If any SYMBOL color option also is used in the SYMBOL denition, that
SYMBOL denition is repeated the specied number of times in the specied color.
R=number-of-times
See also: Using the SYMBOL Statement on page 270 Restriction: Partially supported by Java and ActiveX
SINGULAR=n tunes the algorithm used to check for singularities. The default value is machine dependent but is approximately 1E-7 on most machines. This option is rarely needed.
SAS/GRAPH Statements
SYMBOL Statement
267
STEP=distance<units> species the minimum distance between labels on contour lines. The value of distance must be greater than zero. By default, STEP=65PCT. Note: If you specify units of PCT or CELLS, the STEP= option calculates the distance between the labels based on the width of the graphics output area, not the height. For example, if you specify STEP=50PCT and if the graphics output area is 9 inches wide, the distance specied is 4.5 inches. A value less than 10 percent is ignored and 10 percent is used instead. 4 When you use the STEP= option, specify the minimum distance that you want between labels. The option then calculates how many labels it can t on the contour line, taking into account the length of the labels and the minimum distance you specied. Once it has calculated how many labels it can t while retaining the minimum distance between them, it places the labels, evenly spaced, along the line. Consequently, the space between labels can be greater than what you specify, although it will never be less. In general, to increase the number of labels from the default, reduce the value of distance. If the procedure cannot write the label at a particular location on the contour, for example because the contour line makes a sharp turn, the label might be placed farther along the line or omitted. If labels are omitted, a note appears in the log. Specifying a low value for the GCONTOUR procedures TOLANGLE= option can also cause labels to be omitted, since this forces the procedure to select smoother labeling locations, which might not be available on some contours.
Featured in: Example 2 on page 1116 Restriction: Not supported by Java and ActiveX
3 species a plot symbol for the data points (GPLOT and GBARLINE). If you
omit the SYMBOL statement, plot points are generated using the default plot symbol. The default symbol is a square if you use the ActiveX or Java devices and a PLUS sign for other devices. If you specify a SYMBOL statement, but do not specify the VALUE= option, plot symbols are suppressed. Note: For ActiveX output, the VALUE= option is not supported when INTERPOL=HILO or INTERPOL=STD. You can use the OVERLAY option with GPLOT to get symbols to appear on the data points. 4
To specify a single quotation mark, you must enclose it in double quotation marks
value=""
268
SYMBOL Statement
Chapter 14
To specify a double quotation mark, you must enclose it in single quotation marks:
value="
In some operating environments, punctuation characters might require single quotes. If you use VALUE=text-string to specify a plot symbol, you must also use the FONT= option to specify a symbol font or a text font. If you specify a symbol font, the characters in the string are character codes for the symbols in the font. If you specify a text font, the characters in the string are displayed. If you specify a text string containing quotes or blanks, enclose the string in single quotes. For example, if you specify this statement, the plot symbol is the word plus instead of the symbol +:
symbol font=swiss value=plus;
Java and ActiveX support the following characters from the marker font for special-symbol:
Table 14.2
Character Marker Square Star Circle Plus Flag X Prism Spade Heart Diamond Club Hexagon Cylinder Z # $ % Paw Hash Sphere, Dot, Balloon Cross Y
Note: If you do not use a SYMBOL statement to specify a color for each symbol, but you do specify a color list in a GOPTIONS statement, then Java and ActiveX assign colors to symbols differently than do the other device drivers. To ensure consistency on all devices, you should specify the desired color of each symbol. If you do not specify a symbol color, SAS/GRAPH uses the rst default color and the rst symbol. It uses each color in the list of default colors until the list is exhausted. SAS/GRAPH then selects the next symbol and begins again with the rst default color. It rotates the new symbol through the list of default colors before selecting another symbol. It continues selecting new symbols and colors until no more symbols are needed. 4 Note: The VALUE option overrides the MarkerSymbol attribute in graph styles. 4
SAS/GRAPH Statements
SYMBOL Statement
269
See also:
the option FONT= on page 254 and Specifying Plot Symbols on page
273.
Alias: V=special-symbol | text-string | NONE Featured in: Example 3. Rotating Plot Symbols Through the Color List on
page 299, Example 4. Creating and Modifying Box Plots on page 301, and Example 2 on page 1116 Restriction: Partially supported by Java and ActiveX WIDTH=thickness-factor species the thickness of interpolated lines (GPLOT) or contour lines (GCONTOUR), where thickness-factor is a number. The thickness of the line increases directly with thickness-factor. By default, WIDTH=1. WIDTH= also affects all the lines in box plots (INTERPOL=BOX), high-low plots with bars (INTERPOL=HILOB), and standard deviation plots (INTERPOL=STD). It also affects the outlines of the area generated by the AREAS= option in the PLOT statement of the GPLOT procedure. Note: By default, the value specied by WIDTH= is used as the default value for the BWIDTH= option. For example, specifying WIDTH=6 also sets BWIDTH= to 6 unless you explicitly assign a value to BWIDTH=. Java and ActiveX do not provide the same measure of control for width as SAS/ GRAPH device drivers. Measurements are translated to pixels rather than a percentage. For DEVICE=JAVA and DEVICE=ACTIVEX the maximum width is 6. 4 Style Reference: LineThickness attribute of the GraphAxisLines element Alias: W=thickness-factor
Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on
page 294 and Example 4. Creating and Modifying Box Plots on page 301
Restriction: Partially supported by Java and ActiveX
270
SYMBOL Statement
Chapter 14
Figure 14.21
Note: The words or special characters in the VALUE= column are entered exactly as shown. 4
3 assigned by default by GPLOT or explicitly selected with the plot request 3 used by GCONTOUR to control the labels and attributes of contour lines
SYMBOL statements generate one or more symbol denitions, depending on how color is used and whether a plot symbol or type of contour line is specied. For more
SAS/GRAPH Statements
SYMBOL Statement
271
information, see Controlling Consecutive SYMBOL Statements on page 272 and Using Generated Symbol Sequences on page 276. Although it is common practice, you do not have to start with SYMBOL1, and you do not have to use sequential statement numbers. When assigning SYMBOL denitions, SAS/GRAPH software starts with the lowest-numbered denition and works upward, ignoring gaps in the numbering.
Altering or Canceling SYMBOL Statements SYMBOL statements are additive. If you dene a SYMBOL statement and later submit another SYMBOL statement with the same number, the new SYMBOL statement denes or cancels only the options that are included in the new statement. Options that are not included in the new statement are not changed and remain in effect.
Note: An exception to this rule is presented by POINTLABEL= suboptions which are not carried over to subsequent SYMBOL statements. 4 Assume you dene SYMBOL4 as follows:
symbol4 value=star cv=red height=4;
The following statement cancels only HEIGHT= without affecting the rest of the denition:
symbol4 height=;
Add or change options in the same way. This statement adds an interpolation method to SYMBOL4:
symbol4 interpol=join;
This statement changes the color of the plot symbol from red to blue:
symbol4 cv=blue;
Cancel individual SYMBOL statements by dening a SYMBOL statement of the same number without options (a null statement):
symbol4;
Canceling one SYMBOL statement does not affect any other SYMBOL denitions. To cancel all current SYMBOL statements, use the RESET= option in a GOPTIONS statement:
goptions reset=symbol;
Specifying RESET=GLOBAL or RESET=ALL cancels all current SYMBOL denitions as well as other settings. To display current SYMBOL denitions in the Log window, use the GOPTIONS procedure with the SYMBOL option:
proc goptions symbol nolist; run;
272
SYMBOL Statement
Chapter 14
3 specify colors on each SYMBOL statement, using the COLOR=, CI=, CV=, or CO=
options. This method lets you explicitly assign colors for each denition. For example, these statements generate two denitions:
symbol1 value=star color=green; symbol2 value=square color=yellow;
3 specify a default color for all SYMBOL statements using the CSYMBOL= option in
the GOPTIONS statement. This method makes it easy to specify the same color for each denition when you do not need more explicit color specications. 3 limit the color list to a single color using the COLORS= option in the GOPTIONS statement. This method makes it easy to specify the same color for each denition when you want the color to apply to other denitions also, such as PATTERN denitions. For more information on specifying colors for symbol denitions, see Using Color on page 274. If you do not use color to limit a SYMBOL statement to a single symbol denition, SAS/GRAPH generates multiple symbol denitions from that statement by rotating the current denition through the color list (for more details, see Using Generated Symbol Sequences on page 276). Because SAS/GRAPH uses symbol denitions in the order they are generated, this means that the nth symbol denition applied to a graph does not necessarily correspond to the SYMBOLn statement. For example, assuming that no color is specied on the CSYMBOL= graphics option, these statements generate four denitions:
goptions colors=(red blue green); symbol1 value=star; symbol2 value=square color=yellow;
Because no color is specied on SYMBOL1, SAS/GRAPH rotates the symbol denition through the color list, which has three colors. Thus, SYMBOL1 denes the rst three applied symbol denitions, and SYMBOL2 denes the 4th:
Characteristics: Color red blue green yellow
Sequence Number 1 2 3 4
In this case, if a graph needs only three symbols, the SYMBOL2 denition is not used. To make the nth applied symbol denition correspond to the SYMBOLn statement, limit each SYMBOL statement to a single color, using one of the techniques listed at the beginning of this section.
SAS/GRAPH Statements
SYMBOL Statement
273
3 specifying plot symbols 3 specifying default interpolation methods 3 sorting data with spline interpolation
Specifying Plot Symbols The VALUE= option species the plot symbols that PROC GPLOT and PROC GBARLINE uses to mark the data points on a plot. Plot symbols can be in the following forms:
3 special symbols as shown in Figure 14.21 on page 270 3 characters from symbol fonts 3 text strings
By default, the plot symbol is the + symbol. To specify a special symbol, use the VALUE= option to specify a name or a character from Figure 14.21 on page 270:
symbol1 value=hash color=green; symbol2 value=) color=blue;
This example uses color to ensure that each SYMBOL statement generates only one denition. You can omit color specications to let SAS/GRAPH rotate symbol denitions through the color list. For details, see Using Generated Symbol Sequences on page 276. To use plot symbols other than those in Figure 14.21 on page 270, use the FONT= option to specify a font for the plot symbol. If the font is a symbol font, such as Marker, the string specied with the VALUE= option is the character code for the symbol to be displayed. If the font is a text font, the string specied with the VALUE= option is displayed as the plot symbol. (See VALUE= on page 267 and FONT= on page 254.) This table illustrates some of the ways you can dene a plot symbol:
Plot Symbol
Denition symbol1 value=plus; symbol2 value=+; symbol3 font=swiss value=plus; symbol4 font=marker value=U; symbol5value="";
plus
Specifying a Default Interpolation Method The INTERPOL= option in a GOPTIONS statement species a default interpolation method to be used with all SYMBOL denitions. This default interpolation method is in effect unless you specify a different interpolation in a SYMBOL statement. If the GOPTIONS statement does not specify an interpolation method, the default for each SYMBOL statement is NONE.
274
SYMBOL Statement
Chapter 14
Sorting Data with Spline Interpolation If you want the GPLOT procedure to sort by the horizontal axis variable before plotting, add the letter S to the end of any of the spline interpolation methods (INTERPOL=L, INTERPOL=SM, and INTERPOL=SPLINE). For example, suppose you want to overlay three plots (Y1*X1, Y2*X2, and Y3*X3) and for each plot, you want the X variable sorted in ascending order. Use these statements:
symbol1 i=splines c=red; symbol2 i=splines c=blue; symbol3 i=splines c=green; proc gplot; plot y1*x1 y2*x2 y3*x3 / overlay; run;
Using Color
Generally, there are two ways to explicitly specify color for SYMBOL statements:
3 specify colors on the SYMBOL statements 3 specify a color on the CSYMBOL= graphics option
You can also let SAS/GRAPH rotate symbol denitions through the color list. For details, see Using Generated Symbol Sequences on page 276.
3 The CV= option species color for plot symbols in GPLOT and GBARLINE, or for
contour labels in GCONTOUR.
3 The CO= option species color for condence limit lines and area outlines in
GPLOT and GBARLINE.
3 The CI= option species color for plot lines in GPLOT and GBARLINE, or contour
lines in GCONTOUR.
3 The COLOR= option species color for the entire symbol. For GPLOT and
GBARLINE, this includes plot symbols, plot lines, and outlines. For GCONTOUR, this includes contour lines and labels. The CV= and CI= options have the same effect as using the COLOR= option when they are used in these ways:
3 Only CV= or CI= option is used. (The option that is not used is assigned the value
of the option used.)
3 Both the CV= and CI= options specify the same color.
In general, the CI=, CV=, and CO= options color specic areas of the symbol. Use these options to produce symbols and plot lines of different colors without having to overlay multiple plot pairs. For example, if you request regression analysis with condence limits, use this statement to assign red to the plot symbol, blue to the regression lines, and green to the condence limit lines:
symbol cv=red ci=blue co=green;
The COLOR= option colors the entire symbol or those portions of it not colored by one of the other color options. If the COLOR= option precedes the CI= or CV= options, the CI= or CV= specication is used instead. If none of the SYMBOL color options is used, color specications are searched for in this order:
1 the CSYMBOL= option in a GOPTIONS statement 2 each color in the color list sequentially before the next SYMBOL denition is used
SAS/GRAPH Statements
SYMBOL Statement
275
CAUTION:
If no color options are used, the SYMBOL denition cycles through each color in the color list. 4
If the SYMBOL color options and the CSYMBOL= graphics option are not used, the SYMBOL denition cycles through each color in the color list before the next denition is used. For details, see Using Generated Symbol Sequences on page 276.
Specifying Color with CSYMBOL= The CSYMBOL= option in the GOPTIONS statement species the default color to be used by all SYMBOL denitions:
goptions csymbol=green; symbol1 value=star; symbol2 value=square;
In this example, both SYMBOL statements use green. CSYMBOL= is overridden by any of the SYMBOL statement color options. See Using Color on page 274 for details. If more SYMBOL denitions are needed, SAS/GRAPH returns to generating default symbol sequences.
276
SYMBOL Statement
Chapter 14
Figure 14.22
Line Types
Note: These line types are also used by other statements and procedures. Some options accept a line type of 0, which produces no line. 4
3 a SYMBOL statement species color but not a plot symbol for the GPLOT
procedure, or a line type for the GCONTOUR procedure (assuming that GCONTOUR does not specify the needed line types). In this case, a default plot symbol or line type is used with the specied color and only one denition is generated.
3 a SYMBOL statement species a plot symbol for GPLOT or a line type for
GCONTOUR, but no color options. In this case, the specied plot symbol or line type is used once with the color specied by the CSYMBOL= graphics option. If a
SAS/GRAPH Statements
SYMBOL Statement
277
CSYMBOL= color is not in effect, the specied plot symbol or line type is rotated through the color list. If the REPEAT= option is also used, the resulting SYMBOL denition is repeated the specied number of times.
Default Symbol Sequences Default symbol sequences are generated by rotating symbol denitions through the current color list.
3 Denitions used for GPLOT rotate plot symbols through the color list; the rst
default plot symbol is a plus sign (+).
3 Denitions used for GCONTOUR rotate line types; the rst default line type is a
solid line (line type 1). Each time a default denition is required, SAS/GRAPH takes the rst default plot symbol or line type and uses it with the rst color in the color list. If more than one denition is required, it uses the same plot symbol or line type with the next color in the color list and continues until all the colors have been used once. If more denitions are needed, SAS/GRAPH selects the second default plot symbol or line type and rotates it through the color list. It continues in this fashion, selecting default plot symbols or line types and cycling them through the color list until all the required denitions are generated. If a color has been specied with the CSYMBOL= option in the GOPTIONS statement, each default plot symbol or line type is used once with the specied color, and the colors in the color list are ignored.
Symbol Sequences Generated from SYMBOL Statements If a SYMBOL statement does not specify color, and if the CSYMBOL= graphics option is not used, the symbol denition is rotated through every color in the color list before the next SYMBOL denition is used:
goptions colors=(blue red green); symbol1 cv=red i=join; symbol2 i=spline v=dot; symbol3 cv=green v=star;
Here, the SYMBOL1 statement generates the rst SYMBOL denition. The SYMBOL2 statement does not include color, so the rst default plot symbol is rotated through all colors in the color list before the SYMBOL3 statement is used. This table shows the colors and symbols that would be used if nine symbol denitions were required for PROC GPLOT:
Sequence Number Source 1 2 3 4 5 6 7 SYMBOL1 SYMBOL2 SYMBOL2 SYMBOL2 SYMBOL3 rst default rst default Characteristics: Color Symbol cv=red color=blue color=red color=green cv=green color=blue color=red rst default dot dot dot star rst default rst default
278
Chapter 14
Notice that after the SYMBOL statements are exhausted, the procedure begins using the default denitions (sequences 6 through 9). Each plot symbol from the default list is rotated through all colors in the color list before the next plot symbol is used. Also, SYMBOL1 does not specify a plot symbol, so the default sequencing provides the rst default symbol (a + sign). When sequencing resumes in sequence number 6, it starts at the beginning again, selecting the rst default plot symbol and rotating it through the color list. If you use the REPEAT= option but no color, the sequence generated by cycling the denition through the color list is repeated the number of times specied by the REPEAT= option. For example, these statements dene a color list and illustrate the effect of the REPEAT= option on SYMBOL statements both with and without explicit color specications:
goptions colors=(blue red green); symbol1 color=gold repeat=2; symbol2 value=star color=cyan; symbol3 value=square repeat=2;
Here, SYMBOL1 is used twice, SYMBOL2 is used once, and SYMBOL3 rotates through the list of three colors and then repeats this cycle a second time:
Sequence Number Source 1 2 3 4 5 6 7 8 9 SYMBOL1 SYMBOL1 SYMBOL2 SYMBOL3 SYMBOL3 SYMBOL3 SYMBOL3 SYMBOL3 SYMBOL3 Characteristics: Color Symbol gold gold cyan blue red green blue red green rst default rst default star square square square square square square
Interpolation default default default default default default default default default
SAS/GRAPH Statements
279
Used by: GANNO, GAREABAR, GBARLINE, GCHART, GCONTOUR, GFONT, GIMPORT, GMAP, GPLOT, GRADAR, GREPLAY, GSLIDE, G3D, and G3GRID Global: TITLE and FOOTNOTE Local: NOTE
Syntax
TITLE<1...10> < text-argument(s)>; FOOTNOTE<1...10> <text-argument(s)>; NOTE <text-arguments(s)>; text-argument(s) can be one or more of these: text-string text-options (text options must precede text-string.) text-options can be one or more of the following, in any order: 3 appearance options COLOR=color FONT=font HEIGHT=text-height<units> 3 placement and spacing options JUSTIFY=LEFT | CENTER | RIGHT LSPACE=line-space<units> MOVE=(x,y)<units> WRAP 3 baseline angling and character rotation options ANGLE=degrees LANGLE=degrees ROTATE=degrees 3 boxing, underlining, and line drawing options BCOLOR=background-color BLANK=YES BOX=1...4 BSPACE=box-space<units> DRAW=(x,y...,x-n,y-n)<units> UNDERLIN=0...3 3 linking option LINK= URL
Options
When the syntax of an option includes units, use one of these: CELLS CM IN PT PCT character cells centimeters inches points percentage of the graphics output area
280
Chapter 14
ANGLE=degrees A=degrees species the angle of the baseline of the entire text string with respect to the horizontal. A positive degrees value angles the baseline counterclockwise; a negative value angles it clockwise. By default, ANGLE=0 (horizontal). Angled titles or footnotes might require more vertical space and, consequently, might increase the size of the title area or the footnote area, thereby reducing the vertical space in the procedure output area. Using the BOX= option with angled text does not produce angled boxes; the box is sized to accommodate the angled note. Using the ANGLE= option after one text string and before another can reset some options to their default values. See Using Options That Can Reset Other Options on page 293. The ANGLE= option has the same effect on the text as LANGLE=, except when you specify an angle of 90 degrees or 90 degrees. In these angle specications, the procedure output area is shrunk from the left or right to accommodate the angled title or footnote. The result depends on the statement in which you use the option:
SAS/GRAPH Statements
281
ANGLE=90 positions the footnote at the right edge of the graphics output area, angled 90 degrees (counterclockwise) and centered vertically. ANGLE=90 positions the footnote at the left edge of the graphics output area, angled 90 (clockwise) and centered vertically.
Figure 14.24
Figure 14.25
See also:
Title
Footnote
the options LANGLE= on page 286 and ROTATE= on page 289
282
Chapter 14
Featured in:
BCOLOR=background-color species the background color of a box produced by the BOX= option. If you omit BOX=, BCOLOR= is ignored. By default, the background color of the box is the same as the background color for the entire graph. The color of the frame of the box is determined by the color specication used in BOX=. Note: The BCOLOR= option can be reset by the ANGLE= or JUSTIFY= options, or by the MOVE= optionwith absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. 4
Alias:
BLANK=YES protects the box and its contents from being overwritten by any subsequent graphics elements by blanking out the area where the box is displayed. The BLANK= option enables you to overlay graphics elements with boxed text. It is ignored if you omit the BOX= option. Because titles and footnotes are written from the highest numbered to the lowest numbered, the BLANK= option only blanks out titles and footnotes of a lower number. Note: The BLANK= option can be reset by the ANGLE= or JUSTIFY= options, or by the MOVE= option with absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. 4
Alias:
See also: the option BOX= on page 282 Featured in: Restriction: Not supported by Java and ActiveX
BOX=1...4 draws a box around one line of text. A value of 1 produces the thinnest box lines; 4 produces the thickest. Boxing angled text does not produce an angled box; the box is sized to include the angled text. The color of the box is either:
3 the color specied by the COLOR= option in the statement 3 the default text color.
The COLOR= option affects only the frame of the box. To color the background of the box, use the BCOLOR= option. You can include more than one text string in the box as long as no text break occurs between the strings; that is, you cannot use the JUSTIFY= option to create multiple lines of text within a box. To draw a box around multiple lines of text, you can either
3 Use the MOVE= option with relative coordinates to position the lines of text
where you want them and enclose them with the BOX= option. For example, this statement produces the boxed note shown in Figure 14.26 on page 283:
note font=swiss justify=center box=3 "Office Hours" move=(40pct,-12pct) "9-5";
3 Use the DRAW= option to draw the box and do not use the BOX= option.
SAS/GRAPH Statements
283
Figure 14.26 Using the BOX= Option and the MOVE= Option to Box Multiple Lines of Text
Note: The BOX= option can be reset by the ANGLE= or JUSTIFY= options, or by the MOVE= options with absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. 4
Alias: BO=1...4 See also:
the options BCOLOR= on page 282, BLANK= on page 282, and BSPACE= on page 283.
Featured in: Example 6. Enhancing Titles on page 307 Restriction: Not supported by Java and ActiveX
BSPACE=box-space<units> species the amount of space between the boxed text and the box. The space above the text is measured from the font maximum, and the space below the text is measured from the font minimum. By default, BSPACE=1. If the BOX= option is not used, the BSPACE= option is ignored. The spacing is uniform around the box. For example, BSPACE=.5IN leaves one-half inch of space between the text and the top, bottom, and sides of the box. Note: The BSPACE= option can be reset by the ANGLE= or JUSTIFY= options, or by the MOVE= option with absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. 4
Alias: BS=box-space<units> See also:
COLOR=color species the color for the following text, box, or line. The COLOR= option affects all text, lines, and boxes that follow it and stays in effect until another COLOR= specication is encountered. Change colors as often as you like. For example, this statement produces a title with red text in a box with a blue frame and a cream background:
title color=red "Total Sales" color=blue box=3 bcolor=cream;
284
Chapter 14
Although the BCOLOR= option controls the background color of the box, the frame color is controlled with the COLOR= option that precedes the BOX= option. If you omit the COLOR= option, a color specication is searched for in this order: 1 the CTITLE= option in a GOPTIONS statement 2 the CTEXT= option in a GOPTIONS statement 3 the default, the rst color in the color list. Alias: ~~ C=color See also: the option BCOLOR= on page 282, and Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192 DRAW=(x,y...,x-n,y-n)<units> draws lines anywhere on the graphics output area using x and y as absolute or relative coordinates. The following table shows the specications for absolute and relative coordinates:
Absolute Coordinates x<units> y<units> Relative Coordinates x<units> y<units>
The coordinate position (0,0) is the lower-left corner of the graphics output area. Specify at least two coordinate pairs. Commas between coordinates are optional; blanks can be used instead. The DRAW= option does not affect the positioning of text. The starting point for lines specied with relative coordinates begins at the end of the most recently drawn text or line in the current statement. If no text or line has been drawn in the current statement, a warning is issued and the relative draw is measured from where a zero-length text string would have ended, given the normal placement for the statement. You can mix relative and absolute coordinates. For example, DRAW=(+0,+0,+0,1IN) draws a vertical line from the end of the text to one inch from the bottom of the graphics output area. Alias: D=(x,y...,x-n, y-n)<units> Restriction: Not supported by Java and ActiveX FONT=font species the font for the subsequent text. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for details on specifying SAS/GRAPH fonts. If you omit this option, a font specication is searched for in this order: 3 for a TITLE1 statement 1 the FTITLE= option in a GOPTIONS statement 2 the FTEXT= option in a GOPTIONS statement 3 the default font, SWISS (COMPLEX in Release 6.06 and earlier). 3 for all other TITLE statements and the FOOTNOTE and NOTE statements: 1 the FTEXT= option in a GOPTIONS statement 2 the default hardware font, NONE. Note: Font names greater than eight characters in length must be enclosed in quotation marks. 4 Note: If the TITLE or FOOTNOTE is being output through an ODS markup destination and the corresponding NOGTITLE or NOGFOOTNOTE option is
SAS/GRAPH Statements
285
specied, then the bold and italic FONT attributes are on by default. However, if you specify different attributes with the FONT= option, the bold and italic attributes are turned off. 4 Alias: F=font See also: Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192 Featured in: Example 6. Enhancing Titles on page 307 HEIGHT=text-height<units> species the height of text characters in number of units. By default, HEIGHT=1. Height is measured from the font minimum to the capline. Ascenders can extend above the capline, depending on the font. If your text line is too long to be displayed in the height specied in the HEIGHT= option, the height specication is reduced so that the text can be displayed. A note in the SAS log tells you what percentage of the specied size was used. If you omit the HEIGHT= option, a text height specication is searched for in this order: 3 for a TITLE1 statement: 1 the HTITLE= option in a GOPTIONS statement 2 the HTEXT= option in a GOPTIONS statement 3 the default value, 2. By default, a TITLE1 title is twice the height of all other titles. 3 for all other TITLE statements and the FOOTNOTE and NOTE statements: 1 the HTEXT= option in a GOPTIONS statement 2 the default value, 1. Note: The Java applet and ActiveX control allow you to control the relative height of text with the HEIGHT= option, but not the absolute height in terms of specic units. 4 Alias: H=text-height<units> See also: Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192 Featured in: Example 1. Ordering Axis Tick Marks with SAS Date Values on page 294 and Example 6. Enhancing Titles on page 307 Restriction: Partially supported by Java and ActiveX JUSTIFY=LEFT | CENTER | RIGHT species the alignment of the text string. The default depends on the statement with which you use the JUSTIFY= option: 3 for a FOOTNOTE statement the default is CENTER 3 for a NOTE statement the default is LEFT 3 for a TITLE statement the default is CENTER. All the text strings following JUSTIFY= are treated as a single string and are displayed as one line that is left-, right-, or center-aligned. You can change the justication within a single line of text. For example, this NOTE statement displays a date on the left side of the output and the page number on the same line on the right:
note "June 28, 1997" justify=right "Page 3";
In addition, you can use the JUSTIFY= option to produce multiple lines of text by repeating the JUSTIFY= option with the same value before the text string for
286
Chapter 14
each line. Multiple lines of text with the same justication are blocked together. For example, this TITLE statement produces a three-line title with each line right-justied:
title justify=right "First Line" justify=right "Second Line" justify=right "Third Line";
You can get the same effect with three TITLE statements, each specifying JUSTIFY=RIGHT. If you produce a block of text by specifying the same justication for multiple text strings, and then change the justication for an additional text string, that text is placed on the same line as the rst string specied in the statement. Note: Using the JUSTIFY= option after one text string and before another can reset some options to their default values. See Using Options That Can Reset Other Options on page 293 for details. 4 Alias: J=L | C | R Featured in: Example 3. Rotating Plot Symbols Through the Color List on page 299 LANGLE=degrees species the angle of the baseline of the entire text string(s) with respect to the horizontal. A positive value for degrees moves the baseline counterclockwise; a negative value moves it clockwise. By default, LANGLE=0 (horizontal). Angled titles or footnotes might require more vertical space and consequently can increase the size of the title area or the footnote area, thereby reducing the vertical space in the procedure output area. Using the BOX= option with angled text does not produce an angled box; the box is sized to accommodate the angled note. Unlike the ANGLE= option, the LANGLE= option does not reset any other options. Therefore, the LANGLE= option is easier to use because you do not need to repeat options after a text break. The LANGLE= option has the same effect on the text as the ANGLE= option, except when an angle of 90 degrees or 90 degrees is specied. The result depends on the statement in which you use the option:
SAS/GRAPH Statements
287
Figure 14.27
Figure 14.28
288
Chapter 14
Note LANGLE=90
Title
Title
Note LANGLE=90
Footnote
Footnote
Alias:
LA=degrees
See also: the option ANGLE= on page 280 Restriction: Not supported by Java and ActiveX
LINK= URL species a uniform resource locator (URL) that a title or footnote links to. The text-string that you use to specify the URL can contain occurrences of the variables #BYVAL, #BYVAR, and #BYLINE, as described in text-string on page 289. Note: If the title or footnote is being output through an ODS markup destination (such as HTML) and the corresponding ODS option NOGTITLE or NOGFOOTNOTE is specied, then the title or footnote is rendered in the body of the HTML le rather than in the graphic itself. Specifying the NOGTITLE or NOGFOOTNOTE options results in increasing the amount of space allowed for the procedure output area, which can result in increasing the size of the graph. Space that would have been used for the title or footnote is devoted instead to the graph. You might need to be aware of this possible difference if you are using annotate or map coordinates. 4
See also: Controlling Where Titles and Footnotes are Rendered on page 192
LSPACE=line-space <units> species the amount of spacing above lines of note and title text and the amount of spacing below lines of footnote text. For notes and titles, the spacing is measured from the capline of the current line to the font minimum of the line above. For footnotes, the spacing is measured from the font minimum of the current line to the capline of the line below. By default, LSPACE=1. Note: The LSPACE= option can be reset by the ANGLE= or JUSTIFY= option, or by the MOVE= option with absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. 4
Alias:
LS=line-space <units>
MOVE=(x,y) <units> positions subsequent text or lines anywhere on the graphics output area using x and y as absolute or relative coordinates. The following table shows the specications for absolute and relative coordinates:
Absolute Coordinates x<units> y<units> Relative Coordinates x<units> y<units>
SAS/GRAPH Statements
289
Commas between coordinates are optional; you can use blanks instead. The starting point for lines specied with relative coordinates begins with the end of the most recently drawn text or line in the current statement. If no text or line has been drawn in the current statement, a warning is issued and the relative move is measured from where a zero-length text string would have ended, given the normal placement for the statement. You can mix relative and absolute coordinates. The MOVE= option overrides a JUSTIFY= option specied for the same text string. If a NOTE, FOOTNOTE, or TITLE statement uses the MOVE= option to position the text so that the statement does not use its default position, the text of the next NOTE, FOOTNOTE, or TITLE statement occupies the unused position and no blank lines are displayed. Note: If you specify the MOVE= option with at least one absolute coordinate and if the option follows one text string and precedes another, some options can be reset to their default values. If you specify the GUNIT graphics option, then that unit is the default unit. If you do not specify the GUNIT= graphics option, then the default unit is CELLS. See Using Options That Can Reset Other Options on page 293 for details 4 Alias: M=(x,y) <units> Featured in: Example 2. Specifying Logarithmic Axes on page 296 and Example 6. Enhancing Titles on page 307 Restriction: Not supported by Java and ActiveX ROTATE=degrees species the angle at which each character of text is rotated with respect to the baseline of the text string. The angle is measured from the current text baseline angle, which is specied by the ANGLE= or LANGLE= options. By default, the baseline is horizontal. A positive value for degrees rotates the character counterclockwise; a negative value rotates it clockwise. By default, ROTATE=0 (parallel to the baseline). Figure 14.30 on page 289 shows how characters are positioned when ROTATE=90 is used with the default (horizontal) baseline.
Alias: R=degrees
the option ANGLE= on page 280 Featured in: Example 6. Enhancing Titles on page 307 Restriction: Not supported by Java and ActiveX
See also:
text-string(s) is one or more strings up to 200 characters. You must enclose text strings in single or double quotation marks. The text appears exactly as you type it in the statement, including uppercase and lowercase characters and blanks. To use single quotation marks or apostrophes within the title, you can either 3 use a pair of single quotation marks together:
footnote Alls Well That Ends Well;
R O T A T E
290
Chapter 14
Because FOOTNOTE, NOTE, and TITLE statements concatenate all text strings, the strings must contain the correct spacing. With a series of strings, add blanks at the beginning of a text string rather than at the end, as in this example:
note color=red "Sales:" color=blue " 2000";
With some fonts, you produce certain characters by specifying a hexadecimal value. A trailing x identies a string as a hexadecimal value. For example, this statement* produces the title Profits Increase 3,000:
title font=swiss "Profits Increase " "18x "3,000";
For more information see Specifying Special Characters Using Character and Hexadecimal Codes on page 158. In addition, you can embed one or more of the following in the string: #BYLINE substitutes the entire BY line without leading or trailing blanks for #BYLINE in the text string, and displays the BY line in the footnote, note, or title produced by the statement. #BYVALn | #BYVAL(BY-variable-name) substitutes the current value of the specied BY variable for #BYVAL in the text string and displays the value in the footnote, note, or title produced by the statement. Specify the variable with one of these: n species which variable in the BY statement #BYVAL should use. The value of n indicates the position of the variable in the BY statement. For example, #BYVAL2 species the second variable in the BY statement. names the BY variable. For example, #BYVAL(YEAR) species the BY variable, YEAR. Variable-name is not case sensitive.
BY-variablename
Charts on page 309 and Example 9. Combining Graphs and Reports in a Web Page on page 315 #BYVARn | #BYVAR(BY-variable-name) substitutes the name of the BY-variable or label associated with the variable (whatever the BY line would normally display) for #BYVAR in the text string and displays the name or label in the footnote, note, or title produced by the statement. Specify the variable with one of these: n species which variable in the BY statement #BYVAR should use. The value of n indicates the position of the variable in the BY statement. For example, #BYVAR2 species the second variable in the BY statement.
BY-variablename
names the BY variable. For example, #BYVAR(SITES) species the BY variable, SITES. Variable-name is not case sensitive. A BY variable name displayed in a title, note, or footnote is always in uppercase. If a label is used, it appears as specied in the LABEL statement.
SAS/GRAPH Statements
291
For more information , see Substituting BY Line Values in a Text String on page 293 UNDERLIN=0...3 underlines subsequent text. Values of 1, 2 and 3 underline with an increasingly thicker line. UNDERLIN=0 halts underlining for subsequent text. Underlines follow the text baseline. If you use an LANGLE= or ANGLE= option for the line of text, the underline is drawn at the same angle as the text. Underlines do not break up to follow rotated characters. See the option ROTATE= on page 289. To make the text and the underline the same color, specify a COLOR= option before the UNDERLIN= option that precedes the text string. To make the text a different color, specify the COLOR= option after the UNDERLIN= option. Note: The UNDERLIN= option can be reset by the ANGLE= or JUSTIFY= option, or by the MOVE= option with absolute coordinates. See Using Options That Can Reset Other Options on page 293 for details. Note: The Java applet and ActiveX control underline text when the UNDERLIN= option is specied, but they do not vary the thickness of the line.
4
Alias: U= Featured in: Example 6. Enhancing Titles on page 307 Restriction: Partially supported by Java and ActiveX
WRAP wraps the text to a second line if the text does not t on one line. If the WRAP option is omitted, the text font-size is reduced until the text ts on one line. Wrapping occurs at the last blank before the text meets the end of the window. If there are no blanks in the text string, then there is no wrapping. Restriction: The WRAP option does not work with the BOX, BLANK, UNDERLINE, and MOVE options.
But remember that this cancels all other existing statements of a higher number.
292
Chapter 14
To cancel all current TITLE or FOOTNOTE statements, use the RESET= graphics option in a GOPTIONS statement:
goptions reset=footnote;
Specifying RESET=GLOBAL or RESET=ALL also cancels all current TITLE and FOOTNOTE statements as well as other settings.
3 The end of the statement is reached. 3 A new specication is made for that option.
For example, this statement species that one part of the note is red and another part is blue, but the height for all of the text is 4:
note height=4 color=red "Red Tide" color=blue " Effects on Coastal Fishing";
Setting Defaults
You can set default characteristics for titles (including TITLE1 denitions), footnotes, and notes by using the following graphics options in a GOPTIONS statement: CTITLE=color sets the default color for all titles, footnotes, and notes; overridden by the COLOR= option in a TITLE, FOOTNOTE, or NOTE statement. CTEXT=text-color sets the default color for all text; overridden by the CTITLE= option for titles, footnotes, and notes. FTITLE=title-font sets the default font for TITLE1 denitions; overridden by the FONT= option in the TITLE1 statement. FTEXT=text-font sets the default font for all text, including the TITLE1 statement if the FTITLE= option is not used; overridden by the FONT= option a TITLE, FOOTNOTE, or NOTE statement.
SAS/GRAPH Statements
293
HTITLE=height<units> sets the default height for TITLE1 denitions; overridden by the HEIGHT= option in the TITLE1 statement. HTEXT=n<units> sets the default height for all text, including the TITLE1 statement if the HTITLE= option is not used; overridden by the HEIGHT= option a TITLE, FOOTNOTE, or NOTE statement. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a complete description of each option.
If in a TITLE, FOOTNOTE, or NOTE statement, before the rst text string, you use an option that can be reset (such as the UNDERLIN= option) and before the second string you use an option that resets it (such as the JUSTIFY= option), the rst option does not affect the second string. In order for the rst option to affect the second string, repeat the option and position it after the resetting option and before the text string. For example, this statement produces a two-line title in which only the rst line is underlined:
title underlin=2 "Line 1" justify=left "Line 2";
To underline Line 2, repeat the UNDERLIN= option before the second text string and after the JUSTIFY= option:
title underlin=2 "Line 1" justify=left underlin=2 "Line 2";
294
Chapter 14
when ABC is not a BY-variable or does not exist), or if there is no BY statement at all, the substitution for #BYVAR or #BYVAL does not occur. No error or warning message is issued and the option specication is displayed with the rest of the string. The graph continues to display a BY line at the top of the page unless you suppress it by using the NOBYLINE option in an OPTION statement. For more information, see BY Statement on page 214. Note: This feature is not available in the DATA Step Graphics Interface or in the Annotate facility since BY lines are not created in a DATA step. 4
This example uses SAS datetime values with an AXIS statements ORDER= option to set the major tick marks on the horizontal axis. It adjusts the position of the rst and last major tick marks.
SAS/GRAPH Statements
295
The example also uses HILOCTJ interpolation in a SYMBOL statement to join minimum and maximum values. Set the graphics environment.. BORDER draws a border around the graph.
goptions reset=all border;
Create the data set. DOWHLC contains the high, low, and close values of the Dow Jones Industrial index for each business day for a month.
data dowhlc; input date date9. high low close; format date date9.; datalines; 02JAN1997 6511.38 6318.96 6442.49 03JAN1997 6586.42 6437.10 6544.09 06JAN1997 6647.22 6508.30 6567.18 07JAN1997 6621.82 6481.75 6600.66 08JAN1997 6650.30 6509.84 6549.48 09JAN1997 6677.24 6520.23 6625.67 10JAN1997 6725.35 6530.62 6703.79 13JAN1997 6773.45 6647.99 6709.18 14JAN1997 6816.17 6689.94 6762.29 15JAN1997 6800.77 6669.93 6726.88 16JAN1997 6818.47 6688.40 6765.37 17JAN1997 6863.88 6732.66 6833.10 20JAN1997 6839.13 6777.30 6843.87 21JAN1997 6934.69 6771.14 6883.90 22JAN1997 6913.14 6801.16 6850.03 23JAN1997 6953.55 6724.19 6755.75 24JAN1997 6798.08 6629.91 6696.48 27JAN1997 6748.82 6598.73 6660.69 28JAN1997 6823.48 6612.20 6656.08 29JAN1997 6673.39 6627.98 6740.74 30JAN1997 6845.03 6719.96 6823.86 31JAN1997 6912.37 6769.99 6813.09 ;
Prepare the data for a high-low plot. DOWHLC2 generates three records for each date, storing each dates high, low, and close values in variable DOW.
data dowhlc2; set dowhlc; drop high low close; dow=high; output; dow=low; output; dow=close; output; run;
Dene titles and footnote. JUSTIFY=RIGHT in the FOOTNOTE statement causes the footnote to be displayed in the bottom right.
title1 "Dow Jones High-Low-Close"; title2 "January, 1997"; footnote justify=right "GAXTMDV1 ";
Dene symbol characteristics. INTERPOL=HILOCTJ species that the minimum and maximum values of DOW are joined by a vertical line with a horizontal tick mark at each end. The close values are joined by straight lines. The CV= option controls the
296
Chapter 14
color of the symbol. The CI= and WIDTH= options control the color and the thickness of the line that joins the close points.
symbol interpol=hiloctj cv=red ci=blue width=2;
Dene characteristics of the horizontal axis. The ORDER= option uses a SAS date value to set the major tick marks. The OFFSET= option moves the rst and last tick marks to make room for the tick mark value.
axis1 order=("30DEC1996"d to "03FEB1997"d by week) offset=(3,3) label=none ;
Dene characteristics of the vertical axis. LABEL=NONE suppresses the AXIS label.
axis2 label=none offset=(2,2);
Generate the plot and assign AXIS denitions. The HAXIS= option assigns AXIS1 to the horizontal axis, and the VAXIS= option assigns AXIS2 to the vertical axis.
proc gplot data=dowhlc2; plot dow*date / haxis=axis1 vaxis=axis2; run; quit;
SAS/GRAPH Statements
297
This example illustrates the AXIS statement options LOGBASE= and LOGSTYLE=. The horizontal axis represents pH level. The vertical axis, which represents the concentration of the hydroxide ion expressed as moles per liter, is scaled logarithmically. In addition, this example shows how the TICK= parameter of the VALUE= option modies individual tick marks. The example uses the MOVE= option in a TITLE statement to position the titles subscript and superscript text. Set the graphics environment. The GUNIT option species the default unit of measure to use with height specications.
goptions reset=all gunit=pct;
Create the data set. The CONCENTR option contains the pH values and the concentration amount.
data concentr; input ph conc; datalines; 1 1E-1 2 1E-2 3 1E-3 4 1E-4 5 1E-5 6 1E-6 7 1E-7 8 1E-8 9 1E-9 10 1E-10 11 1E-11 12 1E-12 13 1E-13 14 1E-14 ;
run;
298
Chapter 14
Dene title and footnote. The MOVE= option positions subscript 3 and superscript +. Each new position is relative to the last position specied by the MOVE= option.
title1 h=3.7 "Relationship of pH to H" move=(-0,-.75) h=2 "3" move=(+0,+.75) h=2 "O" move=(+0,+.75) h=2 "+" move=(-0,-.75) h=2 " Concentration";
Dene characteristics for horizontal axis. The LABEL= option uses the JUSTIFY= suboption to create a descriptive two-line label that replaces the variable name PH. MINOR=NONE removes all minor tick marks. The LENGTH= option controls the length of the horizontal axis. The OFFSET= option species the distance from the rst and last major tick marks to the ends of the axis line.
axis1 label=(h=3 "Scale of pH Values" justify=left color=red h=2 "More acid" justify=right color=blue "More alkaline") minor=none length=60 offset=(2,2);
Dene characteristics for vertical axis. LOGBASE=10 scales the vertical axis logarithmically, using a base of 10. Each major tick mark represents a power of 10. LOGSTYLE=EXPAND displays minor tick marks in logarithmic progression. The LABEL= option uses the ANGLE= suboption to place the label parallel to the vertical axis. The VALUE= option displays the major tick mark values as 10 plus an exponent. The HEIGHT= suboption for each TICK= specication affects only the text following it.
axis2 logbase=10 logstyle=expand label=(angle=90 h=2 color=black "Concentration (Moles/Liter)" ) value=(tick=1 "10" height=1.2 "-14" tick=2 "10" height=1.2 "-13" tick=2 "10" height=1.2 "-13" tick=3 "10" height=1.2 "-12" tick=4 "10" height=1.2 "-11" tick=5 "10" height=1.2 "-10" tick=6 "10" height=1.2 "-9" tick=7 "10" height=1.2 "-8" tick=8 "10" height=1.2 "-7" tick=9 "10" height=1.2 "-6" tick=10 "10" height=1.2 "-5" tick=11 "10" height=1.2 "-4" tick=12 "10" height=1.2 "-3" tick=13 "10" height=1.2 "-2" tick=14 "10" height=1.2 "-1") offset=(3,3);
Generate the plot and assign AXIS denitions. AXIS1 modies the horizontal axis and AXIS2 modies the vertical axis. The AUTOHREF and AUTOVREF options draw
SAS/GRAPH Statements
299
reference lines at all major tick marks on both axes. The CHREF and CVREF options specify the color for these reference lines.
proc gplot data= concentr; plot conc*ph / haxis=axis1 vaxis=axis2 autohref chref=graydd autovref cvref=graydd; run; quit;
300
Chapter 14
This example species a plot symbol on a SYMBOL statement and rotates the symbol through the specied color list. Temperature values in the data are represented by the same plot symbol in a different color. The example also shows how default symbol sequencing provides a default plot symbol if a plot needs more plot symbols than are dened. It also uses a LEGEND statement to specify a two-line legend label, and to align the label with the legend values. Set the graphics environment. The COLORS= option species the color list. This list is used by the SYMBOL statement.
goptions reset=all border colors=(black blue green red) ;
Create the data set. BACTERIA contains information about the number and size of bacterial divisions at various temperatures.
data bacteria; input temp div mass life @@; datalines; 10 3 10 1 20 22 46 0 30 23 20 10 1 11 2 20 01 44 2 30 21 31 10 4 14 3 20 13 32 4 30 24 34 10 2 09 2 20 12 40 6 30 26 29 10 3 08 3 20 09 33 8 30 24 38 10 2 09 1 20 08 38 1 30 25 47 10 4 10 3 20 15 42 3 30 29 30 10 3 11 2 20 20 36 5 30 28 31 10 2 15 3 20 19 35 7 30 26 25 10 4 12 3 20 14 33 2 30 27 22 10 4 13 3 20 12 37 4 30 26 33 10 2 17 1 20 10 39 6 30 25 43 10 3 14 1 20 08 38 4 30 28 34 10 1 12 1 20 06 41 2 30 26 32 10 1 11 4 20 09 32 2 30 27 31 10 1 20 2 20 11 32 5 30 25 32 10 4 09 2 20 13 39 1 30 28 29 10 3 02 2 20 09 32 5 30 26 32 10 2 05 3 20 07 35 4 30 24 35 10 3 08 1 20 05 38 6 30 23 28 ; proc sort data=bacteria; by temp; run;
9 10 9 8 11 14 14 9 11 8 9 13 8 14 8 16 12 9 15 9
40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40
42 41 43 42 39 38 35 40 39 36 42 40 38 36 39 41 43 39 37 35
16 14 22 20 23 18 22 26 25 23 27 29 28 21 22 22 19 22 25 28
16 12 14 16 18 12 14 15 17 12 14 16 14 12 12 15 15 15 14 16
50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50
33 31 34 26 34 43 39 28 26 27 26 35 28 21 37 35 28 36 24 33
20 21 24 29 38 44 20 31 15 22 33 43 34 22 31 22 29 22 35 28
6 7 2 4 2 1 8 0 4 3 5 7 4 2 2 5 1 5 4 6
Dene title and footnote.J= breaks the title into two lines. H= species the size of the title.
title1 "Effect of Temperature on the Number" j=c h=2 "and Size of Bacterial Divisions"; footnote1 j=r "GSYRPSC1";
Dene symbol shape. The VALUE= option species a dot for the plot symbol. Because no color is specied, the symbol is rotated through the color list. Because the plot needs a fth symbol, the default plus sign is rotated into the color list to provide that symbol.
symbol1 value=dot;
SAS/GRAPH Statements
301
Dene legend characteristics. The LABEL= option species text for the legend label. J=L species a new line and left-justies the second string under the rst. The POSITION= option aligns the top label line with the rst (and in this case only) value row.
legend1 label=(position=(top left) "Temperature" j=l "(Celsius)") ;
302
Chapter 14
This example shows how to create box plots and how to specify SYMBOL denitions so data outside the box-plot range can be represented with data points. It also shows how to change a box plots percentile range to see whether the new range encompasses the data. The rst plot in the example uses a SYMBOL denition with INTERPOL=BOXT20 to specify a box plot with whisker tops at the 80th percentile and whisker bottoms at the 20th percentile. Data points that are outside this percentile range are represented with squares. As illustrated in the following output, the example then changes the SYMBOL denition to INTERPOL=BOXT10, which expands the whisker range to the 90th percentile for tops and the 10th percentile for bottoms. There are no data points outside the new percentile range.
SAS/GRAPH Statements
303
Create the data set. GRADES contains codes to identify each class section, and the grades scored by students in each section.
data grades; input section $ grade datalines; A 74 A 89 A 91 A 76 A 87 A B 72 B 72 B 84 B 81 B 97 B C 62 C 74 C 71 C 87 C 68 C ; @@; 93 A 93 A 96 A 55 78 B 88 B 90 B 74 78 C 80 C 85 C 82
Dene symbol characteristics. INTERPOL=BOXT20 species a box plot with tops and bottoms on its whiskers, and the high and low bounds at the 80th and 20th percentiles. The CO= option colors the boxes and whiskers. The BWIDTH= option affects the width of the boxes. The VALUE= option species the plot symbol that marks the data points outside the range of the box plot. The CV= option colors the plot symbols. The HEIGHT= option species a symbol size.
symbol interpol=boxt20 co=blue bwidth=4 value=square cv=red height=2; /* /* /* /* /* /* box plot box and whisker color box width plot symbol plot symbol color symbol height */ */ */ */ */ */
304
Chapter 14
Change symbol characteristics. INTERPOL=BOXT10 changes the high and low bounds to the 90th percentile at the top and the 10th percentile on the bottom. All other symbol characteristics remain unchanged.
symbol interpol=boxt10 width=2;
SAS/GRAPH Statements
305
This example shows how to ll the area between two plot lines by concatenating two data sets into one to form a polygon with the data points. It uses a SYMBOL statement to specify a pattern to ll the polygon and to determine the color of the area ll and the outline around the area. The example plots yearly highs and lows for the Dow Jones Industrial Average. It separates the dependent variables HIGH and LOW to produce an upper plot line and a lower plot line. The dependent variable is named VALUE and the independent variable is named YEAR. When concatenated into one data set, AREA, the data sets form the polygon. Set the graphics environment.
goptions reset=all border;
Create the data set. STOCKS contains yearly highs and lows for the Dow Jones Industrial Average, and the dates of the high and low values each year.
data stocks; input year @7 hdate date9. @17 high @26 ldate date9. @36 low; format hdate ldate date9.; datalines; 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 20NOV1980 27APR1981 27DEC1982 29NOV1983 06JAN1984 16DEC1985 02DEC1986 25AUG1987 21OCT1988 09OCT1989 16JUL1990 31DEC1991 01JUN1992 29DEC1993 31JAN1994 1000.17 1024.05 1070.55 1287.20 1286.64 1553.10 1955.57 2722.42 2183.50 2791.41 2999.75 3168.83 3413.21 3794.33 3978.36 21APR1980 25SEP1981 12AUG1982 03JAN1983 24JUL1984 04JAN1985 22JAN1986 19OCT1987 20JAN1988 03JAN1989 11OCT1990 09JAN1991 09OCT1992 20JAN1993 04APR1994 759.13 824.01 776.92 1027.04 1086.57 1184.96 1502.29 1738.74 1879.14 2144.64 2365.10 2470.30 3136.58 3241.95 3593.35
306
Chapter 14
1995 ;
13DEC1995 5216.47
30JAN1995 3832.08
Restructure the data so that it denes a closed area. Create the temporary data sets HIGH and LOW.
data high(keep=year value) low(keep=year value); set stocks; value=high; output high; value=low; output low; run;
Dene symbol characteristics. The INTERPOL= option species a map/plot pattern to ll the polygon formed by the data points. The pattern consists of medium-density parallel lines at 90 degrees. The CV= option colors the pattern ll. The CO= option colors the outline of the area. (If the CO= option is not used, the outline is the color of the area.)
symbol interpol=m3n90 cv=red co=blue;
Dene axis characteristics. The ORDER= option places the major tick marks at 5-year intervals.
axis1 order=(1980 to 1995 by 5) label=none major=(height=2) minor=(number=4 height=1) offset=(2,2) width=3; axis2 order=(0 to 5500 by 500) label=none major=(height=1.5) offset=(0,0) minor=(number=1 height=1);
SAS/GRAPH Statements
307
This example illustrates some ways you can format title text. The same options can be used to format footnotes. Set the graphics environment. BORDER draws a border around the graph.
goptions reset=all border;
Dene title1. TITLE1 uses the default font and height dened in the default style. The HEIGHT= option sets the height of the text.
title1 "This is TITLE1" height=4;
308
Chapter 14
Dene TITLE5. The ANGLE= option tilts the line of text clockwise 90 degrees and places it at the right edge of the output.
title5 color=red angle=-90 "TITLE5 is Angled -90";
Dene TITLE7. The ROTATE= option rotates each character in the text string at the specied angle. The HEIGHT= option sets the height of the text.
title7 height=4 color=red rotate=25 "TITLE7 is Rotated";
Dene TITLE8. The BOX= option draws a green box around the text.
title8 color=green box=1 "TITLE8 is Boxed";
Dene TITLE9. The BLANK= option prevents the boxed title from being overwritten by TITLE10. The rst COLOR= option species the color of the box border, and the BCOLOR= option species the color of the box background. The second COLOR= option species the text color.
title9 color=red box=3 blank=yes bcolor=red color=blue move=(70,20) angle=-25 "TITLE9 is Angled in a Red Box";
Dene TITLE10. In this statement, the BOX= option draws a box around the rst text string. The BOX= option is turned off by the MOVE= option that uses absolute coordinates and causes a text break.
title10 color=red box=1 bcolor=blue move=(60,20) font=script "TITLE10 is in Script and " move=(60,15) height=2 "is Partially Boxed, Positioned" move=(60,10) height=2 "with Explicit Moves, and Overlaid by TITLE9" ;
SAS/GRAPH Statements
309
Dene footnote.
footnote justify=right "GTIENTI1 ";
Display titles and footnote. All existing titles and footnotes are automatically displayed by the procedure.
proc gslide; run; quit;
Create the data set GRAINLDR. GRAINLDR contains data about grain production in ve countries for 1995 and 1996. The quantities in AMOUNT are in thousands of metric tons. MEGTONS converts these quantities to millions of metric tons.
310
Chapter 14
data grainldr; length country $ 3 type $ 5; input year country $ type $ amount; megtons=amount/1000; datalines; 1995 BRZ Wheat 1516 1995 BRZ Rice 11236 1995 BRZ Corn 36276 1995 CHN Wheat 102207 1995 CHN Rice 185226 1995 CHN Corn 112331 1995 INS Wheat . 1995 INS Rice 49860 1995 INS Corn 8223 1995 USA Wheat 59494 1995 USA Rice 7888 1995 USA Corn 187300 1996 BRZ Wheat 3302 1996 BRZ Rice 10035 1996 BRZ Corn 31975 1996 IND Wheat 62620 1996 IND Rice 120012 1996 IND Corn 8660 1996 USA Wheat 62099 1996 USA Rice 7771 ;
Suppress the default BY line and dene a title that includes the BY-value. #BYVAL inserts the value of the BY variable COUNTRY into the title of each report.
options nobyline; title1 "Leading #byval(type) Producers" j=c "1995 and 1996"; footnote1 j=r "GBYGMSC1 ";
Dene the axis characteristics for the response axes. The ORDER= option species the range of values for the response axes. ANGLE=90 in the LABEL= option rotates the label 90 degrees. All the other options remove axis elements. The MAJOR=, MINOR=, and VALUE= options remove the tick marks and values. STYLE=0 removes the line. The NOPLANE option removes the three-dimensional plane.
axis1 order=(0 to 550 by 100) label=(angle=90 "Millions of Metric Tons") major=none
SAS/GRAPH Statements
311
Dene midpoint axis characteristics. The SPLIT= option denes the character that causes an automatic line break in the axis values.
axis2 label=none split=" ";
Sort data according to values of BY variable. The data must be sorted before running PROC GCHART with the BY statement.
proc sort data=grainldr out=temp; by type; run;
Generate the vertical bar charts using a BY statement. The BY statement produces a chart for each value of SITE. The FORMAT statement assigns the $COUNTRY. format to the chart variable. Assigning AXIS1 to the RAXIS= option causes all three charts to have the same response axis.
proc gchart data=temp (where=(megtons gt 31)); by type; format country $country.; vbar3d country / sumvar=megtons outside=sum descending shape=hexagon width=8 coutline=black cframe=grayaa maxis=axis2 raxis=axis1 name="GBYGMSC1"; run; quit;
312
Chapter 14
Display 14.1
Display 14.2
SAS/GRAPH Statements
Example 8. Creating a Simple Web Page with the ODS HTML Statement
313
Display 14.3
Example 8. Creating a Simple Web Page with the ODS HTML Statement
Features: ODS HTML statement options: BODY= CLOSE GOPTIONS statement options: RESET= LEGEND statement options: ACROSS= LABEL= Sample library member: GONCSWB1
314
Example 8. Creating a Simple Web Page with the ODS HTML Statement
Chapter 14
Display 14.4
This example illustrates the simplest way to use the ODS HTML statement to create an HTML le and a GIF le that you can display in a Web browser. It generates one body le that displays one piece of SAS/GRAPH outputa map of average per capita income. This example also illustrates default pattern behavior with maps and explicit placement of the legend on the graph. It shows how the default solid map pattern uses different shades of the default style color to differentiate between countries. And it shows how to use a LEGEND statement to arrange and position a legend so it ts well with the graphs layout. Close the ODS Listing destination for procedure output, and set the graphics environment. To conserve system resources, ODS LISTING CLOSE closes the Listing destination for procedure output. Thus, the graphics output is not displayed in the GRAPH window, although it is written to the graphics catalog and to the GIF les.
ods listing close; goptions reset=all;
Open the ODS HTML destination. The BODY= option names the le for storing HTML output.
ods html body="na_body.html" ;
Dene title for the map. By default, any dened title is included in the graphics output (GIF le).
title "North America Gross National Income per Capita 2004";
SAS/GRAPH Statements
315
Dene legend characteristics. The ACROSS= option denes the number of columns in the legend. The LABEL= option species a legend label and left-justies it above the legend values.
legend across=2 origin=(8,5) mode=share label=(position=top justify=left "Gross National Income per Capita") ;
Generate the prism map. Because the NAME= option is omitted, SAS/GRAPH assigns the default name GMAP to the GRSEG entry in the graphics catalog. This is the name that is assigned to the GIF le created by the ODS HTML statement.
proc gmap map=maps.namerica data=sashelp.demographics; id cont id; format gni dollar10.0; choro gni / levels=10 legend=legend1; run; quit;
Close the ODS HTML destination, and open the ODS Listing destination. You must close the HTML destination before you can view the output with a browser. ODS LISTING opens the Listing destination so that the destination is again available for displaying output during this SAS session.
ods html close; ods listing;
316
Chapter 14
#BYVAL Sample library member: GONCGRW1 This example generates several graphs of sales data that can be accessed from a single Web page. The graphs are two bar charts of summary sales data and three pie charts that break the data down by site. Each bar chart and an accompanying report is stored in a separate body le. The three pie charts are generated with BY-group processing and are stored in one body le. The program suppresses the default BY lines and instead includes the BY variable value in the title for each chart. The SAS/GRAPH titles are displayed in the HTML output instead of in the graphics output. The Web page contains two frames, one that displays a Table of Contents for all the graphs, and one that serves as the display area. Links to each piece of output appear in the table of contents, which is displayed in the left frame. Initially the frame le displays the rst body le, which contains a bar chart and a report, as shown in the following gure.
Display 14.5 Browser View of Bar Chart and Quarterly Sales Report
Notice that the chart title is displayed outside the graph as part of the HTML le. Select the link to Total Department Sales to display the second bar chart, as shown in the following gure.
SAS/GRAPH Statements
317
Display 14.6
Selecting any link for Department Sales displays the corresponding pie chart as shown in the following gure.
Display 14.7 Browser View of Pie Charts of Site Sales
Because the pie charts are stored in one le, you can easily see all three by scrolling through the le. Additional features include AXIS statements that specify the same length for both midpoint axes, so that the bar charts are the same width even though they have a different number of bars. Close the ODS Listing destination for procedure output, and set the graphics environment. To conserve system resources, ODS LISTING CLOSE closes the Listing destination for procedure output. DEVICE=GIF causes the ODS HTML statement to generate the graphics output as GIF les. The TRANSPARENCY option causes the graphics output to use the Web-page background as the background of the graph. The
318
Chapter 14
BORDER option is used so that the border around the graphics output area is compatible with the borders that are created for nongraphics output.
ods listing close; goptions reset=all border ;
Create the data set TOTALS. The data set contains quarterly sales data for three manufacturing sites for one year.
data totals; length Dept $ 7 Site $ 8; input Dept Site Quarter Sales; datalines; Repairs Repairs Tools Tools Tools Parts Parts Repairs Repairs Tools Tools Parts Parts Tools Tools Parts Parts Parts Repairs Repairs ; Sydney Atlanta Sydney Atlanta Paris Atlanta Paris Sydney Paris Atlanta Paris Sydney Paris Atlanta Paris Sydney Atlanta Paris Atlanta Paris 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 5592.82 9210.21 1775.74 2424.19 5914.25 11595.07 9558.29 5505.31 7538.56 1903.99 7868.34 8437.96 6789.85 3048.52 9017.96 6065.57 9388.51 8509.08 2088.30 5530.37
Open the ODS HTML destination. The FRAME= option names the HTML le that integrates the contents and body les. The CONTENTS= option names the HTML le that contains the table of contents to the HTML procedure output. The BODY= option names the le for storing the HTML output. The contents le links to each of the body les written to the HTML destination. The NOGTITLE option suppresses the graphics titles from the SAS/GRAPH output and displays them through the HTML page.
ods html frame="sales_frame.html" contents="sales_contents.html" body="sales_body1.html" nogtitle;
Dene axis characteristics for the rst bar chart. In AXIS2, the LENGTH= option species the length of the midpoint axis.
axis1 order=(0 to 60000 by 20000) minor=(number=1)
SAS/GRAPH Statements
319
Suppress the legend label and dene the size of the legend values.
legend1 label=none shape=bar(4,4);
Generate the vertical bar chart of quarterly sales. The NAME= option species the name of the catalog entry.
proc gchart data=totals; format sales dollar8.; vbar3d quarter / discrete sumvar=sales shape=cylinder subgroup=site cframe=grayaa caxis=black width=12 space=4 legend=legend1 maxis=axis2 raxis=axis1 des="Total Quarterly Sales" name="salesqtr"; run; quit;
Sort the data set for the report of quarterly sales. The data must be sorted in order of the BY variable before running PROC REPORT with BY-group processing.
proc sort data=totals out=qtrsort; by quarter site; run;
Reset the footnote and suppress the BY line. We suppress the BY line because otherwise #BYVAL inserts the value of the BY variable into the title of each report.
footnote1; options nobyline;
Generate a report of quarterly sales. Because the HTML body le that references the GCHART procedure output is still open, the report is stored in that le. The chart and report are shown in Display 14.5 on page 316.
title1 "Sales for Quarter #byval(quarter)"; proc report data=qtrsort nowindows; by quarter; column quarter site dept sales; define quarter / noprint group; define site / display group; define dept / display group; define sales / display sum format=dollar8.; compute after quarter; site="Total"; endcomp;
320
Chapter 14
break after site / summarize style=rowheader; break after quarter / summarize style=rowheader; run;
Open a new body le for the second bar chart and report. Assigning a new body le closes SALES_BODY1.HTML. The contents and frame les, which remain open, contains links to all body les.
ods html body="sales_body2.html";
Dene axis characteristics. These AXIS statements replace the ones dened earlier. As before, the LENGTH= option denes the length of the midpoint axis.
axis1 label=none minor=(number=1); order=(0 to 100000 by 20000) axis2 label=none length=70pct;
Sort the data set for the report of department sales. The data must be sorted in order of the BY variable before running PROC REPORT with BY-group processing.
proc sort data=totals out=deptsort; by dept site; run;
Reset the footnote, dene a report title, and generate the report of department sales. #BYVAL inserts the value of the BY variable into the title of each report. The chart and report are shown in Display 14.5 on page 316.
footnote1; title1 "Sales for #byval(dept)"; proc report data=deptsort nowindows; by dept; column dept site quarter sales; define dept / noprint group; define site / display group;
SAS/GRAPH Statements
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web
321
define quarter / display group; define sales / display sum format=dollar8.; compute after dept; site="Total"; endcomp; break after site / summarize style=rowheader; break after dept / summarize style=rowheader; run;
Open a new body le for the pie charts. Assigning a new le as the body le closes SALES_BODY2.HTML. The contents and frame les remain open. GTITLE displays the titles in the graph.
ods html body="sales_body3.html" gtitle;
Sort data set in order of the BY variable before running the GCHART procedure with BY-group processing.
proc sort data=totals out=sitesort; by site; run;
Dene title and footnote. #BYVAL inserts the value of the BY variable SITE into the title for each output.
title "Departmental Sales for #byval(site)"; footnote j=r "salespie ";
Generate a pie chart for each site. All the procedure output is stored in one body le. Because BY-group processing generates multiple graphs from one PIE3D statement, the name assigned by the NAME= option is incremented to provide a unique name for each piece of output.
proc gchart data=sitesort; format sales dollar8.; by site; pie3d dept / noheading coutline=black sumvar=sales des="Department Sales" name="salespie"; run; quit;
Close the ODS HTML destination, and open the ODS Listing destination.
ods html close; ods listing;
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web
Features: GOPTIONS statement option: RESET= TRANSPARENCY= DEVICE=
322
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web
Chapter 14
ODS HTML statement options: BODY= NOGTITLE PATH= Sample library member: GONDDCW1 This example shows you how to create a drill-down graph in which the user can select an area of the graph in order to display additional information about the data. The program creates one vertical bar chart of total sales for each site and three reports that break down the sales gures for each site by department and quarter. The following gure shows the bar chart of sales.
Display 14.8 Vertical Bar Chart of Total Sales
Display 14.9 on page 323 shows the PROC REPORT output that appears when you click on the bar for Atlanta.
SAS/GRAPH Statements
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web
323
Display 14.9
For additional information about this program, see Details on page 325. Close the ODS Listing destination for procedure output, and set the graphics environment. To conserve system resources, ODS LISTING CLOSE closes the Listing destination for procedure output. In the GOPTIONS statement, DEVICE=GIF causes the ODS HTML statement to generate the graphics output as GIF les. The TRANSPARENCY option causes the graphics output to use the Web-page background as the background of the graph.
ods listing close; goptions reset=all device=gif transparency noborder;
Add the HTML variable to TOTALS and create the NEWTOTAL data set. The HTML variable SITEDRILL contains the targets for the values of the variable SITE. Each HREF value species the HTML body le and the name of the anchor within the body le that identies the target graph.
data newtotal; set totals; length sitedrill $40; if site="Atlanta" then sitedrill="HREF=report_deptsales.html#IDX1"; else if site="Paris" then sitedrill="HREF=report_deptsales.html#IDX2"; if site="Sydney" then sitedrill="HREF=report_deptsales.html#IDX3"; run;
Open the ODS HTML destination. The BODY= option names the le for storing HTML output. The NOGTITLE option suppresses the graph titles from the SAS/GRAPH output and displays them in the HTML.
324
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web
Chapter 14
Assign a pattern color for the bars. Each bar in the graph uses the same PATTERN denition.
pattern color=cyan;
Dene axis characteristics. The VBAR3D statement assigns AXIS1 to the response axis and AXIS2 to the midpoint axis.
axis1 order=(0 to 80000 by 20000) minor=(number=1) label=none; axis2 label=none offset=(9,9);
Generate the vertical bar chart of total sales for each site. The HTML= option species SITEDRILL as the variable that contains the name of the target. Specifying the HTML= option causes SAS/GRAPH to add an image map to the HTML body le. The NAME= option species the name of the catalog entry.
proc gchart data=newtotal; format sales dollar8.; vbar3d site / discrete width=15 sumvar=sales inside=sum html=sitedrill coutline=black cframe=blue maxis=axis2 raxis=axis1 name="report3d "; run; quit;
Open the le for the PROC REPORT output. Assigning a new body le closes REPORT_BODY.HTML.
ods html body="report_deptsales.html" ;
Sort the data set NEWTOTAL. The data must be sorted in order of the BY variable before running PROC REPORT with BY-group processing.
proc sort data=newtotal; by site dept quarter; run; quit;
Suppress the default BY line and dene a title that includes the BY-value. #BYVAL inserts the value of the BY variable SITE into the title of each report.
SAS/GRAPH Statements
325
Close the ODS HTML destination, and open the ODS Listing destination.
ods html close; ods listing;
Details
This section provides additional information about the pieces of this program and how they work together to generate SAS/GRAPH output with drill-down functionality. It describes
3 how an HREF value is built 3 how the HTML= option creates an image map in the HTML le 3 how the HTML le references the SAS/GRAPH output.
The link target is specied by the HTML HREF attribute. The HREF value tells the Web page where to link to when a user selects the region associated with the value Atlanta. For example, clicking on the rst bar in the chart links to the target dened by report_deptsales.html#IDX1. This target consists of a lename and an anchor. The le, report_deptsales.html, is generated by the PROC REPORT step. IDX1 is the anchor that identies the section of the le that contains the report for the rst BY group, Atlanta.
326
Chapter 14
Because anchor names increment, in order to assign them accurately you must know how many pieces of output your program generates and in what order. For example, this table lists in order the pieces of output generated by this example and their default anchor names:
Procedure Output GCHART REPORT REPORT REPORT report3d.gif Atlanta report Paris report Sydney report Anchor name IDX IDX1 IDX2 IDX3
This option causes SAS/GRAPH to generate in the HTML body le the MAP and AREA elements that compose the image map. It loads the HREF attribute value from SITEDRILL into the AREA element. This image map, which is named gqcke00k_map, is stored in report_body.html (ODS generates unique map names each time you run the program, so the next time this program runs, the map name will be different):
<MAP NAME="gqcke00k_map"> <AREA SHAPE="POLY" HREF="report_deptsales.html#IDX3" COORDS="423,409,423,242,510,242,510,409" > <AREA SHAPE="POLY" HREF="report_deptsales.html#IDX2" COORDS="314,409,314,139,401,139,401,409" > <AREA SHAPE="POLY" HREF="report_deptsales.html#IDX1" COORDS="205,409,205,199,292,199,292,409" > < /MAP>
The AREA element denes the regions within the graph that you can select to link to other locations. It includes attributes that dene the shape of the region (the SHAPE= option) and position of the region (the COORDS= option) as well as the link target (the HREF= option). The value assigned to the HREF= attribute is contained in the variable assigned to the HTML= option, in this case SITEDRILL.
SAS/GRAPH Statements
327
The IMG element tells the Web page to get the image from the le report3d.gif. It also tells the Web page to use the image map #report3d_map to dene the hotspots of the bar chart.
328
329
CHAPTER
15
Graphics Options and Device Parameters Dictionary
Introduction 329 Specifying Graphics Options and Device Parameters 329 Specifying Units of Measurement 330 Dictionary of Graphics Options and Device Parameters 330
Introduction
This chapter provides a detailed description of all of the graphics options and device parameters used with SAS/GRAPH software. These include 3 all graphics options used by the GOPTIONS statement 3 all device parameters that can be specied as options in the ADD and MODIFY statements in the GDEVICE procedure 3 all device parameters that appear as elds in the GDEVICE windows. The descriptions provide the syntax, defaults, and required information for each option and parameter. The graphics options and device parameters are intermixed and listed alphabetically. When the graphics option and device parameter have the same name, they are discussed in the same dictionary entry and the description uses only that name and does not distinguish between the option and the parameter except where the distinction is necessary. For a list of all the graphics options, see GOPTIONS Statement on page 219. For a list of all the device parameters, see ADD Statement on page 1129. If the syntax for the graphics option and the device parameter is different, both forms are shown. If the syntax is the same, one form is shown.
330
Chapter 15
ACCESSIBLE
Generates descriptive text and summary statistics representing your graphics output.
Used in: GOPTIONS statement Default:
NOACCESSIBLE
Restriction:
Only supported by JAVA and ActiveX when used with the ODS HTML output destination.
Syntax
ACCESSIBLE | NOACCESSIBLE
ACCESSIBLE
enables you to comply with section 508 of the Rehabilitation Acts and meet usability requirements for disabled users. Specifying the ACCESSIBLE option, when used with the ODS HTML statement, generates descriptive text and data for your graphs. SAS/GRAPH writes accessibility information to the graphs output HTML le, and creates a left-justied footnote that provides a link to the information. The information and the link are not visible in the output HTML, however both are detected by accessibility aids, such as screen readers. You can also access the information by pressing the tab key and enter. The information will be displayed once you press enter on the link in the footnote. The information will also display if you move your mouse over the location of the leftjustied footnote, and click the link when the mouse pointer shape changes.
ACCESSIBLE
331
Figure 15.1
Accessible
NOACCESSIBLE
332
ADMGDF
Chapter 15
Figure 15.2
Noaccessible
ADMGDF
Species whether to write an ADMGDF or GDF le when the GSFNAME= and GSFMODE= graphics options are used with a GDDM device driver. GOPTIONS statement Default: NOADMGDF Restriction: GDDM device drivers on IBM mainframe systems only
Used in:
Syntax
ADMGDF | NOADMGDF
ADMGDF
ALTDESC
Species whether to write the DESCRIPTION= statement text to the ALT= text in an HTML le.
Used in: GOPTIONS statement
ASPECT
333
ALTDESC Restriction: Only supported when used with the HTML output destination and the DESCRIPTION= option.
Default:
Syntax
ALTDESC | NOALTDESC
ALTDESC
With ODS HTML output, by default the entire output has an HTML ALT tag that species which procedure was used, and which variables were plotted. Or, if you have specied text using the DESCRIPTION= option, then that value is used for the HTML ALT tag rather than the default ALT tag (many users add a textual description of the graph using this technique, to help the vision-impaired, and to help meet 508-compliance). If you prefer not to have an ALT tag for the entire graph, you can suppress it by specifying DESCRIPTION=" " (which might be more convenient on a graph by graph basis) or by using GOPTIONS NOALTDESC (which might be more convenient for turning them off for all graphs, such as putting this in your AUTOEXEC.BAT).
NOALTDESC
ASPECT
Sets the aspect ratio for graphics elements. GOPTIONS statement GDEVICE procedure GDEVICE Detail window devicedependent Restriction: not supported by Java or ActiveX
Used in: Default:
Syntax
ASPECT=scaling-factor
scaling-factor
is a non-negative integer or real number that determines the ratio of width to height for graphics elements. If you specify ASPECT=1, each graphics element has equal horizontal and vertical scaling factors; ASPECT=2 scales the graphics element twice as wide as its height; and so on. If ASPECT= is not specied or is set to 0 or null, SAS/GRAPH uses the aspect ratio of the hardware device.
Details
The aspect ratio affects many graphics characteristics, such as the shape of software characters and the roundness of pie charts. Some graphics drivers do not produce correct output if the aspect ratio is anything other than the default. When you use a
334
AUTOCOPY
Chapter 15
device that uses local scaling (that is, the device itself can scale the output, for example, some plotters), use ASPECT= to tell SAS/GRAPH the scaling factor. Note: You can get more reliable results if you use the default aspect ratio and use the HSIZE= and VSIZE= graphics options to set the dimensions. 4
AUTOCOPY
Species whether to generate hard copy automatically. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Defaults: GOPTIONS: NOAUTOCOPY; GDEVICE: AUTOCOPY=N Restrictions: device-dependent; not supported by Java or ActiveX
Used in:
Syntax
GOPTIONS: AUTOCOPY | NOAUTOCOPY GDEVICE: AUTOCOPY=Y | N
AUTOCOPY AUTOCOPY=Y
suppresses printing a copy of the graph. A blank Autocopy eld in the Parameters window is the same as AUTOCOPY=N.
Details
AUTOCOPY is used only for older terminals that have printers attached directly to the device.
AUTOFEED
Species whether devices with continuous paper or automatic paper feed should roll or feed the paper automatically for the next graph.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window
GOPTIONS: AUTOFEED (if a device is specied): GDEVICE: AUTOFEED=Y Restrictions: device-dependent; not supported by Java or ActiveX See also: PPDFILE
Defaults:
Syntax
GOPTIONS: AUTOFEED | NOAUTOFEED
AUTOSIZE
335
GDEVICE: AUTOFEED=Y | N
AUTOFEED AUTOFEED=Y
causes the device to feed new paper automatically for the next graph. A blank Autofeed eld in the Parameters window is the same as AUTOFEED=Y.
NOAUTOFEED AUTOFEED=N
Details
For PostScript devices, if AUTOFEED is unaltered, the PostScript le is unchanged. If you specify NOAUTOFEED and do not select a PPD le with the PPDFILE option, a PostScript Level 1 MANUALFEED command is added to the driver output. If you specify NOAUTOFEED and select a PPD that contains a MANUALFEED option, the procedure code for that MANUALFEED option is sent. If there is no MANUALFEED option in the PPD, no MANUALFEED code is sent. See PPDFILE on page 408.
AUTOSIZE
Controls whether to change the size of the character cells in order to preserve the number of rows and columns specied in the device entry. GOPTIONS statement Default: device-dependent Restriction: not supported by Java or ActiveX
Used in: See also: DEVOPTS
Syntax
AUTOSIZE=ON | OFF | DEFAULT
ON
changes the cell size in order to preserve the number of rows and columns.
OFF
preserves the devices original cell size and temporarily changes the number of rows and columns.
DEFAULT
uses the default setting (ON or OFF) that is controlled by DEVOPTS bit 50 (see DEVOPTS on page 352).
Details
AUTOSIZE is useful when you change the size of the graphics display area using one or more of the options PAPERSIZE, XPIXELS, YPIXELS, XMAX, or YMAX. It lets you
336
BINDING
Chapter 15
control image text size without using PROC GDEVICE. Typically, AUTOSIZE is on for most image drivers and off for all other types of drivers. Note: If you use HSIZE of VSIZE, the character cell size changes regardless of the AUTOSIZE setting. 4
BINDING
Species which edge of the document is the binding edge.
Used in: GOPTIONS statement OPTIONS statement Default:
DEFAULTEDGE
Restrictions: PostScript and PCL printers only. PostScript printers require a PPD le. Not supported by Java or ActiveX. See also: DUPLEX, PPDFILE
Syntax
BINDING=DEFAULTEDGE | LONGEDGE | SHORTEDGE
Details
BINDING controls how the page is ipped when DUPLEX is in effect. It does not change the orientation of the graph. DEFAULTEDGE refers to the harwares factory-default setting. LONGEDGE and SHORTEDGE refer to the papers long and short edges. For PostScript printers, a PPD le must also be specied, using the PPDFILE= option. The PPD le contains the command that SAS/GRAPH needs to request the appropriate binding method on the printer being used. If a PPD le is not specied, the BINDING= option is ignored because SAS/GRAPH will lack the command needed to request the binding method.
BORDER
Species whether to draw a border around the graphics output area.
Used in: GOPTIONS statement Default:
NOBORDER
Syntax
BORDER | NOBORDER
CBY
337
Details
The placement of the border on the display is dened by the HSIZE= and VSIZE= graphics options, if used. Otherwise the placement is dened by the XMAX and YMAX device parameters.
CBACK
Species the background color of the graphics output.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Gcolors window as specied in the Gcolors window
Syntax
CBACK=background-color
background-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
The CBACK= option is valid on all devices but can be ignored by some (for example, plotters). Specify the default in the Gcolors window of the device entry. Note: This option overrides the Background and Foreground style attributes in the graph styles. For more information on graph styles, refer to the TEMPLATE procedure documentation in SAS Output Delivery System: Users Guide. 4 If you explicitly specify a background color with the CBACK= option, the background color you select should contrast with the foreground colors. If the IBACK= option is in effect, an image will appear in the background in place of the color specied with the CBACK= option.
CBY
Selects the color of the By lines that appear in the graphics output.
Used in: Default: Restriction:
GOPTIONS statement (1) CTEXT= graphics option, if used; (2) rst color in current color list not supported by Java or ActiveX
Syntax
CBY=By line-color
338
CELL
Chapter 15
By line-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
When you use a BY statement with a SAS/GRAPH procedure to process a data set in subgroups, each graph produced by that procedure is headed by a By line that displays the BY variables and their values that dene the current subgroup.
CELL
Controls whether to use cell alignment.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window device-dependent not supported by Java or ActiveX
Restriction:
Syntax
GOPTIONS: CELL | NOCELL GDEVICE: CELL=Y | N
CELL CELL=Y
causes the device to use cell alignment. In that case SAS/GRAPH attempts to place hardware (or simulated hardware) characters inside character cells. This restriction on the location of characters means that in some cases the SAS/GRAPH procedure can generate axes that do not occupy the entire procedure output area or might be unable to create the requested graph. A blank Cell eld in the Parameters window is the same as CELL=Y.
NOCELL CELL=N
suppresses cell alignment, causing the procedure to use the entire procedure output area and place axis and tick mark labels without regard to cell alignment.
Details
Specify N in the device entry or use NOCELL in a GOPTIONS statement if you want to preview a graph on a cell-aligned display but intend to produce the nal graph on a device that is not cell-aligned, such as a pen plotter.
CHARREC
339
CHARACTERS
Species whether the deviceresident font is used when no font or FONT=NONE is specied in a SAS statement.
Used in: Defaults: Restriction:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window GOPTIONS: CHARACTERS; GDEVICE: CHARACTERS=Y not supported by Java or ActiveX
Syntax
GOPTIONS: CHARACTERS | NOCHARACTERS GDEVICE: CHARACTERS=Y | N
CHARACTERS CHARACTERS=Y
causes SAS/GRAPH to use the device-resident font when you do not specify a font in a SAS program. A blank Characters eld in the Parameters window is the same as CHARACTERS=Y.
NOCHARACTERS CHARACTERS=N
causes SAS/GRAPH to draw the characters using the SIMULATE font and suppresses the use of all deviceresident fonts, regardless of values you specify in other SAS statements.
Details
The deviceresident font is not used if you changed the HPOS= and VPOS= graphics options from the default, or if you used the HEIGHT= option in a SAS statement and the device does not have scalable characters.
CHARREC
Species a device-resident font by associating a CHARTYPE number with a device-resident font. Also denes a default size to use with that font.
Used in: Default:
Syntax
CHARREC=(charrec-list(s))
340
CHARTYPE
Chapter 15
charrec-list
a list of values that correspond to the elds in the Chartype window. Charrec-list has this form: type, rows, cols, font, Y | N type rows cols font is the CHARTYPE number and can be an integer from 0 to 9999. (See CHARTYPE on page 340 for more information.) is the number of rows of text in the font that will t on the display. (See ROWS on page 421 for more information.) is the number of columns of text in the font that will t on the display. (See COLS on page 344 for more information.) is a character string enclosed in quotation marks that contains the name of the corresponding device-resident font. (See FONT NAME on page 363 for more information.) represents a scalable font. A scalable font can be displayed at any size. (See SCALABLE on page 421 for more information.)
Y N
represents a nonscalable font. A nonscalable font can be displayed only at a xed size. (See SCALABLE on page 421 for more information.) For example, these values assign the devices Helvetica font to be the rst device-resident font in the CHARTYPE window of the driver entry:
charrec=(1, 100, 75, helvetica, y)
CHARTYPE
Selects the number of the default hardware character set.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window device-dependent not supported by Java or ActiveX
Restriction:
Syntax
CHARTYPE=hardware-font-chartype
hardware-font-chartype
is a nonnegative integer from 0 to 999. hardware-font-chartype refers to the actual number for the device-resident font you want to use as listed in the Chartype window of the device entry for the selected device driver. By default, CHARTYPE is 0, which is the default device-resident font for the device.
CMAP
341
CIRCLEARC
Species whether SAS/GRAPH should use the devices hardware circle-drawing capability, if available.
Used in: Default: Restriction:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window device-dependent not supported by Java or ActiveX
Syntax
GOPTIONS: CIRCLEARC | NOCIRCLEARC GDEVICE: CIRCLEARC=Y | N
CIRCLEARC CIRCLEARC=Y
causes SAS/GRAPH to use the built-in hardware circle- and arc-drawing capability of the device. A blank Circlearc eld in the Parameters window is the same as CIRCLEARC=Y. hardware drawing is faster, but not all devices have the capability. SAS/GRAPH device drivers do not try to use the capability if the device does not have it.
NOCIRCLEARC CIRCLEARC=N
causes SAS/GRAPH to use software move and draw commands to draw circles and arcs.
CMAP
Species a color map for the device.
Used in:
Syntax
CMAP=(from-color : to-color <...,from-color-n : to-color-n>)
from-color
species the name you want to assign to the color designated by the color value. In the Colormap window, enter this value in the From eld.
to-color
species any SAS/GRAPH color name up to eight characters long. In the Colormap window, enter this value in the To eld. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information on specifying colors.
342
COLLATE
Chapter 15
Details
Once you have dened the color mapping, you use the new color name in any color option. For example, if your device entry maps the color name DAFFODIL to the SAS color value PAOY, you can specify the following:
pattern1 color=daffodil;
and the driver will map this to the color value PAOY.
COLLATE
Species whether to collate the output, if collation is supported by the device. GOPTIONS statement; OPTIONS statement NOCOLLATE Restriction: hardwaredependent, PostScript printers require a PPD le; not supported by Java or ActiveX See also: GPROLOG, PPDFILE
Used in: Default:
Syntax
COLLATE | NOCOLLATE
Details
A limited number of printers can collate output, which means to separate each copy of printed output when you print multiple copies of output. For PostScript printers, if a devices PPD le has Collate dened as True, the COLLATE option is supported. For PCL printers that support collation, use the GPROLOG= option to specify a Printer Job Language (PJL) command to enable the collation. For information on the appropriate PJL command, consult the Printer Commands section of your printers user manual.
COLORS
Species the foreground colors used to produce your graphics output if you do not specify colors explicitly in program statements.
Used in: Default:
Syntax
GOPTIONS: COLORS=< (colors-list | NONE)>
COLORS
343
colors-list
species one or more SAS color names. If you specify more than one color, separate each name with a blank. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information on specifying colors and using a color list. To change some of the colors in the color list and retain others, you can use a null value for colors you do not want to change. For example, to change COLORS=(RED GREEN BLUE) to COLORS=(WHITE GREEN BROWN), you can specify COLORS=(WHITE,BROWN).
NONE
tells SAS/GRAPH to use only the colors that you explicitly specify in program statements and to ignore the devices default color list. Note: If you specify COLORS=(NONE) and omit a color specication for a graphics element, such as patterns, SAS/GRAPH selects at random one of the colors already specied in your program. 4
Featured in:
299
Details
The order of the colors in the list is important when you use default colors. For example, the colors used for titles, axes, and surfaces in the G3D procedure are assigned by default according to their position in the color list. Note: Colors can be assigned to graph elements in different orders by different devices such as Java and ActiveX. 4 If you omit or reset COLORS=, SAS/GRAPH uses the default color list for the current device. To explicitly reset the color list to the device default, specify either
goptions colors=; goptions colors=();
If you use default patterns with a color list specied by COLORS= option, the patterns rotate through every color in the list. If the color list contains only one color, for example COLORS=(BLUE), the solid pattern is skipped and the patterns rotate through only the appropriate default hatch patterns for the graph. Note: By default, if black is the rst color in a devices color list, default pattern rotation skips black as a pattern color, but uses black as the area-outline color. Thus, the outline color is never the same as an areas ll color. Using COLORS= to change the color list changes this default pattern behavior. When COLORS= is used, all colors in the specied color list are used in color rotation, and the outline color is the rst color in the specied color list. Thus, the outline color will match any area using the rst color as its ll. 4 See PATTERN Statement on page 238 for more information on pattern rotation.
344
COLORTBL
Chapter 15
COLORTBL
An eight-character eld in the Gcolors window that is not currently implemented. SAS/GRAPH ignores any value entered into this eld.
COLORTYPE
Species the color space used by the user-written part of the Metagraphics device driver.
Used in: Default:
Syntax
COLORTYPE=NAME | RGB | HLS | GRAY | CMY | CMYK | HSV | HSB
SAS predened color names. red-green-blue (RGB) color specications. hue-lightness-saturation (HLS) color specications. gray-scale level. cyan-magenta-yellow color specications. cyan-magenta-yellow-black color specications. hue-saturation-value color specications. These specications are also referred to as hue-saturation-brightness (HSB).
See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for a description of these color types.
Details
Use the COLORTYPE device parameter also to specify the color-naming scheme that is used for devices that support more than one color-naming scheme. For information about Metagraphics drivers, contact Technical Support.
COLS
Sets the number of columns that the device-resident font uses. GDEVICE Chartype window; GDEVICE procedure; CHARREC= option Default: 0
Used in:
CSYMBOL
345
Syntax
See CHARREC on page 339 for syntax.
Details
If you are using a device driver from SASHELP.DEVICES, this parameter is already set for device-resident fonts that have been dened for your installation. If you are adding to or modifying the device-resident fonts available for a particular device driver, specify a positive value for the COLS device parameter. If COLS is greater than 0, it overrides the values of the LCOLS and PCOLS device parameters. For scalable fonts, you can specify 1 for COLS, and the actual number of columns will be computed based on the current text width.
CPATTERN
Selects the default color for PATTERN denitions when a color has not been specied.
Used in: Default:
GOPTIONS statement rst color in current color list not supported by Java or ActiveX
Restriction:
Syntax
CPATTERN=pattern-color
pattern-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
CPATTERN= is overridden by any color specication in a PATTERN statement. For details on how CPATTERN= affects the PATTERN statement, see The Effect of the CPATTERN= Graphics Option on page 248. If you specify CPATTERN=, the solid pattern is skipped and the patterns rotate through only the appropriate default hatch patterns for the graph. See PATTERN Statement on page 238 for more information on pattern rotation.
CSYMBOL
Species the default color for SYMBOL denitions when a color has not been specied.
346
CTEXT
Chapter 15
GOPTIONS statement rst color in current color list not supported by Java or ActiveX
Restriction:
Syntax
CSYMBOL=symbol-color
symbol-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
CSYMBOL= is overridden by any color specication in a SYMBOL statement. See SYMBOL Statement on page 250.
CTEXT
Selects the default color for all text and the border.
Used in: Default:
GOPTIONS statement black for Java and ActiveX devices; for other devices, the rst color in current
color list
See also: CTITLE Restriction:
Syntax
CTEXT=text-color
text-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
The CTITLE= graphics option overrides CTEXT= for all titles, notes, and footnotes, as well as the border. Any other color specications for text in SAS statements also override the value of the CTEXT= graphics option. Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
DASH
347
CTITLE
Selects the default color for all titles, footnotes, and notes, and the border.
Used in:
GOPTIONS statement
Default: (1) color specied by CTEXT=, if used; (2) black for Java and ActiveX devices; for other devices, the rst color in current color list See also:
CTEXT
Syntax
CTITLE=title-color
title-color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors.
Details
Any color specication in a TITLE, FOOTNOTE, or NOTE statement overrides the value of the CTITLE= graphics option for the text. The border, however, still uses the color specied in the CTITLE= graphics option. Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
DASH
Species whether to use the devices hardware dashed-line capability, if available.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window device dependent not supported by Java or ActiveX
Restriction:
Syntax
GOPTIONS: DASH | NODASH GDEVICE: DASH=Y | N
348
DASHLINE
Chapter 15
DASH DASH=Y
causes SAS/GRAPH to use the built-in hardware dashed-line drawing capability of the device when generating graphics output. A blank Dash eld in the Parameters window is the same as DASH=Y. hardware drawing is faster, but not all devices have the capability. SAS/GRAPH device drivers do not try to use the capability if the device does not have it.
NODASH DASH=N
DASHLINE
Species which dashed lines should be generated by hardware means if possible.
Used in: GDEVICE procedure; GDEVICE Parameters window
Syntax
DASHLINE=dashed-line-hex-stringX
dashed-line-hex-string
is a hexadecimal string 16 characters long that must be completely lled. Each bit in the string corresponds to a line type. See Figure 14.22 on page 276 for line types that correspond to each bit. To use line type 1, turn on bit 1; to use line type 2, turn on bit 2; and so on. For example, in the following option the rst byte is 1000; only bit 1 is on and only line type 1 is selected:
dashline=8000000000000000x
Details
If the DASH device parameter is N in the device entry or if NODASH is used in a GOPTIONS statement, SAS/GRAPH ignores the hexadecimal string in the DASHLINE device parameter.
DELAY
349
DASHSCALE
Scales the lengths of the dashes in a dashed line.
Used in: Default:
Restriction:
Syntax
DASHSCALE=scaling-factor
scaling-factor
can be any number greater than 0. For example, GOPTIONS DASHSCALE=.5 reduces any existing dash length by one-half.
Details
Only dashes or spaces with lengths greater than one pixel are scaled. Dots are not scaled because their length is effectively zero. DASHSCALE= always uses system line styles instead of the devices dashed line capabilities.
DELAY
Controls the amount of time between graphs in the animation sequence.
Used in: Default:
Restriction:
Syntax
DELAY=delay-time
delay-time
species the length of time between graphs in units of 0.01 seconds. For example, to specify a delay of .03 seconds, specify DELAY=3.
Details
SAS/GRAPH puts the DELAY= value into the image le. Based on this value, the browser determines how to display the series of graphs.
350
DESCRIPTION
Chapter 15
DESCRIPTION
Provides a description of the device entry. DES Used in: GDEVICE procedure GDEVICE Detail window
Alias: Default:
none
Syntax
DESCRIPTION=text-string
text-string
is a string up to 256 characters long. This is a comment eld and does not affect the graphics output.
DEVADDR
Species the location of the device to which the output of device drivers is sent.
Used in: GOPTIONS statement Default:
Restriction:
Syntax
DEVADDR=device-address
DEVICE
Species the device driver to which SAS/GRAPH sends the procedure output. The device driver controls the format of graphics output.
Alias: Default:
DEV devicedependent
Syntax
DEVICE=device-entry
DEVMAP
351
device-entry
Details
A device driver can direct graphics output to a hardware device, such as a terminal or a printer, or can create an external le in another graphics le format, such as TIF, GIF, or PostScript. Some device drivers also generate both graphics les and HTML les that can be viewed with a Web browser. Usually a device driver is assigned by default. If a default driver is not assigned or if you specify RESET=ALL in a GOPTIONS statement, and you do not specify a device driver, SAS/GRAPH prompts you to enter a driver name when you execute a procedure that produces graphics output. If you are producing a graph to the screen and the Graph window is active, SAS/GRAPH selects the display driver for you automatically. For a description of device drivers and for more information on selecting a device entry and changing device parameters, see Chapter 6, Using Graphics Devices, on page 67. For information on using device drivers to display and print graphics output, see Chapter 7, SAS/GRAPH Output, on page 87. For information on using device drivers to export graphics output to external les, see Specifying the Graphics Output File Type for Your Graph on page 91. For information on using device drivers to create output for the Web, see Generating Web Presentations on page 453.
DEVMAP
Species the device map to be used when device-resident fonts are used.
Used in:
Syntax
DEVMAP=device-map-name | NONE
device-map-name
is a string up to eight characters long that is the name of the device map entry.
NONE
species that you do not want to use a device map. This can cause text to be displayed incorrectly or not at all.
Details
Device maps usually are used only when national characters appear in the text and you want them to display properly.
352
DEVOPTS
Chapter 15
DEVOPTS
Species the hardware capabilities of the device.
Used in: GDEVICE procedure; GDEVICE Parameters window Default:
device-dependent
Syntax
DEVOPTS=hardware-capabilities-hex-stringX
hardware-capabilities-hex-string
is a hexadecimal string 16 characters long that must be completely lled. The following table lists the hardware capabilities of each bit:
Table 15.1
Bit On 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
DEVOPTS
353
Bit On 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
Capability colors dened using RGB not used polyline supported polymarker supported graphics clipping supported not used linkable device driver pick CHARTYPE by name in CHARREC entries device-dependent pattern support treat SCALABLE=Y CHARREC as metric size CHARTYPE as HW from CHARREC entries device supports rotated arcs device supports target fonts device supports drawing images device supports multiple color maps image rotation direction device requires sublib for image rotation device is a 24 bit truecolor machine device supports setting font attributes use scan line font rendering device can scale images text clipping supported static color device driver does prolog processing driver does epilog processing driver output only uses a le driver output requires a directory or PDS autosize text to t rows and columns default binding is SHORTEDGE driver supports duplex printing device does right edge binding ActiveX device Java device device uses a universal printer driver
Details
Each capability in the table corresponds to a bit in the value of the DEVOPTS device parameter. For example, if your device can generate hardware pie lls, the second bit
354
DEVTYPE
Chapter 15
in the rst byte of the DEVOPTS string should be turned on if you want the driver to use that capability. If your device is capable of generating only hardware circles and pie lls, specify a value of C000000000000000X as your DEVOPTS value (the rst byte is 1100 so the rst 2 bits of the rst byte are set to 1). Many of the hardware capabilities specied in the DEVOPTS string are overridden by graphics options or other device parameters. CAUTION:
Do not modify the DEVOPTS device parameter unless you are building a Metagraphics driver. If you want to prevent an SAS-supplied driver from using certain hardware capabilities, change the specic device parameter or use the corresponding graphics option. 4
If the DEVOPTS string indicates that a capability is available, the driver uses it unless it is explicitly disabled by another device parameter or graphics option. If the DEVOPTS string indicates that the capability is not available, it is not used by the driver, even if the corresponding device parameter or graphics option indicates that it should be used. For example, if the DEVOPTS value indicates that the device can do a hardware pie ll, the driver uses the hardware pie ll capability unless the PIEFILL device parameter is set to N or NOPIEFILL has been specied in a GOPTIONS statement. However, if the DEVOPTS device parameter indicates that the device cannot do a hardware pie ll, the driver does not attempt to use one, even if the PIEFILL device parameter is set to Y or PIEFILL is used in a GOPTIONS statement.
DEVTYPE
Species the information required by SAS/GRAPH routines to determine the nature of the output device.
Used in: GDEVICE procedure; GDEVICE Host File Options window Default:
device-dependent
Syntax
DEVTYPE=device-type
device-type
is a string eight characters long containing either blanks or some token name that is interpreted by the host. Device-type can be: GTERM indicates that the output device is a graphics device that will be receiving graphics data; most device drivers use this value. G3270 indicates that the output device is an IBM 3270 graphics data stream. If your device is an IBM 3270 type of device, DEVTYPE= must be G3270. Note: GTERM and G3270 are SAS/GRAPH device types. Other valid values depend on your operating environment. DEVTYPE supports any of the device-type values supported on the FILENAME statement. Refer to the SAS Help facility for the device
DISPOSAL
355
types the FILENAME statement supports in your operating environment. In most cases, this eld should not be changed. 4
DISPLAY
Species whether output is displayed on the graphics device but does not affect whether a graph is placed in a catalog.
Used in: Default:
Restriction:
Syntax
DISPLAY | NODISPLAY
Details
In most cases, NODISPLAY suppresses all output except the catalog entry written to the catalog selected in the GOUT= option. Therefore, you usually specify NODISPLAY when you want to generate a graph in a catalog but do not want to display the graph on your monitor or terminal while the catalog entry is being produced.
DISPOSAL
Species what happens to the graphic after it is displayed. GOPTIONS statement Default: NONE
Used in: Restriction:
Syntax
DISPOSAL=NONE | BACKGROUND | PREVIOUS | UNSPECIFIED
NONE
causes the graphic to be left in place after displaying. This is the default.
BACKGROUND
causes the background color to be returned and the graph erased after displaying.
PREVIOUS
causes the graphic area to be restored with what was displayed in the area previously.
UNSPECIFIED
356
DRVINIT
Chapter 15
Details
In Version 6, the ERASE | NOERASE graphics option performed this function for the GIFANIM driver.
DRVINIT
Species host commands to be executed before driver initialization.
Used in:
GOPTIONS statement; GDEVICE procedure; GDEVICE Host Commands not supported by Java or ActiveX
window
Restriction:
Syntax
DRVINIT1=system-command(s) DRVINIT2=system-command(s)
system-command(s)
species a character string that is a valid system command and can be in upper- or lowercase letters. You can include more than one command in the string if you separate the commands with a command delimiter, which is host-specic; for example, some operating environments use a semicolon. The length of the entire string cannot exceed 72 characters.
Details
The DRVINIT command is executed before the driver is initialized. DRVINIT is typically used with FILECLOSE=DRIVERTERM to allocate a host le needed by the device driver.
DRVQRY
Species whether the device can be queried for information about the current device conguration.
Used in: GDEVICE procedure GDEVICE Detail window Default:
device-dependent
Syntax
DRVQRY | NODRVQRY
Details
Generally, this setting is device-dependent and you should not change it.
DUPLEX
357
DRVTERM
Species host commands to be executed after the driver terminates.
Used in:
GOPTIONS statement; GDEVICE procedure; GDEVICE Host Commands not supported by Java or ActiveX
window
Restriction:
Syntax
DRVTERM1=system-command(s) DRVTERM2=system-command(s)
system-command(s)
species a character string that is a valid system command and can be in upper- or lowercase letters. You can include more than one command in the string if you separate the commands with a command delimiter, which is host-specic; for example, some operating environments use a semicolon. The length of the entire string cannot exceed 72 characters.
Details
The DRVTERM command is executed after the driver terminates. DRVTERM is typically used with FILECLOSE=DRIVERTERM to de-allocate a host le and execute utility programs that send the data to the graphics device. For example, DRVTERM might specify commands to send the le to a host print queue.
DUPLEX
Species whether to use duplex printing if available on the device.
Used in: Default:
Syntax
DUPLEX | NODUPLEX
Details
When DUPLEX is on, the driver sets up the printer for duplex operation. Before producing the rst graph, set GSFMODE=REPLACE on the GOPTIONS statement, and DUPLEX on an OPTIONS or GOPTIONS statement. You can also use the BINDING= option in conjunction with DUPLEX. Before producing the second graph, set
358
ERASE
Chapter 15
GSFMODE=APPEND on the GOPTIONS statement so that the driver knows to place succeeding graphs on the next available side of paper. If DUPLEX is in effect, the pages inside (binding) margin is set equal to the current HORIGIN setting, and the outside margin is set equal to XMAX HSIZE HORIGIN In terms of even- and odd-numbered pages, this means the following: odd-numbered pages even-numbered pages HORIGIN determines the left margin, and XMAX-HSIZE-HORIGIN determines the right margin XMAX-HSIZE-HORIGIN determines the left margin, and HORIGIN determines the right margin
For PostScript printers, if you do not use the PPDFILE= option to specify a PPD (PostScript Printer Description) le, a generic PostScript Level 1 duplex command is added to the driver output. If PPDFILE= is used, the duplex command is obtained from the PPD le.
ERASE
Species whether to erase graph after display.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Defaults:
Restriction:
Syntax
GOPTIONS: ERASE | NOERASE GDEVICE: ERASE=Y | N
ERASE ERASE=Y
causes the graph to be erased when you press RETURN after the graph has been displayed.
NOERASE ERASE=N
causes the graph to remain on the display when you press RETURN after the graph has been displayed. A blank Erase eld in the Parameters window is the same as ERASE=N.
Details
ERASE is useful for those devices that overlay the graphics area and the message area that is, those devices that have separate dialog box and graphics areas. On other devices, the graph is erased.
FBY
359
EXTENSION
Species the le extension for an external graphics le.
Used in: GOPTIONS statement Default: device-dependent Restriction: not supported by Java or ActiveX See also: GACCESS, GSFNAME
Syntax
EXTENSION=le-type
le-type
a string up to eight characters long that is a le extension, such as GIF or CGM, that you want to append to an external le.
Details
The extension specied on EXTENSION= is used when the output destination is a storage location. The extension is ignored when the output destination is a le. To specify the output destination, you can use a FILENAME statement, or the graphics options GACCESS= or GSFNAME=. Assuming that the output destination is a storage location, 3 if EXTENSION=., no extension is added to the lename 3 if EXTENSION= or EXTENSION= is not used, the drivers default extension is added to the lename 3 if the driver has no default extension, SAS/GRAPH uses the default extension .GSF.
FASTTEXT
Species whether to use integer-based font processing for faster font rendering.
Used in: GOPTIONS statement Default: FASTTEXT Restriction: not supported by Java or ActiveX
Syntax
FASTTEXT | NOFASTTEXT
FBY
Selects the font for By lines.
360
FCACHE
Chapter 15
(1) font specied by FTEXT=, if used; (2) deviceresident font (3) simulate font not supported by Java or ActiveX BY Statement on page 214
Syntax
FBY=By line-font
By line-font
species the font for all By lines on the graphics output. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for information about specifying fonts.
Details
When you use a BY statement with a SAS/GRAPH procedure to process a data set in subgroups, each graph produced by that procedure is headed by a By line that displays the BY variables and their values that dene the current subgroup.
FCACHE
Species the number of system fonts to keep open at one time.
Used in: GOPTIONS statement Default:
Restriction:
Syntax
FCACHE=number-fonts-open
number-fonts-open
species the number of system fonts to keep open. Number-fonts-open must be greater than or equal to zero.
Details
Each font requires from 4K to 10K memory. Graphs that use many fonts can run faster if you set the value of number-fonts-open to a higher number. However, graphs that use multiple fonts might require too much memory on some computer systems if all the fonts are kept open. In such cases, set the value of number-fonts-open to a lower number to conserve memory.
FILEONLY
361
FILECLOSE
Controls when the graphics stream le (GSF) is closed when you are using the device driver to send graphics output to a hard copy device.
Used in:
window DRIVERTERM (if a device is specied) not supported by Java or ActiveX See also: Specifying the Graphics Output File Type for Your Graph on page 91
Default: Restriction:
Syntax
FILECLOSE=DRIVERTERM | GRAPHEND
DRIVERTERM DRIVER
closes the GSF and makes it available to the device after all graphs have been produced and the procedure or driver terminates. A host command might be needed to actually send the GSF to the device. Host commands can be specied with the DRVINIT or DRVTERM parameters or entered in the Host File Options window of the device entry. If multiple graphs are produced by a procedure, this specication creates one large le. Specifying DRIVERTERM is appropriate for batch processing because it is slightly more efcient to allocate the le only once.
GRAPHEND GRAPH
closes the GSF after each separate graph is produced and releases it to the device before sending another. This method creates smaller les if multiple graphs are produced by a procedure. You can specify a command that sends the graph to the device with the POSTGRAPH parameter or use the Host File Options window. Specifying GRAPHEND is appropriate for drivers that are used interactively, or for devices that require only one graph per physical le.
FILEONLY
Species whether a le or a storage location is the default destination for graphics output. GOPTIONS statement Default: device-dependent Restriction: FILEONLY ignored if the device requires the output destination to be a storage location; not supported by Java or ActiveX See also: DEVOPTS, GSFNAME
Used in:
Syntax
FILEONLY | NOFILEONLY
362
FILL
Chapter 15
FILEONLY
species that a le rather than a storage location is the default destination for graphics output.
NOFILEONLY
species that a storage location is the default destination for graphics output, unless a le of the same name exists.
Details
Most devices use FILEONLY as the default. However, devices that require the output destination to be a storage location use NOFILEONLY as the default. For example, the HTML device requires a storage location because it produces two types of output (HTML les and GIF image les) that cannot be written to the same le. To determine what the default is for a particular device, look at the settings for DEVOPTS bits 48 and 49. For more information, see Specifying the Graphics Output File Type for Your Graph on page 91.
FILL
Species whether to use the devices hardware rectangle-ll capability.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Restriction: not supported by Java or ActiveX Default: devicedependent
Syntax
GOPTIONS: FILL | NOFILL GDEVICE: FILL=Y | N
FILL FILL=Y
causes SAS/GRAPH to use the built-in hardware rectangle-lling capability of the device. A blank Fill eld in the Parameters window is the same as FILL=Y. hardware drawing is faster, but not all devices have the capability. SAS/GRAPH does not try to use the capability if your device does not support it.
NOFILL FILL=N
FILLINC
Species the number of pixels to move before drawing the next line in a software ll of a solid area.
FONTRES
363
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Default: device-dependent Restriction: not supported by Java or ActiveX See also: FILL, PIEFILL, POLYGONFILL
Used in:
Syntax
FILLINC= 0...9999
Details
In order for FILLINC to have any effect, a software ll must be used. To force a software ll, use the options NOFILL, NOPIEFILL, and NOPOLYGONFILL in a GOPTIONS statement. If FILLINC is set to 0 or 1, adjacent lines are used (solid ll with no gaps). If FILLINC is set to 2, a pixel-width line is skipped before drawing the next line of a ll. This option can be useful for keeping plotters from over saturating a solid area and for speeding the plotting. Some inks spread on paper. The type of paper used can also affect ink spread.
FONT NAME
Species the deviceresident font associated with CHARTYPE. GDEVICE Chartype window; GDEVICE procedure; CHARREC= option Required if adding or modifying a CHARREC See also: CHARREC
Used in:
Syntax
See CHARREC on page 339 for syntax.
Details
Use FONT NAME if you are adding to or modifying the device-resident fonts available for a particular device driver. The fonts that you specify must be valid for the output device. If you are using an SAS-supplied device entry, this parameter already is set for most available device-resident fonts.
FONTRES
Controls the resolution of Bitstream fonts.
Used in:
GOPTIONS statement
364
FORMAT
Chapter 15
Default:
Restriction:
Syntax
FONTRES=NORMAL | PRESENTATION
NORMAL
renders fonts in memory using integer rendering routines, which improves character drawing speed for most host systems. NORMAL has the same effect as specifying the default values for these graphics options.
render=memory renderlib=saswork fasttext fcache=0
PRESENTATION
disables the storage or use of rendered versions of Bitstream fonts, but produces the fonts at their highest resolution. FONTRES=PRESENTATION has the same effect as specifying these graphics options:
render=none renderlib=saswork nofasttext fcache=3
FORMAT
Sets the le format of the metacode le produced by the SAS-supplied part of the Metagraphics device driver.
Used in: GDEVICE procedure; GDEVICE Metagraphics window Default:
Restriction:
Syntax
FORMAT=CHARACTER | BINARY
Details
A blank eld defaults to CHARACTER. For information about Metagraphics drivers, contact Technical Support.
FTITLE
365
FTEXT
Sets the default font for all text.
Used in: Default:
GOPTIONS statement Default deviceresident font (except the rst title) partially supported by Java or ActiveX
Restriction:
Syntax
FTEXT=text-font
text-font
species the font for all text on the graphics output. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for information about specifying fonts.
Details
The FTITLE= graphics option overrides FTEXT= for the rst title. Not all fonts are supported by the ActiveX and Java devices. Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
FTITLE
Selects the default font for the rst TITLE line.
Used in: Default:
GOPTIONS statement
(1) font specied by FTEXT=, if used; (2) value of the style variable (3)device-resident font (4)simulate font
Syntax
FTITLE=title-font
title-font
species the font for the TITLE1 statement. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for information about specifying fonts.
366
FTRACK
Chapter 15
Details
Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
FTRACK
Controls the amount of space between letters in the SAS-supplied Bitstream fonts (Brush, Century, Swiss, and Zapf).
Used in: GOPTIONS statement Default:
Restriction:
Syntax
FTRACK=LOOSE | NONE | NORMAL | TIGHT | TOUCH | V5
LOOSE
leaves the most visible space between characters and produces a longer string.
NONE
spacing depends on the size of the font. NONE might produce a shorter or longer string than LOOSE for the same font at different point sizes, because some sizes add space between the characters while others remove it.
NORMAL
places a xed amount of space between the characters and does not adjust for the shape of the character; that is, it does not support kerning. This spacing is compatible with Version 5 Bitstream fonts.
Details
The spacing you specify with FTRACK= affects all Bitstream text in a graph. For example, you cannot produce TIGHT Century type and LOOSE Zapf type simultaneously. This option has no effect on other font types. Because the value of FTRACK= is stored with the graph, the spacing that you specify when the graph is created is always used when the graph is replayed.
GACCESS
367
GACCESS
Species the format or the destination or both of graphics data written to a device or graphics stream le (GSF).
Used in:
window
Default: Restriction:
not supported by Java, ActiveX, or shortcut devices. See Chapter 6, Using Graphics Devices, on page 67 for more information about devices.
Syntax
GACCESS=output-format | output-format destination
output-format
species the format or the destination (the SAS log or a leref) of the graphics data. Output-format varies according to the operating environment. These values can be specied in all operating environments: SASGASTD species that a continuous stream of data is written. SASGASTD is the default for most devices and is typically appropriate when the output le will be sent directly to a device. If you specify GACCESS=SASGASTD, use the GSFNAME= and GSFMODE= graphics options or device parameters to direct your graphics output to a GSF. SASGAEDT species that the le be host-specic edit format. Some hosts allow editing by inserting characters at the end of each record. SASGAEDT is typically used when the output le is to be edited later. If you specify GACCESS=SASGAEDT, use the GSFNAME= and GSFMODE= graphics options or device parameters to direct your graphics output to a GSF. SASGAFIX species that xed-length records be written. (The record length is controlled by the value of the GSFLEN= graphics option or device parameter or the sixth byte of the PROMPTCHARS value.) The records are padded with blanks where necessary. SASGAFIX is typically used when the output le will be transferred to a computer that requires xed-length records. If you specify GACCESS=SASGAFIX, use the GSFNAME= and GSFMODE= graphics options or device parameters to direct your graphics output to a GSF. Note: The value of the GPROTOCOL= graphics option or device parameter can greatly affect the length of the records; for example, if GPROTOCOL=SASGPLCL, the length of the records is doubled. 4 SASGALOG species that records are to be written to the SAS log. GSASFILE species that the records are to be written to the destination whose leref is GSASFILE. The leref can point to a specic external le or to an aggregate le
368
GCLASS
Chapter 15
location. See FILENAME Statement on page 36 for more information on specifying a leref.
output-format destination
species the destination in addition to one of these output format values: SASGASTD, SASGAEDT, or SASGAFIX. Destination is the physical name of an external le or aggregate le location, or of a device. For details on specifying the physical name of a destination, see the SAS documentation for your operating environment. This form is not available in all operating environments. See Specifying the Graphics Output File Type for Your Graph on page 91 for more information on creating graphics stream les. Note: In the Gaccess eld of the Host File Options window, you can specify a destination without an output format. In that case the format defaults to SASGASTD. When you specify a value in the Gaccess eld, you do not need to quote it. 4 Operating Environment Information: Depending on your operating environment, you might be able to specify other values for GACCESS=. See the SAS companion for your operating environment for additional values. 4
GCLASS
Species the output class for IBM printers
Used in: GOPTIONS statement Default:
GCLASS=G used only with IBM3287 and IBM3268 device drivers on z/OS systems only
Restriction:
Syntax
GCLASS=SYSOUT-class
Details
Species the SYSOUT class to which the IBM3287 and IBM3268 device driver output is written.
GCOPIES
Sets the current and maximum number of copies to print.
Used in: GOPTIONS statements; GDEVICE Parameters window; GDEVICE procedure; OPTIONS statement Defaults:
Restriction:
GDDMNICKNAME
369
Syntax
GOPTIONS: GCOPIES=(<current-copies>< ,max-copies>) GDEVICE: GCOPIES=current-copies
current-copies
is a nonnegative integer ranging from 0 through 255, but it cannot exceed the max-copies value specied. A value of 0 or 1 produces a single copy.
max-copies
is a nonnegative integer ranging from 1 through 255. If you do not specify GCOPIES, a default number of copies is searched for in this order: 1 the number of copies specied on an OPTIONS COPIES setting 2 0 current copies, and 20 maximum copies.
Details
Not all devices have the capability to print multiple copies. See the Gcopies eld in the Parameters window for your device to determine its capabilities.
GDDMCOPY
Instructs the driver to issue either an FSCOPY or GSCOPY call to GDDM when AUTOCOPY is in effect. GOPTIONS statement FSCOPY Restriction: GDDM device drivers on IBM mainframe systems only See also: AUTOCOPY
Used in: Default:
Syntax
GDDMCOPY=FSCOPY | GSCOPY
FSCOPY
GDDMNICKNAME
Selects a GDDM nickname for the device to which output is sent.
370
GDDMTOKEN
Chapter 15
Alias: GDDMN Used in: GOPTIONS statement Restriction: GDDM device drivers on IBM mainframe systems only
Syntax
GDDMNICKNAME=nickname
Details
Refer to the SAS Help facility for details on using GDDM drivers and options.
GDDMTOKEN
Selects a GDDM token for the device to which output is sent.
Alias: GDDMT Used in: GOPTIONS statement Restriction: GDDM device drivers on IBM mainframe systems only
Syntax
GDDMTOKEN=token
Details
Refer to the SAS Help facility for details on using GDDM drivers and options.
GDEST
Species the JES SYSOUT destination for IBM printers.
Used in: GOPTIONS statement Default: LOCAL Restriction: used only with IBM3287 and IBM3268 device drivers on z/OS systems
Syntax
GDEST=destination
GEND
Appends an ASCII string to every graphics data record that is sent to a device or le.
GEPILOG
371
GOPTIONS statement; GDEVICE procedure; GDEVICE Gend window not supported by Java or ActiveX See also: GSTART
Used in: Restriction:
Syntax
GEND=string <...string-n>
string
can be either of the following: hex-stringX character-string In a GOPTIONS statement or in the GDEVICE procedure ADD or MODIFY statement, you can specify multiple strings with the GEND= option. In this case, you can mix the formats, specifying some as ASCII hexadecimal strings and some as character strings. Multiple strings are concatenated automatically. In the GEND window, enter the hexadecimal string without either quotation marks or a trailing x. Note, however, that the string must be entered as a hexadecimal string. PROC GOPTIONS always reports the value as a hexadecimal string.
Details
GEND is useful if you are creating a le and want to insert a carriage return at the end of every record. You can also use GEND in conjunction with the GSTART= graphics option or device parameter. If you must specify the long and complicated initialization strings required by some devices (for example, PostScript printers), it is easier to use the GOPTIONS GEND= option rather than the GDEVICE Gend window because it is easier to code the string as text with GEND= than it is to convert the string to its ASCII representation, which is required to enter the string in the GDEVICE Gend window. Note: On non-ASCII hosts, only ASCII hexadecimal strings produce consistent results in all instances because of the way the character strings are translated. In addition, the only way to specify a value for GEND that can be used by all hosts is to use an ASCII hexadecimal string; therefore, using an ASCII hexadecimal string to specify a value for GEND is the recommended method. 4
GEPILOG
Sends a string to a device or le after all graphics commands are sent. GOPTIONS statement; GDEVICE procedure; GDEVICE Gepilog window Restriction: not supported by Java or ActiveX See also: PREGEPILOG, POSTGEPILOG
Used in:
Syntax
GEPILOG=string <...string-n>
372
GFORMS
Chapter 15
string
can be either of the following: hex-stringX character-string In a GOPTIONS statement or in the GDEVICE procedure ADD or MODIFY statement, you can specify multiple strings with the GEPILOG= option. In this case, you can mix the formats, specifying some as ASCII hexadecimal strings and some as character strings. Multiple strings are concatenated automatically. In the Gepilog window, enter the hexadecimal string without either quotation marks or a trailing x. Note, however, that the string must be entered as a hexadecimal string. PROC GOPTIONS always reports the value as a hexadecimal string.
Details
GEPILOG can be used in conjunction with the GPROLOG= graphics option or device parameter. If you must specify the long and complicated initialization strings required by some devices (for example, PostScript printers), it is easier to use the GOPTIONS GEPILOG= option rather than the Gepilog window because it is easier to code the string as text with GEPILOG= than it is to convert the string to its ASCII representation, which is required to enter the string in the Gepilog window. Note: On non-ASCII hosts, only ASCII hexadecimal strings produce consistent results in all instances because of the way the character strings are translated. In addition, the only way to specify a value for GEPILOG that can be used by all hosts is to use an ASCII hexadecimal string; therefore, using an ASCII hexadecimal string to specify a value for GEPILOG is the recommended method. 4
GFORMS
Species the JES form name for IBM printers.
Used in: GOPTIONS statement
STD Restriction: used only with IBM3287 and IBM3268 device drivers on z/OS systems only
Default:
Syntax
GFORMS=forms-code
GOUTMODE
Appends to or replaces the graphics output catalog.
GPROLOG
373
Restriction:
Syntax
GOUTMODE=APPEND | REPLACE
APPEND
replaces the contents of the catalog with the graph or graphs produced by a single procedure. CAUTION:
If you specify REPLACE, the entire contents of the catalog are replaced, not just graphs of the same name. Graphs are added to the catalog for the duration of the procedure, but when the procedure ends and a new procedure begins, the contents of the catalog are deleted and the new graph or graphs are added. 4
GPROLOG
Sends a string to device or le before graphics commands are sent.
Used in:
GOPTIONS statement; GDEVICE procedure; GDEVICE Gprolog window not supported by Java or ActiveX
Restriction:
Syntax
GPROLOG=string <...string-n>
string
can be either of the following: hex-stringX character-string In a GOPTIONS statement or in the GDEVICE procedure ADD or MODIFY statement, you can specify multiple strings with the GPROLOG= option. In this case, you can mix the formats, specifying some as ASCII hexadecimal strings and some as character strings. Multiple strings are concatenated automatically. In the GPROLOG window, enter the hexadecimal string without either quotation marks or a trailing x. Note, however, that the string must be entered as a hexadecimal string. PROC GOPTIONS always reports the value as a hexadecimal string.
374
GPROTOCOL
Chapter 15
Details
GPROLOG can be used in conjunction with the GEPILOG= graphics option or device parameter. If you must specify the long and complicated initialization strings required by some devices (for example, PostScript printers), it is easier to use the GOPTIONS GPROLOG= option rather than the GDEVICE Gprolog window because it is easier to code the string as text with GPROLOG= than it is to convert the string to its ASCII representation, which is required to enter the string in the GDEVICE Gprolog window. Note: On non-ASCII hosts, only ASCII hexadecimal strings produce consistent results in all instances because of the way the character strings are translated. In addition, the only way to specify a value for GEND that can be used by all hosts is to use an ASCII hexadecimal string; therefore, using an ASCII hexadecimal string to specify a value for GEND is the recommended method. 4
GPROTOCOL
Species the protocol module to use when routing output directly to a printer or creating a graphics stream le (GSF) to send to a device attached to your host by a protocol converter.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host File Options
Syntax
GPROTOCOL=module-name
SASGPADE* SASGPAGL* SASGPASC SASGPAXI* SASGPCAB* SASGPCHK* SASGPDAT* SASGPDCA* SASGPHEX SASGPHYD* SASGPIDA* SASGPIDX* SASGPIMP*
GRAPHRC
375
SASGPIOC* SASGPISI* SASGPI24* SASGPLCL* SASGPNET* SASGPMIC* SASGPRTM* SASGPSCS* SASGPSTD SASGPSTE* SASGPTCX* SASGPVAT* SASGP497* SASGP71 *Valid only for IBM mainframe systems.
Details
GPROTOCOL= species whether the graphics data generated by the SAS/GRAPH device driver should be altered and how the data should be altered. Unless you are using a protocol converter on an IBM mainframe, most devices do not require that the data be altered, and ordinarily, you do not have to change the default of GPROTOCOL. On IBM hosts, the protocol module converts the graphics output to a format that can be processed by protocol converters. On other hosts, it can be used to produce a le in ASCII hexadecimal format. Refer to the SAS Help facility for descriptions of these protocol modules. Operating Environment Information: environments. 4 GPROTOCOL is valid only in certain operating
GRAPHRC
Species whether to return a step code at graphics procedure termination.
Used in:
Restriction: Default:
Syntax
GRAPHRC | NOGRAPHRC
376
GSFLEN
Chapter 15
GRAPHRC
allows a return code at procedure termination. If the return code is not 0, the entire job might terminate.
NOGRAPHRC
always returns a step code of 0, even if the SAS/GRAPH program produced errors. As a result, the entire jobs return code is unaffected by errors in any graphics procedure. NOGRAPHRC also overrides the ERRABEND system option.
Details
You typically use this option when you are running multiple jobs in a batch environment. It is useful primarily in an z/OS batch environment.
GSFLEN
Controls the length of records written to the graphics stream le (GSF).
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host File Options
window device-dependent Restriction: not supported by Java or ActiveX See also: PROMPTCHARS
Default:
Syntax
GSFLEN=record-length
record-length
must be a nonnegative integer up to ve digits long (0...99999). GSFLEN= species the length of the records written by the driver to a GSF or to the device. If GSFLEN is 0, SAS/GRAPH uses the sixth byte of the PROMPTCHARS string to determine the length of the records. If the sixth byte of the PROMPTCHARS string is 00, the device driver sets the record length. If you specify GACCESS=SASGAFIX and omit GSFLEN=, SAS/GRAPH uses the default length for the device. Some values of the GPROTOCOL device parameter cause each byte in the data stream to be expanded to two bytes. This expansion is done after the length of the record is set by GSFLEN. If you are specifying a value for GPROTOCOL that does this (for example, SASGPHEX, SASGPLCL, or SASGPAGL), specify a value for GSFLEN that is half of the actual record length desired. For example, a value of 64 produces a 128-byte record after expansion by the GPROTOCOL module.
GSFMODE
377
GSFMODE
Species the disposition of records written to a graphics stream le (GSF) or to a device or communications port by the device driver.
Used in:
window REPLACE not supported by Java or ActiveX See also: GACCESS, GSFNAME
Default: Restriction:
Syntax
GSFMODE=APPEND | PORT | REPLACE
APPEND
adds the records to the end of a GSF designated by the GACCESS= or GSFNAME= graphics option or device parameter. If the le does not already exist, it is created. The destination can be either a specic le or an aggregate le storage location. If the destination of the GSF is a specic le and you specify APPEND, SAS/GRAPH will add the new records to an existing GSF of the same name. If the destination of the GSF is a le location and not a specic le, SAS/GRAPH will add the records to an external le whose name matches the name of the newly created catalog entry. For more information on how SAS/GRAPH names catalog entries, see Specifying the Graphics Output File Type for Your Graph on page 91. Note: Some viewers of bitmapped output can view only one graph, even though multiple graphs are stored in the le. Therefore it might appear that a le contains only one graph when in fact it contains multiple graphs. 4
PORT
sends the records to a device or communications port. The GACCESS= graphics option or device parameter should point to the desired port or device.
REPLACE
replaces the existing contents of a GSF designated by the GACCESS= or GSFNAME= graphics option or device parameter. If the le does not exist, it is created. REPLACE is always the default, regardless of the destination of the GSF. If the destination of the GSF is a specic le and you specify REPLACE, SAS/GRAPH will replace an existing GSF with the contents of a newly created GSF of the same name. If the destination of the GSF is a le location and not a specic le, SAS/GRAPH will replace an external le whose name matches the name of the newly created catalog entry. For more information on how SAS/GRAPH names catalog entries, see Specifying the Graphics Output File Type for Your Graph on page 91.
Details
When you create a GSF, the GSFNAME= or GACCESS= graphics option or device parameter controls where the output goes, and GSFMODE= controls how the driver writes graphics output records. If the output is to go to a le, specify APPEND or REPLACE. If the output is to go directly to a device or to a communications port,
378
GSFNAME
Chapter 15
specify PORT. See Specifying the Graphics Output File Type for Your Graph on page 91 for more information on creating a graphics stream le.
GSFNAME
Species the leref of the le or aggregate le location to which graphics stream le records are written.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host File Options
window
Restriction:
Syntax
GSFNAME=leref
leref
species a leref that points to the destination for the graphics stream le (GSF) output. Fileref must be a valid SAS leref up to eight characters long and must be assigned with a FILENAME statement before running a SAS/GRAPH procedure that uses that leref. The destination specied by the FILENAME statement can be either a specic le or an aggregate le location. See FILENAME Statement on page 36 for additional information on the FILENAME statement.
Details
Whether the resulting graphs are stored as one le or many les depends on both the type of destination and the setting of the GSFMODE= option. If you specify a leref with GSFNAME= and forget the FILENAME statement that denes the leref, and if a destination is specied by the GACCESS= graphics option or device parameter, SAS/GRAPH assigns that destination to the leref and sends the graphics output there. See also GACCESS on page 367. See Specifying the Graphics Output File Type for Your Graph on page 91 for more information on creating graphics stream les.
GSFPROMPT
Species whether to write prompt messages to the graphics stream le (GSF).
Used in: GOPTIONS statement Default:
Restriction:
GSTART
379
Syntax
GSFPROMPT | NOGSFPROMPT
Details
When the GSF is processed by another program, that program can display the prompt messages. The default, NOGSFPROMPT, is compatible with Release 6.06. Although the prompt messages appear if the graphics device is in eavesdrop mode, they do not wait for user response. If GSFPROMPT is on, the prompt messages are sent with the GSF to the device, regardless of the status of the graphics options PROMPT, GACCESS=, GSFMODE=, or GSFNAME=.
GSIZE
Sets the number of lines of display used for graphics for devices whose displays can be divided into graphics and text areas. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window not supported by Java or ActiveX Default: device-dependent
Used in: Restriction:
Syntax
GSIZE=lines
lines
species the number of lines to be used for graphics. Lines is a nonnegative integer up to three digits long (0...999), and can be larger or smaller than the total number of lines that can be displayed at one time. If the number is larger, scroll the graph to see it all. If GSIZE is 0, all lines are used for text.
GSTART
Prexes every record of graphics data sent to a device or le with a string of characters. GOPTIONS statement; GDEVICE procedure; GDEVICE Gstart window none Restriction: not supported by Java or ActiveX See also: GEND
Used in: Default:
Syntax
GSTART=string < ...string-n>
380
GUNIT
Chapter 15
string
can be either of the following: hex-stringX character-string In a GOPTIONS statement or in the GDEVICE procedure ADD or MODIFY statement, you can specify multiple strings with the GSTART= option. In this case, you can mix the formats, specifying some as ASCII hexadecimal strings and some as character strings. Multiple strings are concatenated automatically. In the GSTART window, enter the hexadecimal string without either quotation marks or a trailing x. Note, however, that the string must be entered as a hexadecimal string. PROC GOPTIONS always reports the value as a hexadecimal string.
Details
GSTART is useful when sending a le to a device that requires each record be prexed with some character. You can use GSTART= in conjunction with the GEND= graphics option or device parameter. If you must specify the long and complicated initialization strings required by some devices (for example, PostScript printers), it is easier to use the GOPTIONS GSTART= option rather than the GDEVICE Gstart window because it is easier to code the string as text with GSTART= than it is to convert the string to its ASCII representation, which is required to enter the string in the GDEVICE Gstart window. Note: On non-ASCII hosts, only ASCII hexadecimal strings produce consistent results in all instances because of the way the character strings are translated. In addition, the only way to specify a value for GEND that can be used by all hosts is to use an ASCII hexadecimal string; therefore, using an ASCII hexadecimal string to specify a value for GEND is the recommended method. 4
GUNIT
Species the default unit of measure to use with height specications.
Used in: GOPTIONS statement
Syntax
GUNIT=units units must be one of CELLS CM IN PCT character cells centimeters inches percentage of the graphics output area
GWRITER
381
PT
Details
Used with options in the AXIS, FOOTNOTE, LEGEND, NOTE, SYMBOL, and TITLE statements and in some graphics options. If you specify a value but do not specify an explicit unit, the value of the GUNIT= graphics option is used. If the HSIZE= and VSIZE= options are specied then GUNIT is ignored and inches will be used.
GWAIT
Species the time between each graph displayed in a series. GOPTIONS statement Default: GWAIT=0 Restriction: not supported by Java or ActiveX
Used in:
Syntax
GWAIT=seconds
seconds
species the number of seconds between graphs. Seconds can be any reasonable positive integer. By default, GWAIT=0, which means that you must press the RETURN key between each display in a series of graphs.
Details
GWAIT= enables you to view a series of graphs without having to press the ENTER key (or the RETURN or END key, depending on your device) between each display. For example, if you specify GWAIT=5, ve seconds elapse between the display of each graph in a series. If you use the NOPROMPT graphics option, the GWAIT= graphics option is disabled.
GWRITER
Species the name of the external writer used with IBM printers. GOPTIONS statement SASWTR Restriction: Used only with IBM3287 and IBM3268 device drivers on z/OS systems
Used in: Default:
Syntax
GWRITER=writer-name
382
HANDSHAKE
Chapter 15
HANDSHAKE
Species the type of ow control used to regulate the ow of data to a hard copy device.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window
Syntax
HANDSHAKE=HARDWARE | NONE | SOFTWARE | XONXOFF
HARDWARE HARD
species that SAS/GRAPH instruct the device to use the hardware CTS and RTS signals. (This is not appropriate for some devices.)
NONE
species that SAS/GRAPH send data without providing ow control. Specify NONE only if the hardware or interface program you are using provides its own ow control.
SOFTWARE SOFT
species that SAS/GRAPH use programmed ow control with plotters in eavesdrop mode.
XONXOFF X
species that SAS/GRAPH instruct the device to use ASCII characters DC1 and DC3. (This is not appropriate for some devices.)
Details
HANDSHAKE regulates ow of control by specifying how and if a device can signal to the host to temporarily halt transmission and then resume it. Flow control is important because it is possible to send commands to a hard copy device faster than they can be executed. HANDSHAKE can be used when you are using a protocol converter, interface program, or host computer that can perform XONXOFF or hardware handshaking. You can also use this option if you are routing output through ow-control programs of your own, as in a multiple-machine personal computer environment where the graphics plotter is a shared resource. SAS/GRAPH software sends output to a server (the le transfer does not require ow control). The server queues incoming graphs and sends them to the plotter. The server, rather than SAS/GRAPH software, is responsible for handling ow control. An interface program is usually invoked by the line printer daemon and provides formatting or control signals for a system destination. The interface program typically includes port conguration options, such as baud, parity, and special character processing requirements (raw or cooked mode) for that destination. If you do not use HANDSHAKE, the value in the driver entry is used.
HEADER
383
If you use HANDSHAKE=XONXOFF or HANDSHAKE=HARDWARE, SAS/GRAPH does not actually do the handshaking. It tells the device which type of handshake is being used. The protocol converter, interface program, or host computer actually does the handshake. Note: If you are creating a graphics stream le using a driver for a plotter and you specify HANDSHAKE=SOFTWARE, the software that you use to send the le to the plotter must be able to perform a software handshake. You will probably want to specify one of the alternative values if you route output to a le. 4
HBY
Species the height of By lines generated when you use BY-group processing.
Used in: Default:
GOPTIONS statement One cell unless the HTEXT= option is used not supported by Java or ActiveX
Restriction:
Syntax
HBY=By line-height <units>
By line-height <units>
species the height of By line text; by default By line-height is 1. If you specify HBY=0, the BY headings are suppressed. For a description of units, see Specifying Units of Measurement on page 330. Note: If a value for units is not specied, the current units associated with the GUNIT graphics option are used. 4
Details
When you use a BY statement with a SAS/GRAPH procedure to process a data set in subgroups, each graph produced by that procedure is headed by a By line that displays the BY variables and their values that dene the current subgroup.
HEADER
Species the command that executes a user-supplied program to create HEADER records for the driver.
Used in:
GDEVICE procedure; GDEVICE Metagraphics window Used only with user-supplied Metagraphics drivers.
Restriction:
384
HEADERFILE
Chapter 15
Syntax
HEADER=command
command
species a command that runs a user-written program that creates the le of HEADER records. Command is a string up to 40 characters long.
Details
For information about Metagraphics drivers, contact Technical Support.
HEADERFILE
Species the leref for the le from which the Metagraphics driver reads HEADER records.
Used in: GDEVICE procedure; GDEVICE Metagraphics window
Syntax
HEADERFILE=leref
leref
species a valid SAS leref up to eight characters long. Fileref must have been previously assigned with a FILENAME statement or a host command before running the Metagraphics driver. See FILENAME Statement on page 36 for details.
Details
For information about Metagraphics drivers, contact Technical Support.
HORIGIN
Sets the horizontal offset from the lower-left corner of the display area to the lower-left corner of the graph.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window Restriction:
Syntax
HORIGIN=horizontal-offset <IN | CM | PT>
HPOS
385
must be a nonnegative number and can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify HORIGIN, a default offset is searched for in this order: 1 the left margin specication on an OPTIONS LEFTMARGIN setting 2 HORIGIN setting in the device catalog.
Details
The display area is dened by the XMAX and YMAX device parameters. By default, the origin of the graphics output area is the lower-left corner of the display area; the graphics output is offset from the lower-left corner of the display area by the values of HORIGIN and VORIGIN. HORIGIN + HSIZE cannot exceed XMAX. Note: When sending output to the PRINTER destination (ODS PRINTER), if you specify the VSIZE= option without specifying the HSIZE= option, the default origin of the graphics output area changes. The default placement of the graph changes from the lower-left corner of the display area to the top-center of the graphics output area. Likewise, if you specify the HSIZE= option without specifying the VSIZE= option, the graph is positioned at the top-center of the graphics output area by default. 4 See The Graphics Output and Device Display Areas on page 59 for details.
HOSTSPEC
Stores FILENAME statement options in the device entry.
Used in:
Syntax
HOSTSPEC=text-string
text-string
species FILENAME statement options that are valid for the operating environment. Text-string accepts characters in upper or lower case. See the SAS documentation for your operating environment for details.
Details
HOSTSPEC can be used when the driver dynamically allocates a graphics stream le or spool le. It can specify the attributes of the le, such as record format or record length. It cannot be used with Metagraphics drivers.
HPOS
Species the number of columns in the graphics output area.
386
HSIZE
Chapter 15
device-dependent: the value of the LCOLS or PCOLS device parameter not supported by Java or ActiveX
Restriction:
Syntax
HPOS=columns
columns
species the number of columns in the graphics output area, which is equivalent to the number of hardware characters that can be displayed horizontally. Specifying HPOS=0 causes the device driver to use the default hardware character cell width for the device.
Details
The HPOS= graphics option overrides the values of the LCOLS or PCOLS device parameters and temporarily sets the number of columns in the graphics output area. HPOS= does not affect the width of the graphics output area but merely divides it into columns. Therefore, you can use HPOS= to control cell width. The values specied in the HPOS= and VPOS= graphics options determine the size of a character cell for the graphics output area and consequently the size of many graphics elements, such as deviceresident text. The larger the size of the HPOS= and VPOS= values, the smaller the size of each character cell. See Overview on page 59 for more information.
HSIZE
Sets the horizontal size of the graphics output area.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window Restriction:
Syntax
HSIZE=horizontal-size < IN | CM | PT>
species the width of the graphics output area; horizontal-size must be a positive number and can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify HSIZE=, a default size is searched for in this order:
1 the horizontal size is calculated as
HTITLE
387
XMAX LEFTMARGIN RIGHTMARGIN Note that LEFTMARGIN and RIGHTMARGIN are used in the OPTIONS statement.
2 HSIZE setting in the device catalog.
HTEXT
Species the default height of the text in the graphics output.
Used in: Default:
Restriction:
Syntax
HTEXT=text-height <units>
text-height <units>
species the height of the text; by default text-height is 1. For a description of units, see Specifying Units of Measurement on page 330. Note: If a value for units is not specied, the current units associated with the GUNIT graphics option are used. 4
Details
HTEXT= is overridden by the HTITLE= graphics option for the rst TITLE line. Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
HTITLE
Selects the default height used for the rst TITLE line.
Used in: Default:
Syntax
HTITLE=title-height <units>
388
IBACK
Chapter 15
title-height <units>
species the height of the text in the TITLE1 statement. By default, title-height is 2. For a description of units, see Specifying Units of Measurement on page 330. Note: If a value for units is not specied, the current units associated with the GUNIT graphics option are used. 4
Details
If you omit the HTITLE= option, TITLE1 uses the height specied by the HTEXT= graphics option, if used. Note: When you use ODS to send graphics to an HTML destination, and titles and footnotes are rendered as part of the HTML body le instead of the graphic image, you must specify the ODS USEGOPT statement for this option to work. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information. 4
IBACK
Species an image le to display in a graphs background area. partially supported by Java See also: CBACK, IMAGESTYLE
Restriction:
Syntax
IBACK=leref | external-le | URL| " "
leref
species a leref that points to the image le you want to use. Fileref must be a valid SAS leref up to eight characters long and must have been previously assigned with a FILENAME statement.
external-le
species the complete lename of the image le you want to use. The format of external-le varies across operating environments.
URL
Details
The image can be used with any procedures that produce a picture or support the CBACK= option. The IBACK option is supported by the Graph applet and the Map applet, but it is not supported by the Contour applet. See Chapter 16, Introducing SAS/GRAPH Output for the Web, on page 441 for information about these applets. This option overrides the BackGroundImage and Image styles attribute in the graph styles. To suppress a background image that is dened in a style or to reset the value of the IBACK= option, specify a blank space: IBACK=" " For more information on graph styles, refer to the TEMPLATE procedure documentation in SAS Output Delivery System: Users Guide.
IMAGESTYLE
389
For a list of the le types that you use, see Image File Types Supported by SAS/ GRAPH on page 179.
ID
Species the description string used by the Metagraphics driver.
Used in: GDEVICE procedure; GDEVICE Metagraphics window Restriction: Used only with user-supplied Metagraphics drivers.
Syntax
ID=description
description
is a character string up to 70 characters long. If this eld is blank, the name and description of the graph as specied in the PROC GREPLAY window of the GREPLAY procedure are used.
Details
For information about Metagraphics drivers, contact Technical Support.
IMAGEPRINT
Enables or disables image output
Used in: GOPTIONS statement Default: IMAGEPRINT Restriction: not supported by Java or ActiveX
Syntax
IMAGEPRINT | NOIMAGEPRINT
IMAGEPRINT
default value species that any images are to be included in graphics output.
NOIMAGEPRINT
IMAGESTYLE
Species the way to display the image le that is specied on the IBACK= option.
390
INTERACTIVE
Chapter 15
Default:
Restriction:
Syntax
IMAGESTYLE= TILE | FIT
TILE
tile the image within the specied area. This copies the images as many times as needed to t the area.
FIT
t the image within the background area. This stretches the image, if necessary.
Details
Note: This option overrides the BackGroundImage and Image styles attribute in the graph styles. For more information on graph styles, refer to the TEMPLATE procedure documentation in SAS Output Delivery System: Users Guide. 4
INTERACTIVE
Sets level of interactivity for Metagraphics driver.
Used in: GDEVICE procedure; GDEVICE Metagraphics window Default:
Restriction:
Syntax
INTERACTIVE=USER | GRAPH | PROC
USER
species that the user-written part of the driver be executed outside of SAS/GRAPH.
PROC
species that the user-written part of the Metagraphics driver be invoked after the procedure is complete.
GRAPH
Details
For information about Metagraphics drivers, contact Technical Support.
ITERATION
391
INTERLACED
Species whether images are to be displayed as they are received in the browser.
Used in: Default:
Restriction:
Syntax
INTERLACED | NONINTERLACED
Details
With interlacing it is possible to get a rough picture of what a large image will look like before it is completely drawn in your browser. Your browser might allow you to set an option that will determine how images are displayed.
INTERPOL
Sets the default interpolation value for the SYMBOL statement.
Used in:
Restriction:
Syntax
INTERPOL=interpolation-method
interpolation-method
species the default interpolation to be used when the INTERPOL= option is not specied in the SYMBOL statement. See SYMBOL Statement on page 250 for the complete syntax of all interpolation methods.
ITERATION
Species the number of times to repeat the animation loop.
Used in: Default:
Restriction:
392
KEYMAP
Chapter 15
Syntax
ITERATION=iteration-count
iteration-count
species the number of times that your complete GIF animation loop is repeated. It is assumed that the animation is always played once; this option species how many times the animation is repeated. Iteration-count can be a number from 0...65535. A value of 0 causes the animation to loop continuously.
Details
In Version 6, the GCOPIES graphics option controlled iteration for the GIFANIM driver.
KEYMAP
Selects the keymap to use.
Used in: GOPTIONS statement Default:
Restriction:
Syntax
KEYMAP=key-map-name | NONE
key-map-name
suppresses the keymap assigned by default to a non-U.S. keyboard. If you specify KEYMAP=NONE, text might display incorrectly or not at all.
Details
Non-default key maps usually are used only with non-U.S. Keyboards.
LCOLS
Sets the number of columns in the graphics output area for landscape orientation.
Used in: GDEVICE procedure; GDEVICE Detail window Default:
device-dependent
LROWS
393
Syntax
LCOLS=landscape-columns
landscape-columns
Details
Either the LROWS and LCOLS pair of device parameters or the PROWS and PCOLS pair of device parameters are required and must be nonzero. The HPOS= graphics option overrides the value of LCOLS. See Overview on page 59 for more information.
LFACTOR
Selects the default hardware line thickness. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window device-dependent Restriction: Used only with devices that can draw hardware lines of varying thicknesses. Not supported by Java or ActiveX.
Used in: Default:
Syntax
LFACTOR=line-thickness-factor
line-thickness-factor
can range from 0 through 9999. A value of 0 for LFACTOR is the same as a factor of 1. Lines are drawn line-thickness-factor times as thick as normal.
Details
LFACTOR is useful when you are printing graphics output on a plotter. Depending on the orientation and type of device, some plotters might require LFACTOR=10 to get the same thickness of lines as on the display of some devices.
LROWS
Sets the number of rows in the graphics output area for landscape orientation. GDEVICE procedure; GDEVICE Detail window device-dependent See also: LCOLS, PROWS, VPOS
Used in: Default:
394
MAXCOLORS
Chapter 15
Syntax
LROWS=landscape-rows
landscape-rows
Details
Either the LROWS and LCOLS pair of device parameters or the PROWS and PCOLS pair of device parameters are required and must be nonzero. The VPOS= graphics option overrides the value of LROWS. See Overview on page 59 for more information.
MAXCOLORS
Sets the total number of colors that can be displayed at once.
Used in: GDEVICE procedure; GDEVICE Parameters window Default:
device-dependent
Syntax
MAXCOLORS=number-of-colors
number-of-colors
must be an integer in the range 2 through 256. The total number of colors includes the foreground colors plus the background color.
Details
The PENMOUNTS= graphics option overrides the value of MAXCOLORS.
MAXPOLY
Sets the maximum number of vertices for hardware-drawn polygons.
Used in: GDEVICE procedure; GDEVICE Parameters window Default:
device-dependent
Syntax
MAXPOLY=number-of-vertices
MODULE
395
number-of-vertices
is a nonnegative integer up to four digits long. A value of 0 means that there is no limit to the number of vertices that can be specied in the hardwares polygon-drawing command. The maximum value of MAXPOLY depends on the number of vertices your device can process.
MODEL
Species the model number of the output device.
Used in: Default:
Syntax
MODEL=model-number
model-number
is a nonnegative integer up to ve digits long that is the SAS-designated model number for the corresponding device. It is not the same as a manufacturers model number.
Details
Do not change this eld in SAS-supplied drivers or in drivers that you copy from SAS-supplied drivers.
MODULE
Species the name of the corresponding executable driver module for the device.
Used in: Default:
Syntax
MODULE=driver-module
driver-module
is a literal string up to eight characters long. All standard driver modules begin with the characters SASGD.
396
NAK
Chapter 15
Details
Do not change this eld in SAS-supplied drivers or in drivers that you copy from SAS-supplied drivers.
NAK
Species the negative response for software handshaking for Metagraphics drivers.
Used in: GDEVICE procedure; GDEVICE Metagraphics window Restriction:
Syntax
NAK=negative-handshake-responseX
negative-handshake-response
Details
For information about Metagraphics drivers, contact Technical Support.
OFFSHADOW
Controls the width and depth of the drop shadow in legend frames.
Used in: GOPTIONS statement Default:
Restriction:
Syntax
OFFSHADOW=(x <units>, y <units>) | (x,y) <units>
x,y
specify the width (x) and depth (y) of the drop shadow generated by the LEGEND statement. If a value for units is not specied, the current units associated with the GUNIT graphics option are used. For a description of units, see Specifying Units of Measurement on page 330.
PAPERFEED
397
Details
The values specied by OFFSHADOW= are used with the CSHADOW= and CBLOCK= options in a LEGEND statement. For details, see LEGEND Statement on page 223.
PAPERDEST
Species which output bin the printer should use if multiple bins are available on the device.
Used in: Default:
Restrictions: hardware-dependent, PostScript printers require a PPD le; not supported by Java or ActiveX See also: PAPERSOURCE, PPDFILE
Syntax
PAPERDEST=bin
bin
species the name or number of the output bin. Values for bin depend on the type of printer and can be one of the following: bin long bin name the name or number of the output bin for example, PAPERDEST=4, PAPERDEST=BIN2, PAPERDEST=SIDE
a character string that is the name of the output bin for example, PAPERDEST=Top Output Bin. Names with blanks or special characters must be quoted. For PostScript printers, the value for bin must correspond to an OutputBin value in the PPD le. For PCL printers, consult the printers documentation for valid bin values. If a numeric value exceeds the maximum bin value allowed for the printer, a warning message is issued . For string values, the string is checked against a list of strings that are valid for the driver (for example, UPPER, LOWER, or OPTIONALOUTBINn, where n is the bin number). If the string is not valid for the driver, a warning message is issued.
PAPERFEED
Species the increment of paper that is ejected when a graph is completed.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window PAPERFEED=0.0 IN device-dependent; not supported by Java or ActiveX
Restriction:
398
PAPERLIMIT
Chapter 15
Syntax
PAPERFEED=feed-increment <IN | CM>
must be a nonnegative number and can be followed by a unit specication, either IN for inches (default) or CM for centimeters.
Details
PAPERFEED does not control the total length of the ejection. If you specify PAPERFEED=1, the driver ejects paper in 1 inch increments until the total amount of paper ejected is at least half an inch greater than the size of the graph last printed. If you specify PAPERFEED=8.5 IN, the paper is ejected in increments of 8.5 inches, measuring from the origin of the rst graph. PAPERFEED is provided mainly for plotters that use fanfold or roll paper. If you are using fanfold paper, specify a value for PAPERFEED that is equal to the distance between the perforations.
PAPERLIMIT
Sets the width of the paper used with plotters.
Used in: GOPTIONS statement Default: Restriction:
maximum dimensions specied in the device driver ZETA plotters and KMW rasterizers
Syntax
PAPERLIMIT=width <IN | CM>
species the paper width in IN for inches (default) or CM for centimeters. If PAPERLIMIT= is not specied, the maximum dimensions of the graph are restricted by the hardware limits of the graphics device.
Details
If you want to use a driver with a device that has a larger plotting area than the device for which the driver is intended (for example, using the ZETA887 driver with a ZETA 836 plotter), the PAPERLIMIT= graphics option can be used to override the size limit of the driver.
PAPERSIZE
Species the name of a paper size.
PAPERSOURCE
399
Restriction:
hardware- dependent, PostScript printers require a PPD le; not supported by Java or ActiveX
Syntax
PAPERSIZE=size-name
size-name
species the name of a paper size, such as LETTER, LEGAL, or A4. If you do not specify the PAPERSIZE= option, the PAPERSIZE= option setting on an OPTIONS statement is used. If no OPTIONS statement sets a paper size, the value for paper size is device-dependent:
3 The universal printing devices use the size specied in the Page Setup dialog
box.
Details
Typically, you might use the PAPERSIZE= option with the Output Delivery System (ODS). For some printers, the PAPERSIZE= option overrides the PAPERSOURCE= option selection. For PostScript devices, the name must match the name of a paper size in the PPD le. Refer to the PPD le for a list of valid names. Size-name is case-insensitive and can contain a subset of the full name. For example, if the name in the PPD le is *PageSize A4/A4, you can specify PAPERSIZE=A4. If a PPD le is not specied, the PAPERSIZE= option is ignored. For PCL devices, the device driver searches the SAS Registry for supported paper size values. To see the supported list of sizes, submit the following statements:
proc registry listhelp startat=options\papersize; run;
For more information about the SAS Registry, refer to the SAS Help facility.
PAPERSOURCE
Species which paper tray the printer should use if multiple trays are available on the device.
Used in: Default:
Restriction:
hardware dependent, PostScript printers require a PPD le; not supported by Java or ActiveX
400
PAPERTYPE
Chapter 15
Syntax
PAPERSOURCE=tray
tray
species the name or number of the paper tray. Values for tray depend on the type of printer and can be one of the following: tray the name or number of the paper tray, for example, PAPERSOURCE=3, PAPERSOURCE=TRAY3, PAPERSOURCE=Upper a character string that is the name of the paper tray, for example, PAPERSOURCE=Optional Output Tray. Names with blanks or special characters must be quoted.
Details
On some printers, if the PAPERSIZE= option is also specied, it overrides the setting on the PAPERSOURCE= option. For PostScript printers, a tray number, such as PAPERSOURCE=tray3, must correspond to an InputSlot value in the PPD le. For PCL printers, consult the printers documentation for valid tray values. If a numeric value exceeds the maximum tray value allowed for the printer, a warning message is issued . For string values, the string is checked against a list of strings that are valid for the driver:
3 3 3 3 3
AUTO HCI or HCIn, where n is a number from 2 to 21 MANUAL MANUAL_ENVELOPE TRAYn, where n is 1, 2, or 3.
If the string is not valid for the driver, a warning message is issued.
PAPERTYPE
Species the name of a paper type.
Used in: GOPTIONS statement; OPTIONS statement Default:
PLAIN
Restriction:
hardware dependent, PostScript printers require a PPD le; not supported by Java or ActiveX
Syntax
PAPERTYPE=type-name
PCLIP
401
type-name
species the name of a paper type. Valid values depend on the type of printer. For PostScript devices, type-name must match the name of a paper type in the PPD le, such as TRANSPARENCY or PLAIN. Refer to the PPD le for a list of valid names. Type-name is case-insensitive and can contain a subset of the full name. For example, if the name in the PPD le is *MediaType Plain/Paper you can specify PAPERTYPE=PLAIN/PAPER. For PCL devices, type-name species the name of a paper type that is available on the current printer, such as GLOSSY, PLAIN, SPECIAL, or TRANSPARENCY. Consult your printers user manual for the complete list of available paper types on your printer.
Details
For PostScript devices, if a PPD le is not specied, the PAPERTYPE= option is ignored.
PATH
Sets the increment of the angle for deviceresident text rotation. GDEVICE procedure; GDEVICE Metagraphics window PATH=0 Restriction: Used only with user-supplied Metagraphics drivers.
Used in: Default:
Syntax
PATH=angle-increment
angle-increment
is an integer in the range 0 to 360 that species the angle at which to rotate the text baseline. A value of 0 means that the device uses its default orientation. Specify 0 if your device does not perform string angling in hardware.
Details
For information about Metagraphics drivers, contact Technical Support.
PCLIP
Species whether a clipped polygon is stored in its clipped or unclipped form. GOPTIONS statement NOPCLIP Restriction: not supported by Java or ActiveX
Used in: Default:
402
PCLIP
Chapter 15
Syntax
PCLIP |NOPCLIP
PCLIP
stores clipped polygons with the graph in the default catalog WORK.GSEG, or in the catalog you specify.
NOPCLIP
stores the unclipped form of the polygon and causes the polygon to be clipped when replayed.
Details
The effects of this option are seen only when you use the graphics editor to edit a graph. When a procedure produces a graph with intersecting polygons or blanking areas, it clips portions of the polygons to prevent the ones behind from showing through. When the graph is created and stored in a catalog, if PCLIP is in effect, the clipped form of the polygon is stored with it. If NOPCLIP is specied, the complete polygon is stored in the catalog and the graph is clipped each time it is replayed. For example, suppose you create a block map like the one in Figure 15.3 on page 402.
Figure 15.3
Intersecting Polygons
The block clips the boundary of the map area polygon. If you specify PCLIP, the map area polygon is stored in its clipped form, as shown in Figure 15.4 on page 402.
Figure 15.4
NOPCLIP stores the map area in its unclipped form, as shown in Figure 15.5 on page 403.
PENMOUNTS
403
Figure 15.5
In this case, when the graph is recalled from the catalog, the map area polygon must be clipped before it is displayed with the block. If you plan to edit the graph with the graphics editor, specify NOPCLIP so polygons retain their original form.
PCOLS
Sets the number of columns in the graphics output area for portrait orientation.
Used in: Default:
Syntax
PCOLS=portrait-columns
portrait-columns
Details
Either the LROWS and LCOLS pair of device parameters or the PROWS and PCOLS pair of device parameters are required and must be nonzero. The HPOS= graphics option overrides the value of PCOLS. See Overview on page 59 for more information.
PENMOUNTS
Species the number of active pens or colors.
Used in: Default:
Restriction:
404
PENSORT
Chapter 15
Syntax
PENMOUNTS=active-pen-mounts
active-pen-mounts
species the number of pens for a plotter with multiple pens. After the specied number of pens have been used, you are prompted to change the pens.
Details
For devices that are not pen plotters, PENMOUNTS= can be used to indicate the number of colors that can be displayed at one time. In this case, PENMOUNTS= performs the same function as the MAXCOLORS device parameter except that the value specied for MAXCOLORS includes the background color and PENMOUNTS only refers to foreground colors. Thus, PENMOUNTS=4 implies MAXCOLORS=5. PENMOUNTS= overrides the value of the MAXCOLORS device parameter. You can specify MAXCOLORS= in a GOPTIONS statement as a synonym for PENMOUNTS=.
PENSORT
Species whether plotters draw graphics elements in order of color.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Restriction: Default:
device-dependent
Syntax
GOPTIONS: PENSORT | NOPENSORT GDEVICE: PENSORT=Y | N
PENSORT PENSORT=Y
causes the plotter to draw all graphics elements of one color at one time. For example, it draws all the red elements in the output, then all the blue elements, and so on. This specication is compatible with previous releases. Use it for plotters with real pens.
NOPENSORT PENSORT=N
causes the plotter to draw each element as it is encountered, regardless of its color. For example, the plotter might draw a red circle, then a blue line, and then a red line, and so on. This method is best for electrostatic printers implemented with Metagraphics drivers of TYPE=PLOTTER. In addition, NOPENSORT enables you to specify non-standard color names.
POLYGONCLIP
405
PIEFILL
Species whether to use the devices hardware pie-ll capability. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Default: device-dependent Restriction: not supported by Java or ActiveX
Used in:
Syntax
GOPTIONS: PIEFILL | NOPIEFILL GDEVICE: PIEFILL=Y | N
PIEFILL PIEFILL=Y
causes SAS/GRAPH to use the built-in hardware capability of the device, if available, to ll pies and pie sections. A blank Piefill eld in the Parameters window is the same as PIEFILL=Y. Hardware drawing is faster, but not all devices have the capability. SAS/GRAPH does not try to use the capability if your device does not support it.
NOPIEFILL PIEFILL=N
causes SAS/GRAPH to ll pies and pie sections using software pie lls.
POLYGONCLIP
Species the type of clipping used when two polygons overlap. GOPTIONS statement Default: device-dependent Restriction: not supported by Java or ActiveX
Used in: See also: PCLIP
Syntax
POLYGONCLIP | NOPOLYGONCLIP
406
POLYGONFILL
Chapter 15
POLYGONCLIP
species polygon clipping, which enables a clipped polygon to be lled with a hardware pattern. POLYGONCLIP affects only graphs that have blanking areas or intersecting polygons.
NOPOLYGONCLIP
species line clipping; a polygon that has been line-clipped cannot use a hardware pattern.
Details
Clipping is the process of removing part of one polygon when two polygons intersect. For example, in a block map, a block might overlap the boundary of its map area. In this case, the polygon that makes up the map area is clipped so that you do not see the boundary line behind the block. (See Figure 15.3 on page 402 for an illustration of a clipped polygon.) The type of clipping used by a graph affects whether a clipped area can use hardware patterns. POLYGONCLIP is affected by the PCLIP graphics option: POLYGONCLIP with PCLIP or NOPCLIP all areas can use hardware patterns NOPOLYGONCLIP with NOPCLIP all areas use only software patterns NOPOLYGONCLIP with PCLIP areas can use either hardware or software patterns depending on the nature of the clipped polygons. Under some conditions the polygons might not be clipped correctly. Specifying both POLYGONCLIP and NOPCLIP will produce the correct graph.
POLYGONFILL
Species whether to use the hardware polygon-ll capability.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window
Syntax
GOPTIONS: POLYGONFILL | NOPOLYGONFILL GDEVICE: POLYFILL=Y | N
POLYGONFILL POLYFILL=Y
causes SAS/GRAPH to use the built-in hardware capability of the device to ll polygons. A blank Polyfill eld in the Parameters window is the same as POLYGONFILL.
POSTGPROLOG
407
hardware drawing is faster, but not all devices have the capability. SAS/GRAPH does not try to use the capability if your device does not support it.
NOPOLYGONFILL POLYFILL=N
POSTGEPILOG
Species data to send immediately after the data that is stored in the Gepilog eld of the device entry is sent.
Used in: Default:
Restriction:
Syntax
POSTGEPILOG=string
string
can be either of the following: hex-stringX character-string PROC GOPTIONS always reports the value as a hexadecimal string.
POSTGPROLOG
Species the data to send immediately after the data that is stored in the Gprolog eld of the device entry is sent.
Used in: Default:
Restriction:
Syntax
POSTGPROLOG=string
408
POSTGRAPH
Chapter 15
string
can be either of the following: hex-stringX character-string PROC GOPTIONS always reports the value as a hexadecimal string.
POSTGRAPH
Species host commands to be executed after the graph is produced.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host Commands
window
Restriction:
Syntax
POSTGRAPH1=system-command(s) POSTGRAPH2=system-command(s)
system-command(s)
species one or more valid system commands. The string can contain upper- or lowercase characters. Separate multiple commands with a command delimiter, which is host-specic; for example, some operating environments use a semicolon. The total length of the string cannot exceed 72 characters. The commands are executed right after the graph is produced.
Details
If you want to use a host command to send output to the device after each graph executes, use the POSTGRAPH parameter with FILECLOSE=GRAPHEND.
PPDFILE
Species the location of an external le containing PostScript Printer Description (PPD) information.
Used in: GOPTIONS statement Restriction:
PREGPROLOG
409
Syntax
PPDFILE=leref | external-le
leref
species a leref that points to the PPD le you want to use. Fileref must be a valid SAS leref up to eight characters long and must have been previously assigned with a FILENAME statement.
external-le
species the complete lename of the PPD le you want to use. The format of external-le varies across operating environments. For details, see the SAS documentation for your operating environment.
Details
A PostScript Printer Description (PPD) le is a text le that contains commands required to access features of the device. These les are available from Adobe. Also, many printer manufacturers provide the appropriate PPD le for their PostScript printers.
PREGEPILOG
Species data to send immediately before the data that is stored in the Gepilog eld of the device entry is sent. GOPTIONS statement Default: Null string Restriction: not supported by Java or ActiveX See also: GEPILOG, POSTGEPILOG
Used in:
Syntax
PREGEPILOG=string
string
can be either of the following: hex-stringX character-string PROC GOPTIONS always reports the value as a hexadecimal string.
PREGPROLOG
Species the data to send immediately before the data that is stored in the Gprolog eld of the device entry is sent.
410
PREGRAPH
Chapter 15
Null string not supported by Java or ActiveX See also: GPROLOG, POSTGPROLOG
Default: Restriction:
Syntax
PREGPROLOG=string
string
can be either of the following: hex-stringX character-string PROC GOPTIONS always reports the value as a hexadecimal string.
PREGRAPH
Species host commands to be executed before the graph is produced.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host Commands
window
Restriction:
Syntax
PREGRAPH1=system-command(s) PREGRAPH2=system-command(s)
system-command(s)
species one or more valid system commands. The string can contain upper- or lowercase characters. Separate multiple commands with a command delimiter, which is host-specic; for example, some operating environments use a semicolon. The total length of the string cannot exceed 72 characters. The commands are executed immediately before the graph is produced.
Details
The PREGRAPH parameter should be used with FILECLOSE=GRAPHEND.
PROCESS
Species the command that translates the metale into commands for the device.
PROCESSOUTPUT
411
GDEVICE procedure; GDEVICE Metagraphics window Used only with user-supplied Metagraphics drivers. See also: INTERACTIVE
Used in: Restriction:
Syntax
PROCESS=command
command
species the command that translates the metale produced by the Metagraphics driver into commands for the device. The command runs your program to produce the output. Command is a string up to 40 characters long.
Details
PROCESS is required if the value of the INTERACTIVE device parameter is PROC or GRAPH. For information about Metagraphics drivers, contact Technical Support.
PROCESSINPUT
Species the leref for the le that contains input for the user-written part of the Metagraphics driver.
Used in: Restriction:
GDEVICE procedure; GDEVICE Metagraphics window Used only with user-supplied Metagraphics drivers.
Syntax
PROCESSINPUT=leref
leref
species a valid SAS leref up to eight characters long. Fileref must be assigned with a FILENAME statement or a host command before running the Metagraphics driver. See FILENAME Statement on page 36 SAS/GRAPH: Reference for additional information.
Details
For information about Metagraphics drivers, contact Technical Support.
PROCESSOUTPUT
Species the leref for the le that receives output from the user-written part of the Metagraphics driver.
412
PROMPT
Chapter 15
Syntax
PROCESSOUTPUT=leref
leref
species a valid SAS leref up to eight characters long. Fileref must be assigned with a FILENAME statement or a host command before running the Metagraphics driver. See FILENAME Statement on page 36 for additional information.
Details
For information about Metagraphics drivers, contact Technical Support.
PROMPT
Species whether prompts are issued.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window
Syntax
GOPTIONS: PROMPT | NOPROMPT GDEVICE: PROMPT=0...7
PROMPT
PROMPTCHARS
413
5 6 7
combines the effects of 4 and 1. combines the effects of 4 and 2. sends all prom
Note: If you specify either 0 for the PROMPT device parameter or NOPROMPT in a GOPTIONS statement for a display device, the display clears immediately after the graph is drawn. 4 In the GDEVICE Parameters window, the PROMPT parameter consists of four elds that describe the type of prompt:
start up
issues a message to turn the device on (if the device is a hardcopy device) or the message PLEASE PRESS RETURN AFTER EACH BELL TO CONTINUE.
end of graph
signals, usually by a bell, when the graph is complete (valid for video displays only).
mount pens
issues a message to mount pens in a certain order and (for certain devices only) to ask for pen priming strokes for plotters.
change paper
prompts the user to change the paper (valid for plotters only). Enter an X for each prompt that you want to be given. If no Xs appear in these elds, no prompt messages are issued, and the device does not wait for you to respond between graphs.
PROMPTCHARS
Selects the prompt characters to be used by SAS/GRAPH device drivers.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window host dependent not supported by Java or ActiveX
Restriction:
Syntax
PROMPTCHARS=prompt-chars-hex-stringX
prompt-chars-hex-string
is an 8-byte hexadecimal string that is specied as 16 hexadecimal characters. In GDEVICE procedure statements, enclose the string in single quotation marks, followed by an X. In the Parameters window, enter the hexadecimal string without either quotation marks or a trailing X.
414
PROMPTCHARS
Chapter 15
Note: Bytes 1, 4, and 5 are the safest for you to change because you are most likely to know the correct value for them. Check with Technical Support before changing any of the other bytes. 4 The following list describes each byte in the string: byte 1 is the ASCII code of the system prompt character (for software handshaking). The system prompt character is the last character that the host sends before waiting for a response from the plotter. For example, 11 means the host sends an XON or DC1 character as a prompt. If the host does not send a special character for a prompt, set this byte to 00. byte 2 is the ASCII code of the echo-terminator character (for software handshaking). This character is sent at the beginning of each record. byte 3 prevents splitting commands across records if the value is 01. If you are creating a graphics stream le to send to a device at a later time, and there is the possibility that extra characters will be added between records during transmission, setting the third byte to 01 reduces the likelihood that the extra characters will be interpreted as graphics commands and cause stray lines or other device characters. If the third byte is set to 00, the driver makes the records as long as possible and splits device commands across records if necessary. Setting the third byte to 00 is more efcient but is more likely to result in device errors if output is written to a le and later transmitted to the device. byte 4 is the line-end character (for software handshaking). It indicates that more data can be sent. This character is almost always a carriage-return character, 0D. byte 5 species turnaround delay in tenths of a second (for software handshaking). The turnaround delay is the amount of time the device waits after receiving the prompt character before sending the line-end character. For example, a value of 05 represents a half-second delay. byte 6 sets default record length using a hexadecimal value 00FF. This byte sets the length of the records sent to the device or to a le. If this byte is set to 00 (the default), SAS/GRAPH uses the longest record length possible for the device. To specify an alternate length, set the sixth byte to the hexadecimal value for the desired length. For example, to generate records of length 80, specify 50 for the sixth byte. If the GSFLEN device parameter or graphics option is specied, its value overrides the value of the sixth prompt character. Some values of the GPROTOCOL device parameter cause each byte in the data stream to be expanded to two bytes. This expansion is done after the length of the record is set by PROMPTCHARS. If you are specifying a value for GPROTOCOL that does this (for example, SASGPHEX, SASGPLCL, or SASGPAGL), specify a value for the sixth byte of PROMPTCHARS that is half of the actual record length desired. For example, a hexadecimal value of 40 (64 decimal) produces a 128-byte record after expansion by the GPROTOCOL module. bytes 7 and 8 are unused and should be set to 0000.
QMSG
415
Details
PROMPTCHARS is most commonly used to specify parameters used in software handshaking (see HANDSHAKE on page 382), but it can also be used to control the length of records written by most drivers. You can also use the GSFLEN= graphics option for this purpose.
PROWS
Sets the number of rows in the graphics output area for portrait orientation. GDEVICE procedure; GDEVICE Detail window devicedependent See also: LROWS, PCOLS, VPOS
Used in: Default:
Syntax
PROWS=portrait-rows
portrait-rows
Details
Either the LROWS and LCOLS pair of device parameters or the PROWS and PCOLS pair of device parameters are required and must be nonzero. The VPOS= graphics option overrides the value of PROWS. See Overview on page 59 for more information.
QMSG
Species whether log messages are held until after the graphics output is displayed. GDEVICE procedure; GDEVICE Detail window Default: devicedependent
Used in:
Syntax
GOPTIONS: QMSG | NOQMSG GDEVICE: QMSG=Y | N
QMSG QMSG=Y
queues driver messages while the device is in graphics mode (default for video devices).
416
RECTFILL
Chapter 15
NOQMSG QMSG=N
prevents the queuing of messages (default for plotters, cameras, and printers).
Details
Message queuing is desirable on display devices that do not have a separate dialog box and graphics area. If messages are not queued, they are written to the log as the graphics output is being generated. This behavior can cause problems on some devices. A blank Queued messages eld in the Parameters window can mean either Y or N, depending on the device.
RECTFILL
Species which rectangle lls should be performed by hardware.
Used in: GDEVICE procedure; GDEVICE Parameters window Default:
device-dependent
Syntax
RECTFILL=rectangle-ll-hex-stringX
rectangle-ll-hex-string
is a hexadecimal string that is 16 characters long. In GDEVICE procedure statements, enclose the string in single quotation marks, followed by an X. In the Parameters window, enter the hexadecimal string without either quotation marks or a trailing X. The following table shows which bit position (left-to-right) within the hexadecimal string controls each ll pattern.
Bit 1 2 3 4 5 6 7 8 Fill pattern R1 R2 R3 R4 R5 L1 L2 L3 Bit 9 10 11 12 13 14 15 16 Fill pattern L4 L5 X1 X2 X3 X4 X5 S
For example, if you want the driver to use only the L1 and R1 lls in hardware, the rst and sixth bits of the rst byte of the hexadecimal string should be turned on,
RENDER
417
which corresponds to a value of 8400000000000000X (84X is equivalent to 1 0 0 0 0 1 0 0 in binary). If a particular hardware rectangle ll is not available or not to be used (as indicated by the value of RECTFILL), the ll is generated by the software. See PATTERN Statement on page 238 for an illustration of the ll patterns.
Details
Note: Not all devices support this capability. If FILL=N is specied or the NOFILL option is used in a GOPTIONS statement, RECTFILL is ignored. 4
RENDER
Controls the creation and disposition of rendered Bitstream fonts.
Used in: Default:
Restriction:
Syntax
RENDER=APPEND | DISK | MEMORY | NONE | READ
APPEND
creates les to store rendered versions of Bitstream fonts if the les do not already exist, reads previously rendered characters from the font les, and appends rendered versions of new characters to the font les when the SAS/GRAPH procedure terminates.
DISK
creates les to store rendered versions of Bitstream fonts if the les do not already exist, reads previously rendered characters from the font les, and appends rendered versions of new characters to the font les as they are encountered. This method is slower on some hosts, but it can work in memory-constrained conditions where the other rendering methods fail.
MEMORY
renders all fonts in memory without creating any font les on disk. Font les are not used even if they already exist. New characters are not written to existing font les when SAS/GRAPH procedures terminate. This is the default and should be the fastest method on hosts that support virtual memory.
NONE
reads existing rendered font les but does not create new font les or write new characters to existing font les. This is useful only when font les already exist in the rendered font library.
418
RENDERLIB
Chapter 15
Details
The memory capacity and input/output characteristics of your host system determine which value for the RENDER= option provides the best performance.
RENDERLIB
Species the SAS library in which rendered font les are stored.
Used in: GOPTIONS statement
Syntax
RENDERLIB=libref
libref
species a previously dened libref that identies the SAS library. The default library is WORK. See LIBNAME Statement on page 36 for more information on assigning a libref.
REPAINT
Species how many times to redraw the graph.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Default: Restriction:
Syntax
REPAINT=redraw-factor
redraw-factor
Details
Use this option with printers that produce light images after only one pass. This option also is useful for producing transparencies; multiple passes make the colors more solid or more intense. Not all devices have this capability.
REVERSE
419
RESET
Resets graphics options to their defaults and/or cancels global statements.
Used in:
GOPTIONS statement
Syntax
RESET=ALL | GLOBAL | statement-name | (statement-name(s))
ALL
sets all graphics options to defaults and cancels all global statements.
GLOBAL
cancels all global statements (AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, and TITLE). Options in the GOPTIONS statement are unaffected.
statement-name
resets or cancels only the specied global statements. For example, RESET=PATTERN cancels all PATTERN statements only. To cancel several statements at one time, enclose the statement names in parentheses. For example, RESET=(TITLE FOOTNOTE AXIS). Note: RESET=GOPTIONS sets all graphics options to defaults but does not cancel any global statements. 4
Featured in:
Example 10. Creating a Bar Chart with Drill-Down Functionality for the Web on page 321
Details
RESET=ALL or RESET=GOPTIONS must be the rst option specied in the GOPTIONS statement; otherwise, the graphics options that precede the RESET= option in the GOPTIONS statement are reset. Other options can follow the RESET= graphics option in the statement.
REVERSE
Species whether to print the output in reverse order, if reverse printing is supported by the device. GOPTIONS statement Default: NOREVERSE Restrictions: hardware-dependent, PostScript printers require a PPD le; not supported by Java or ActiveX See also: PPDFILE
Used in:
Syntax
REVERSE | NOREVERSE
420
ROTATE
Chapter 15
Details
The purpose of REVERSE is to control the stacking order of printer output, depending on how the printer stacks paper. On some printers, reverse implies using the alternate output bin (back of the printer). For PCL devices, REVERSE sends output to the LOWER out bin, which is the face-up output bin. For PostScript devices, if the PPD le has an OutputOrder entry and one of its entries is Reverse, the device supports reverse order printing and the appropriate PostScript code to activate reverse will be used. If the PPD le does not have an OutputOrder entry but does have a PageStackOrder entry and corresponding OutputBin value, then reverse order printing is supported indirectly, using the PPD les PageStackOrder/OutputBin entries. Note: Some PostScript devices implement Reverse as the default output mode for one of the output bins. In this case, selecting either the reverse output bin or specifying REVERSE mode produces identical results. 4
ROTATE
Species whether and how to rotate the graph.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window Restriction: not supported by Java or ActiveX
Syntax
GOPTIONS: ROTATE=LANDSCAPE | PORTRAIT GOPTIONS: ROTATE | NOROTATE GDEVICE: ROTATE=LANDSCAPE | PORTRAIT
ROTATE | NOROTATE
species whether to rotate the graph 90 degrees from its default orientation.
ROTATE=LANDSCAPE
species portrait orientation (the graph is higher than it is wide). If you do not specify a rotation, a default is searched for in this order: 1 the ORIENTATION setting on an OPTIONS statement 2 device-dependent default.
ROTATION
Sets the increment of the angle by which the device can rotate any given letter in a string of text in a Metagraphics driver.
SCALABLE
421
GDEVICE procedure; GDEVICE Metagraphics window Default: ROTATION=0 Restriction: Used only with user-supplied Metagraphics drivers.
Used in:
Syntax
ROTATION=angle-increment
angle-increment
species the increment of the angle at which to rotate individual characters, for example, every 5 degrees, every 45 degrees, and so on. Angle-increment is an integer in the range 0 to 360. A value of 0 means that the device uses its default character rotation. Specify 0 if your device does not perform hardware character rotation.
Details
For information about Metagraphics drivers, contact Technical Support.
ROWS
Species the number of rows the deviceresident font uses in graphics output. GDEVICE Chartype window; GDEVICE procedure; CHARREC= option 0 See also: CHARREC
Used in: Default:
Syntax
See CHARREC on page 339 for syntax.
Details
If you are using a device driver from SASHELP.DEVICES, this parameter already is set for deviceresident fonts that have been dened for your installation. For scalable fonts, you can specify 1 for ROWS, and the actual number of rows will be computed based on the current text width. If you are adding to or modifying device-resident fonts available for a particular device driver, specify a positive value for the ROWS device parameter. If ROWS is greater than 0, it overrides the values of the LROWS and PROWS device parameters.
SCALABLE
Species whether a font is scalable.
Used in:
422
SIMFONT
Chapter 15
Default:
device dependent
Syntax
See CHARREC on page 339 for syntax.
Details
A device-resident font is scalable if it can be used with any combination of rows and columns. Use the SCALABLE device parameter if you are adding to or modifying the fonts available for a particular device driver. If you are using a device driver from SASHELP.DEVICES, this parameter already is set for device-resident fonts that have been dened for your installation.
SIMFONT
Species a SAS/GRAPH font to use if the default device-resident font cannot be used.
Used in: GOPTIONS statement Default:
Restriction:
Syntax
SIMFONT=SAS/GRAPH-font
SAS/GRAPH-font
species a SAS/GRAPH font to use instead of the default device-resident font. By default, this is the SIMULATE font, which is stored in the SASHELP.FONTS catalog.
Details
SAS/GRAPH substitutes the SAS/GRAPH font specied by the SIMFONT= option for the default device-resident font in these cases:
3 when you use the NOCHARACTERS option in a GOPTIONS statement 3 when you specify a non-default value for the HPOS= or VPOS= graphics option
and your device does not have scalable hardware characters
3 when you replay a graph using a device driver other than the one used to create
the graph
3 when you specify an angle or rotation for your hardware text that the device is not
capable of producing
3 when you specify a device-resident font that is not supported by your device.
See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for details.
SWAP
423
SPEED
Selects pen speed for plotters with variable speed selection. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Default: device dependent Restriction: not supported by Java or ActiveX
Used in:
Syntax
SPEED=pen-speed
pen-speed
species a percentage (1 through 100) of the maximum pen speed for the device. For example, SPEED=50 slows the drawing speed by half. In general, slowing the drawing speed produces better results. By default, the value of SPEED is the normal speed for the device.
SWAP
Species whether to reverse BLACK and WHITE in the graphics output. GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Defaults: GOPTIONS: NOSWAP; GDEVICE: SWAP=N Restriction: not supported by Java or ActiveX
Used in:
Syntax
GOPTIONS: SWAP | NOSWAP GDEVICE: SWAP=Y | N
SWAP SWAP=Y
does not swap the colors. A blank Swap eld in the Parameters window is the same as SWAP=N.
Details
SWAP does not affect the background color and only affects BLACK and WHITE foreground colors specied as predened SAS color names. SWAP ignores BLACK and WHITE specied in HLS, RGB, or gray-scale format. This option is useful when you
424
SWFONTRENDER
Chapter 15
want to preview a graph on a video device and send the nal copy to a printer that uses a white background.
goptions reset=all cback=blue ctitle=black swap; title1 h=8 swap test; title2 h=8 another title; proc gslide border; run;
SWFONTRENDER
Species the method used to render system fonts.
Used in: GOPTIONS statement Default: Restriction:
Syntax
SWFONTRENDER = POLYGON | SCANLINE
SWFONTRENDER = POLYGON
Details
SWFONTRENDER determines the method used to render system text to a vector graphics le. In some graphics formats, SCANLINE rendering can produce better quality output might be distorted if the output is replayed on a device with a different resolution than the original device. If the system text is rendered as a POLYGON, resizing the graph will not distort the text.
SYMBOL
Species whether to use the devices symbol-drawing capability.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window
device dependent Restriction: not supported by Java or ActiveX See also: SYMBOLS
Default:
Syntax
GOPTIONS: SYMBOL | NOSYMBOL
SYMBOLS
425
GDEVICE: SYMBOL=Y | N
SYMBOL SYMBOL=Y
causes SAS/GRAPH to use the built-in symbol-drawing capability of the device, if available. A blank Symbol eld in the Parameters window is the same as SYMBOL=Y. hardware drawing is faster, but not all devices have the capability. SAS/GRAPH does not try to use the capability if your device does not support it.
NOSYMBOL SYMBOL=N
SYMBOLS
Species which symbols can be generated by hardware. GDEVICE procedure; GDEVICE Parameters window Default: devicedependent See also: SYMBOL Statement on page 250
Used in:
Syntax
SYMBOLS=hardware-symbols-hex-stringX
hardware-symbols-hex-string
is a hexadecimal string that is 16 characters long and must be completely lled. This table shows which bit position (left-to-right) within the hexadecimal string controls each hardware symbol.
426
TARGETDEVICE
Chapter 15
For example, if you want the driver to do only the PLUS and X symbols in hardware, the rst and second bits of the rst byte of the hexadecimal string should be turned on, which would correspond to a value of C000000000000000X (C0X is equivalent to 1 1 0 0 0 0 0 0 in binary).
Details
These are not the only symbols that can be generated for graphics output but are the symbols that can be drawn by the hardware. SAS/GRAPH can draw other symbols. Note: Not all devices are capable of drawing every symbol. If a particular hardware symbol is not available or not to be used (as indicated by the value of SYMBOLS), the symbol is generated by the software. If the value of the SYMBOL device parameter in the device entry is N or the NOSYMBOL graphics option is used, the value of SYMBOLS is ignored. 4
TARGETDEVICE
Displays the output as it would appear on a different device. Also, species the device driver for the PRINT command.
Alias:
TRAILERFILE
427
Syntax
TARGETDEVICE=target-device-entry
target-device-entry
Details
Use TARGETDEVICE= to specify a device driver when you want to: 3 preview graphics output on your monitor as it would appear on a different output device. For details, see Previewing Output on page 109.
3 print output from the Graph window or the Graphics Editor window with the
PRINT command. For details, see Printing Your Graph on page 109.
3 specify a device driver for graphics output created by the ODS HTML statement.
TRAILER
Species the command that creates TRAILER records for the Metagraphics driver. GDEVICE procedure; GDEVICE Metagraphics window Restriction: Used only with user-supplied Metagraphics drivers
Used in: See also: TRAILERFILE
Syntax
TRAILER=command
command
species a command that runs a user-written program that creates the TRAILER le. Command is a string up to 40 characters long.
Details
For information about Metagraphics drivers, contact Technical Support.
TRAILERFILE
Species the leref of the le from which the Metagraphics driver reads TRAILER records.
Used in:
428
TRANSPARENCY
Chapter 15
Syntax
TRAILERFILE=leref
leref
species a valid SAS leref up to eight characters long. Fileref must have been previously assigned with a FILENAME statement or a host command before running the Metagraphics driver. See FILENAME Statement on page 36 for additional information on the FILENAME statement.
Details
For information about Metagraphics drivers, contact Technical Support.
TRANSPARENCY
Species whether the background of the image should appear to be transparent when the image is displayed in the browser.
Used in: GOPTIONS statement
NOTRANSPARENCY Restriction: This option is supported by the ACTIVEX and ACTXIMG drivers when the output is used in a PowerPoint presentation and by the GIF series of drivers only.
Default:
Syntax
TRANSPARENCY | NOTRANSPARENCY
Details
When the image is displayed and TRANSPARENCY is in effect, the browsers background color replaces the drivers background color, causing the image to appear transparent. Note: It is recommended that you set the background color of your GIF output to match the background color of the presentation in which you want to use the GIF image. As an alternative, consider using the UPNGT device. 4
TRANTAB
Selects a translate table for your system that performs ASCII-to-EBCDIC translation.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Host File Options
window
TYPE
429
Default:
Restriction:
Syntax
TRANTAB=table | user-dened-table
table
species a translate table stored as a SAS/GRAPH catalog entry. Table can be one of the following: SASGTAB0 (default translate table for your operating environment) GTABVTAM GTABTCAM
user-dened-table
Details
TRANTAB is set by the SAS Installation Representative and is needed when an EBCDIC host sends data to an ASCII graphics device. See the SAS/GRAPH installation instructions for details. You can also create your own translate table using the TRANTAB procedure. For a description of the TRANTAB Procedure, see Base SAS Procedures Guide.
TYPE
Species the type of output device to which graphics commands are sent.
Used in: Default:
Syntax
TYPE=CAMERA | CRT | EXPORT | PLOTTER | PRINTER
CAMERA
identies the list in which the device appears under SAS/ASSIST software. This is used for drivers that produce output to be exported to other software applications, such as CGM or HPGL.
430
UCC
Chapter 15
PLOTTER
species a printer
Details
You should not modify this value for SAS-supplied device drivers.
UCC
Sets the user-dened control characters for the device.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Parameters window Restriction:
Syntax
UCC=control-characters-hex-stringX
control-characters-hex-string
is a hexadecimal string that can be up 32 bytes (64 characters) long. You only need to specify up to the last non-zero byte; the remaining bytes will be set to zero.
Details
Not all devices support this feature, and the meaning of each byte of the string varies from device to device. Typically the UCC byte position is indicated by a bracketed value. For example, UCC[2] refers to the second byte of the string. For assistance with determining UCC values for your specic device, please contact SAS Technical Support.
USERINPUT
Determines whether user input is enabled for the device.
Used in: GOPTIONS statement
Syntax
USERINPUT | NOUSERINPUT
VORIGIN
431
USERINPUT
Details
When user input is enabled, processing of the animation is suspended until a carriage return, mouse click, or some other application-dependent event occurs. The user input feature works with the delay time setting so that processing continues when user input occurs or the delay time has elapsed, whichever comes rst.
VORIGIN
Sets the vertical offset from the lower-left corner of the display area to the lower-left corner of the graph.
Used in:
GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window not supported by Java or ActiveX
Restriction:
Syntax
VORIGIN=vertical-offset <IN | CM | PT>
must be a nonnegative number and can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify VORIGIN, a default offset is searched for in this order:
1 the bottom margin specication on an OPTIONS BOTTOMMARGIN setting 2 VORIGIN setting in the device catalog.
Details
The display area is dened by the XMAX and YMAX device parameters. By default, the origin of the graphics output area is the lower-left corner of the display area; the graphics output is offset from the lower-left corner of the display area by the values of HORIGIN and VORIGIN. VORIGIN + VSIZE cannot exceed YMAX. Note: When sending output to the PRINTER destination (ODS PRINTER), if you specify the VSIZE= option without specifying the HSIZE= option, the default origin of the graphics output area changes. The default placement of the graph changes from the lower-left corner of the display area to the top-center of the graphics output area. Likewise, if you specify the HSIZE= option without specifying the VSIZE= option, the graph is positioned at the top-center of the graphics output area by default. 4 See The Graphics Output and Device Display Areas on page 59 for details.
432
VPOS
Chapter 15
VPOS
Sets the number of rows in the graphics output area.
Used in: GOPTIONS statement Default:
devicedependent: the value of the LROWS or PROWS device parameter not supported by Java or ActiveX
Restriction:
Syntax
VPOS=rows
rows
species the number of rows in the graphics output area, which is equivalent to the number of hardware characters that can be displayed vertically. Specifying VPOS=0 causes the device driver to use the default hardware character cell height for the device.
Details
The VPOS= graphics option overrides the values of the LROWS or PROWS device parameters and temporarily sets the number of columns in the graphics output area. VPOS= does not affect the height of the graphics output area but merely divides it into rows. Therefore, you can use VPOS= to control cell height. The values specied in the HPOS= and VPOS= graphics options determine the size of a character cell for the graphics output area and consequently the size of many graphics elements, such as hardware text. The larger the size of the HPOS= and VPOS= values, the smaller the size of each character cell. See Overview on page 59 for more information.
VSIZE
Sets the vertical size of the graphics output area.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window Restriction:
Syntax
VSIZE=vertical-size <IN | CM | PT>
V6COMP
433
species the height of the graphics output area; vertical-size must be a positive number and can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify the VSIZE= option, a default size is searched for in this order:
1 the vertical size is calculated as
YMAX BOTTOMMARGIN TOPMARGIN Note that BOTTOMMARGIN and TOPMARGIN are used in the OPTIONS statement.
2 VSIZE setting in the device catalog.
V6COMP
Allows programs that are run in the current version of SAS to run with selected Version 6 defaults.
Used in: Default:
Restriction:
Partially supported by Java or ActiveX Ignored unless OPTIONS NOGSTYLE is also specied
Syntax
V6COMP | NOV6COMP
V6COMP
3 By default, patterns are hatched patterns, not solid, and the default outline
color matches the pattern color.
3 By default, the GCHART and GPLOT procedures do not draw a frame around
the axis area.
NOV6COMP
causes SAS/GRAPH programs to use all the features of the current SAS version.
Details
V6COMP performs the necessary conversions so that, for selected defaults, you get the same results in the current SAS version that you did in Version 6. Note: V6COMP does not convert Version 6 catalogs to catalogs with the current SAS catalog format. 4
434
XMAX
Chapter 15
XMAX
Species the width of the addressable graphics display area; affects the horizontal resolution of the device and the horizontal dimension of the graphics output area.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window Restriction:
ActiveX
See also: HSIZE, PAPERSIZE, XPIXELS
Syntax
XMAX=width <IN | CM | PT>
width
is a positive number that can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify XMAX, a default width is searched for in this order:
1 the width specication on an OPTIONS PAPERSIZE setting 2 XMAX in the device entry catalog.
If XMAX=0, default behavior is used. If both XMAX and PAPERSIZE have been specied on GOPTIONS, the last request is used.
Details
Like the XPIXELS device parameter, XMAX controls the width of the display area, but the width is in inches, centimeters, or points rather than pixels. Typically, you might use XMAX to change the width of the display area for a hardcopy device. SAS/GRAPH uses the value of XMAX in calculating the horizontal resolution of the device: x-resolution = XPIXELS / XMAX However, changing XMAX does not necessarily change the resolution:
3 If you use the GOPTIONS statement to change only the value of XMAX= and do
not change XPIXELS=, SAS/GRAPH retains the default resolution of the device and recalculates XPIXELS, temporarily changing the width.
3 If you specify values for both XMAX= and XPIXELS=, SAS/GRAPH recalculates
the resolution of the device using both of the specied values. The new resolution might be different. For example, both of these pairs of values produce the same resolution, 300dpi: XPIXELS=1500 and XMAX=5 XPIXELS=1800 and XMAX=6 XMAX also affects the value of HSIZE, which controls the horizontal dimension of the graphics output area.
3 If you change the value of XMAX and do not change HSIZE=, SAS/GRAPH
calculates a new value for HSIZE=, using this formula: HSIZE = XMAX margins
XPIXELS
435
Note: The margins quantity, here, is not a device parameter. It represents the value of the left margin plus the right margin. The left margin is the value of HORIGIN. The right margin is whatever is left over when you subtract HSIZE and HORIGIN from XMAX. The value of margins is always based on the original XMAX and HSIZE values that are stored in the device entry. 4
3 If you specify values for both XMAX= and HSIZE=, SAS/GRAPH uses the specied
values plus the value of device parameter HORIGIN. Anything left over is added to the right margin. For example, if XMAX=6IN and HSIZE=4IN and HORIGIN=.5IN, the right margin will be 1.5in. If HSIZE= is larger than XMAX=, HSIZE= is ignored. To permanently change the value of the XMAX device parameter in the device entry, use the GDEVICE procedure. This can change the resolution. To temporarily change the size of the display and the resolution of the device for the current graph or for the duration of your SAS session, use XMAX= and XPIXELS= in the GOPTIONS statement. To reset the value of XMAX to the default, specify XMAX=0. To return to the default resolution for the device, specify both XMAX=0 and XPIXELS=0. See Overview on page 59 for more information.
XPIXELS
Species the width of the addressable display area in pixels and in conjunction with XMAX determines the horizontal resolution for the device.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window devicedependent Partially supported by Java and ActiveX
Syntax
XPIXELS=width-in-pixels
width-in-pixels
Details
Like the XMAX device parameter, XPIXELS controls the width of the display area, but the width is in pixels rather than inches, centimeters, or points. Typically, you might use XPIXELS to change the width of the display area for an image format device. Note: This option overrides the OutputWidth style attribute in the graph styles. For more information on graph styles, refer to the TEMPLATE procedure documentation in SAS Output Delivery System: Users Guide. 4 The value of XPIXELS is used in calculating the resolution of the device: x-resolution = XPIXELS / XMAX
436
YMAX
Chapter 15
However, changing XPIXELS does not necessarily change the device resolution: 3 If you use the GOPTIONS statement to change only the value of XPIXELS= and do not change XMAX=, SAS/GRAPH retains the default resolution of the device and recalculates XMAX, temporarily changing the width of the display. If HSIZE= is also not specied, SAS/GRAPH uses the new XMAX value to calculate a new HSIZE value, using this formula: HSIZE = XMAX margins Note: Margins are not device parameters, but represent the value of HORIGIN (the left margin) plus the right margin. The right margin is whatever is left over when you subtract HSIZE and HORIGIN from XMAX. The values of margins is always based on the original XMAX and HSIZE values that are stored in the device entry. 4 If HSIZE= is specied and its value is larger than XMAX, HSIZE= is ignored. 3 If you use the GDEVICE procedure to permanently change the value of the XPIXELS device parameter in the device entry, SAS/GRAPH automatically recalculates the resolution of the device is using the value of XMAX device parameter. 3 If you change the values of both XMAX= and XPIXELS=, SAS/GRAPH recalculates the resolution of the device using both of the specied values. Note: When SAS/GRAPH recalculates the resolution, the resolution does not necessarily change. For example, both of these pairs of values produce the same resolution, 300dpi:
XPIXELS=1500 and XMAX=5 XPIXELS=1800 and XMAX=6
4
To reset the value of XPIXELS to the default, specify XPIXELS=0. To return to the default resolution for the device, specify both XPIXELS=0 and XMAX=0.
YMAX
Species the height of the addressable graphics display area; affects the vertical resolution of the device and the vertical dimension of the graphics output area.
Used in: GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window
ignored by default display drivers and universal printing drivers; not supported by Java or ActiveX See also: PAPERSIZE, VSIZE, YPIXELS
Restriction:
Syntax
YMAX=height <IN | CM | PT>
height
is a positive number that can be followed by a unit specication, either IN for inches (default), or CM for centimeters, or PT for points. If you do not specify YMAX, a default height is searched for in this order:
YPIXELS
437
1 the height specication on an OPTIONS PAPERSIZE setting 2 YMAX in the device entry catalog.
If YMAX=0, default behavior is used. If both YMAX and PAPERSIZE have been specied on GOPTIONS, the last request is used.
Details
See XMAX on page 434.
YPIXELS
Species the height of the addressable display area in pixels and in conjunction with YMAX determines the horizontal resolution for the device.
Used in: Default:
GOPTIONS statement; GDEVICE procedure; GDEVICE Detail window devicedependent Partially supported by Java and ActiveX
Syntax
YPIXELS=height-in-pixels
height-in-pixels
Details
See XPIXELS on page 435. Note: This option overrides the OutputHeight style attribute in the graph styles. For more information on graph styles, refer to the TEMPLATE procedure documentation in SAS Output Delivery System: Users Guide. 4
438
439
P A R T
2
441
16. . . . . . . . .Introducing SAS/GRAPH Output for the Web 17. . . . . . . . .Creating Interactive Output for ActiveX 18. . . . . . . . .Creating Interactive Output for Java
455
471 487
19. . . . . . . . .Attributes and Parameters for Java and ActiveX 20. . . . . . . . .Generating Static Graphics
505 521 533
23. . . . . . . . .Generating Web Output with the Annotate Facility 24. . . . . . . . .Creating Interactive Treeview Diagrams
545 555
541
26. . . . . . . . .Macro Arguments for the DS2CONST and DS2TREE 27. . . . . . . . .Enhancing Web Presentations with Chart Descriptions, Data
Tips, and Drill-Down Functionality 597
635
Chapter
Chapter
440
441
CHAPTER
16
Introducing SAS/GRAPH Output for the Web
Which Device Driver or Macro Do I Use? 441 Types of Web Presentations Available 442 Presentations That Use The ActiveX Control 442 Presentations That Use Java Applets 443 Graph, Map, Tilechart, and Contour Applets 443 Treeview Applet 444 Constellation Applet 445 Metaview Applet 446 Presentations that Use Static Images 447 ACTXIMG Presentations 448 JAVAIMG Presentations 448 GIF, JPEG, and PNG Presentations 448 Animated GIF Presentations 449 Selecting a Type of Web Presentation 449 How is the graphical output produced? 449 What features are supported for each type of presentation? 450 What does your audience need to view the presentation? 451 Recommendations 452 Generating Web Presentations 453 Using ODS HTML with a SAS/GRAPH Procedure 453 Using DS2TREE and DS2CONST Macros 453
3 3 3 3 3 3
What type of graph do I need? What procedure, if any, generates the graph that I need? In which operating environments do I need to generate the presentation? In which operating environments do I need to deliver the presentation? Will my audience need to install additional software to view the presentation? What interactive features do I want in my presentation?
The following topics describe the types of web presentations that are available, help you decide which type you need, and tell you how to generate the presentation and deliver it to your audience. The primary purpose of these topics is to help you determine which device driver or macro you need to use.
442
Chapter 16
3 Types of Web Presentations Available on page 442 describes each type of web
presentation, their features, and which device driver or macro you need to use to create that type of presentation. 3 Selecting a Type of Web Presentation on page 449 guides you through the process of determining which device driver or macro to use. If the type of presentation you need to generate can be generated with multiple device drivers, then additional factors determine which driver to use. 3 Generating Web Presentations on page 453 summarizes the methods by which each type of web presentation is created.
443
Display 16.1
The ActiveX control can be viewed only in Windows operating environments with Microsoft Internet Explorer on a PC with the ActiveX control installed. The ActiveX control displays output from the G3D, GAREABAR, GBARLINE, GCHART, GCONTOUR, GMAP, GPLOT, GRADAR, and GTILE procedures. To create a graph to be displayed by ActiveX, specify DEVICE=ACTIVEX on your GOPTIONS statement. See Using ODS HTML with a SAS/GRAPH Procedure on page 453 and Chapter 17, Creating Interactive Output for ActiveX, on page 455 for more information.
444
Chapter 16
Graph, Map, Tilechart, and Contour applets enable interactive features such as data tips and drill-down links, and they provide pop-up menus which enable the user to change properties such as the graphs colors, legends, and axes. Display 16.2 on page 444 shows PROC GCHART output displayed by the Java Graph applet with a Properties dialog box. You can open the pop-up menu for these applets by positioning your cursor over the graph and pressing the right mouse button.
Display 16.2 Sample Java Presentation
These applets display the output of the following SAS/GRAPH procedures: Graph Applet Contour Applet Map Applet Tilechart Applet G3D Scatter Plots, GCHART, GPLOT G3D Surface Plots, GCONTOUR GMAP GTILE
To create a graph to be displayed by one of these applets, specify DEVICE=JAVA on your GOPTIONS statement. For more information, see Using ODS HTML with a SAS/ GRAPH Procedure on page 453 and Chapter 18, Creating Interactive Output for Java, on page 471.
Treeview Applet
This applet displays a treeview diagram, which shows the parent-child relationships in a tree structure. In a treeview diagram, each child node has exactly one parent, and each parent node has zero or more children. In other words, the relationships in a treeview diagram are one-to-many. A treeview diagram is ideal for displaying such data as organizational charts or the hierarchical relationships of the pages of a Web site. By default, the Treeview applet zooms in on the portion of the tree that is in the center of the display, as if you were looking through a sh-eye lens. Nodes in the center of the display are spread apart and shown with more detail, including node labels. Nodes near the periphery of the display are compressed and shown with less detail.
445
Initially, the Treeview applet places the root node in the center of the display. You can click and drag the diagram to change the portion of the diagram that is in the center of the display. The Treeview applet supports a pop-up menu that enables you to search for nodes, select or hide subtrees, and so on. You can add hotspots that link to Web pages when the user clicks on a node. For example, Display 16.3 on page 445 shows a treeview diagram (with the pop-up menu opened) displaying the structure of an XML Document Type Denition. To generate a treeview diagram, use the DS2TREE macro. For more information, see Chapter 24, Creating Interactive Treeview Diagrams, on page 545.
Display 16.3 Sample Treeview Diagram
Constellation Applet
The Constellation applet displays a general node-link diagram. Each node can be linked to one or more other nodes. Unlike the Treeview applet, the Constellation applet does not require a hierarchical relationship between the nodes. (Although it can be used to display hierarchical relationships, the Constellation applet does not automatically place the root node at the center of the display.) The Constellation applet supports node and link properties, which determine the color and size of the nodes and the color and thickness of the link joining the nodes. These properties indicate the relative strength of the relationship between the nodes. Like the Treeview applet, by default, the Constellation applet zooms in on the portion of the diagram that is in the center of the display, as if you were looking through a sh-eye lens. Nodes in the center of the display are spread apart and shown with more detail, including node labels. Nodes near the periphery of the display are compressed and shown with less detail. You can click and drag the diagram to change the portion of the diagram that is in the center of the display.
446
Chapter 16
The Constellation applet has a pop-up menu that supports several functions such as highlighting specic links and searching for specic nodes. You can add hotspots that link to Web pages when the user clicks on a node. Display 16.4 on page 446 shows a constellation diagram (with the Mouse Help menu displayed). To generate the Constellation applet, use the DS2CONST macro. For more information, see Chapter 25, Creating Interactive Constellation Diagrams, on page 555.
Display 16.4 Sample Constellation Diagram
Metaview Applet
The Metaview applet displays the output of SAS/GRAPH procedures and enables interactive features that are not available with static images such as GIFs or JPEGs. It enables zooming and scrolling and supports pop-up menus with customized user-selectable links. When you generate a graph with the Metaview applet, you can specify background colors and text fonts, and enable drill-down links to HTML les, metagraphics les, and sets of metacodes. Display 16.5 on page 447 shows the zoom control that the Metaview applet provides.
447
Display 16.5
The Metaview applet displays output from the G3D, GANNO, GBARLINE, GCHART, GCONTOUR, GPLOT, GMAP, GRADAR, GREPLAY, and GSLIDE procedures. To create a graph to be displayed by the Metaview applet, specify DEVICE=JAVAMETA on your GOPTIONS statement. For additional information, see Chapter 22, Generating Interactive Metagraphics Output, on page 533.
448
Chapter 16
To generate a web presentation that uses one of these drivers, specify the driver name with the DEVICE= option in your GOPTIONS statement. All of these device drivers generate output from SAS/GRAPH procedures. For more information, refer to the following topics:
3 3 3 3 3 3
ACTXIMG Presentations on page 448 JAVAIMG Presentations on page 448 GIF, JPEG, and PNG Presentations on page 448 Animated GIF Presentations on page 449 Using ODS HTML with a SAS/GRAPH Procedure on page 453 Chapter 20, Generating Static Graphics, on page 505.
ACTXIMG Presentations
You can use the ACTXIMG device driver to create a presentation that uses a PNG le that is identical in appearance to the image produced with the ACTIVEX device driver. A presentation generated with the ACTXIMG driver supports data tips and drill-down links for GCHART, GBARLINE, and GPLOT (except for high-low plots) output. To render your output (create the PNG le), the ActiveX control must be installed on the PC where your SAS session is running. Because of this requirement, ACTXIMG presentations can be generated only on PCs. When you specify the ACTXIMG device driver, the output is rendered when your web presentation is generated, and the user does not need to have the ActiveX control installed to view it. Note: The ACTXIMG device cannot be used with the ODS PDF, PCL, PS, or PRINTER destinations on 64-bit machines. SAS uses the JAVAIMG device instead.
You can use the ACTXIMG device driver to generate presentations with the same procedures that are supported by the ACTIVEX driver: G3D, GAREABAR, GBARLINE, GCHART, GCONTOUR, GPLOT, GMAP, GRADAR, and GTILE.
JAVAIMG Presentations
You can use the JAVAIMG device driver to create a presentation that uses a PNG le that is identical in appearance to the image produced with the JAVA device driver. The appropriate Java applet (Graph, Map, Tilechart, or Contour applet) is required to render your output (create the PNG le). The appropriate Java applet must be installed on the machine where your SAS session is running. When you specify the JAVAIMG device driver, the output is rendered when your web presentation is generated, and the user does not need to have any Java applet les installed to view it. You can use the JAVAIMG device driver to generate presentations with the same procedures that are supported by the JAVA driver: G3D, GCHART, GCONTOUR, GPLOT, and GTILE.
449
450
Chapter 16
Table 16.1
Driver or Macro ACTXIMG JAVAIMG ACTIVEX JAVA SVG GIF, JPEG, PNG GIFANIM JAVAMETA DS2TREE, DS2CONST
For example, if you need a radar chart, you can use the ACTXIMG, ACTIVEX, or JAVAMETA driver (as well as other drivers). Which device driver you choose depends on what additional features (such as interactive capabilities) you need and on how you plan to deliver your web presentation. If you need to graph hierarchical relationships, consider using the DS2TREE macro to generate a treeview diagram. If you need to show relationships that are not hierarchical or if you need to show the relative afnity of the relationships, then consider using the DS2CONST macro to generate a constellation diagram.
451
Table 16.2
Driver or Macro ACTXIMG JAVAIMG ACTIVEX JAVA SVG GIF, JPEG, PNG GIFANIM JAVAMETA DS2TREE, DS2CONST
Data tips and drill-down links for ACTXIMG are supported for output from GCHART, GPLOT (except for high-low plots), GBARLINE, and GRADAR. The pop-up menus available with the JAVA and ACTIVEX device drivers typically enable your audience to change many aspects of the graph such as changing chart types, subsetting data, changing the variable used as the response variable, turning data tips on or off, or changing the colors used the graph. Static graphs do not offer any of these interactive features. Web presentations that use the JAVAMETA driver may enable a zoom control, and page selection and slide show controls for presentations that include multiple images.
Select the System Requirements link for the appropriate operating system environment and search for the section on viewing HTML pages created for Java and ActiveX. It is recommended that graphs be displayed on a device that has at least 16-bit color (that is, more than 8-bit, 256 colors). Depending on how the presentation is generated, there may be additional requirements. The following table shows, for each type of Web presentation, what is required on a viewers machine besides a supported browser.
452
Recommendations
Chapter 16
What does your audience need to view the presentation besides the
Additional Requirements None None The presentation must be viewed with Internet Explorer on a Windows system with the SAS ActiveX control installed locally. The Java applet les must be installed locally or on a server accessible by the client machine, and Java 1.4 plug-in must be installed on each client machine. On Windows systems, the user is prompted to install the plug-in if it is not already installed. On other systems, the plug-in can be installed from the Sun Microsystems site (http://www.sun.com) or from one of the SAS Third Party Software Components CDs. The presentation must be viewed in an SVG-enabled browser. None None The Java applet les must be installed locally or on a server accessible by the client machine. The Java plug-in is not required on the client machine; the Metaview applet works with the Java Virtual Machine that is built into the supported browsers. The Java applet les must be installed locally or on a server accessible by the client machine, and Java 1.4 plug-in must be installed on each client machine. On Windows systems, the user is prompted to install the plug-in if it is not already installed. On other systems, the plug-in can be installed from the Sun Microsystems site (http://www.sun.com) or from one of the SAS Third Party Software Components CDs.
JAVA
DS2TREE, DS2CONST
Presentations generated with the ACTIVEX driver can be viewed only with Internet Explorer on Windows PCs, and the ActiveX control must be installed locally on each PC. Presentations generated with the JAVAMETA driver can be viewed in any supported browser and offer limited interactivity, but do not require that a Java plug-in be installed.
Recommendations
If you will be delivering your presentation on Windows only and you want your audience to be able to interact with the graph, then you can use the ACTIVEX device driver. If you will be delivering your presentation to other operating environments, but you still want to use interactive features, then you can use the JAVA device driver. However, the ACTIVEX and JAVA device drivers require that your audience install the ActiveX control and Java plug-in, respectively.
453
If you want the look of the ACTIVEX or JAVA driver, but do not need the interactive capability or do not want to require that your audience install the ActiveX control or the Java plug-in, then use the ACTXIMG or JAVAIMG device drivers. If you need data tips, drill-down capability, or limited interactivity such as zoom, but you do not want to require that your audience install the Java plug-in or the ActiveX control, then you can use the JAVAMETA device driver. If you need only data tips and drill-down capability, then you can use the GIF, JPEG, or PNG device driver.
3 using the ODS HTML destination with a SAS/GRAPH procedure. 3 using the DS2TREE or DS2CONST macro.
drivers that generate image output les, use the PATH= option to ensure that all output les are stored in the same location. 2 Run a graphics procedure. If your procedure supports run-group processing, be sure include a QUIT statement.
3 Close the HTML destination to write your HTML le.
If the LISTING destination is open, then SAS/GRAPH creates an additional copy of your output. To improve performance, you might want to close the LISTING destination while you are generating Web output.
454
455
CHAPTER
17
Creating Interactive Output for ActiveX
Overview 455 When to Use the ACTIVEX Device 456 Installing the SAS/GRAPH ActiveX Control 457 Manually Installing the SAS/GRAPH ActiveX Control 457 Conguring Your Program to Prompt Users to Install the SAS/GRAPH ActiveX Control 458 Conguring an Existing ActiveX Presentation to Prompt Users to Install the SAS/GRAPH ActiveX Control 458 Uninstalling the SAS/GRAPH ActiveX Control 459 Generating Output for ActiveX 459 About Languages in ACTIVEX 460 About Special Fonts and Symbols in ACTIVEX 461 SAS Formats Supported by ACTIVEX 461 Conguring Drill-Down Links with ACTIVEX 462 ActiveX Examples 463 Generating an ActiveX Graph for a Microsoft Word Document 463 Generating an Interactive Contour Plot in ActiveX 465 Providing JavaScript Drill-Down with ActiveX 466 Providing More JavaScript Drill-Down with ActiveX 468
Overview
The SAS/GRAPH ActiveX Control provides user interactivity in Microsoft Ofce products in the Windows operating environment. Interactive features include the ability to change graph types (a bar chart to a pie chart, for example), display data tips at the point of the cursor, rotate and zoom, reassign variable roles, and modify axes, legends, colors, and text fonts. For your Web users who have SAS installed locally, the control is run automatically when the HTML output le is displayed in Internet Explorer. For your Web users who do not have the SAS system installed locally, and who have not already installed the SAS/GRAPH ActiveX Control, you can congure your HTML output le to prompt them to install the control at display time, as described in Installing the SAS/GRAPH ActiveX Control on page 457. You can enhance your ActiveX presentations by adding drill-down links (see Conguring Drill-Down Links with ACTIVEX on page 462) and conguring interactive features (see Specifying Parameters and Attributes for Java and ActiveX on page 487). In addition to HTML output, you can use the SAS/GRAPH ActiveX Control to display interactive graphs in Object Linked Embedded (OLE) documents, and in applications written in Visual Basic, C++, and JavaScript. You can also include them in Microsoft Ofce Products, such as Word, Excel, and PowerPoint. See Chapter 8, Exporting Your Graphs to Microsoft Ofce Products, on page 111.
456
Chapter 17
The following table lists the procedures and statements that generate output that can be displayed in the SAS/GRAPH ActiveX Control.
Table 17.1 Procedures and Statements that Generate Output for the SAS/GRAPH ActiveX Control
Procedure GAREABAR GBARLINE GCHART GCONTOUR GMAP Statements HBAR, VBAR BAR, PLOT BLOCK, HBAR, HBAR3D, VBAR, VBAR3D, PIE, PIE3D, DONUT PLOT CHORO, BLOCK, PRISM (see note) GPLOT GRADAR G3D GTILE BUBBLE, BUBBLE2, PLOT, PLOT2 CHART PLOT, SCATTER FLOW, TILE, TOGGLE
Note: Using PROC GMAP to generate a highly detailed map might create a large HTML output le, which might cause problems on certain Web browsers. If this is the case, you can use PROC GREDUCE to remove some of the complexity and produce a more usable map. 4 The SAS/GRAPH ActiveX Control does not enable 8-bit gray scale images. If you use images for backgrounds or chart elements, make sure that they are 24-bit images.
457
Windows systems. Although you do not need the SAS/GRAPH ActiveX Control when you are viewing the ACTXIMG output, to produce the output le, you must install the SAS/GRAPH ActiveX Control on your computer. See Installing the SAS/GRAPH ActiveX Control on page 457. You can generate output for the SAS/GRAPH ActiveX Control even if you are not working in the Windows operating environment. For example, you can generate HTML output for ActiveX in the UNIX operating environment, even though you cannot run Internet Explorer in that environment. Displaying the HTML in Internet Explorer on Windows will display the output as if it was generated in that operating environment. You can also run your SAS jobs in a stored process on UNIX and display the output in the Internet Exporer browser on Windows. When you use the ACTIVEX device with an ODS destination that does not support the ACTIVEX device, SAS/GRAPH switches to the ACTXIMG device, which generates a PNG image. For example, the ODS PDF statement generates output for the Adobe Reader in a Portable Document Format (PDF) le. This format does not support embedded ActiveX applications. Specifying the ACTIVEX device with the ODS PDF statement generates a PDF output le that contains a static image of the graphics output that is embedded in the PDF le. The ODS RTF destination creates an RTF le that contains a PNG image. The ODS PRINTER destinations use their native format. The ACTXIMG device can produce an image map in the HTML output le to enable data tips and drill-down functionality from the image. See Chapter 27, Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality, on page 597.
http://www.sas.com/apps/demosdownloads/setupintro.jsp
2 If you are not already logged in, type in your user name and password, and then
click the LOG IN button. Note: You must log in to download les. If you do not have an account, click the
Sign up now link to create an account.
3 Click the Request Download button for your Windows platform. This opens the
Note: If you do not want to accept the license agreement, click the
Do Not Accept button to cancel the download.
458
Conguring Your Program to Prompt Users to Install the SAS/GRAPH ActiveX Control
Chapter 17
5 On the Downloads page, click the Download button, and then select a location on
your computer for the le. This downloads a ZIP le to your computer.
6 Extract the ZIP le that you downloaded. This extracts le sasgraph.exe. 7 Run the installation program (sasgraph.exe) and follow the installation prompts.
The installation program installs the SAS/GRAPH ActiveX Control les in the following folder:
C:\Program Files\SAS\SharedFiles\Graph\Vx
Where x is the version number. Installation requires eight megabytes of disk space. Note: For 64-bit enabled Windows, the SAS/GRAPH ActiveX Control works only in the 32-bit version of Internet Explorer. 4
Conguring Your Program to Prompt Users to Install the SAS/GRAPH ActiveX Control
When you create a Web presentation using the SAS/GRAPH ACTIVEX device, by default, the resulting presentation is congured to prompt users to install the SAS/GRAPH ActiveX Control if it is not already installed. The SAS/GRAPH software congures the presentation by setting the CODEBASE= option in the HTML le as shown in the following example:
CODEBASE="http://www2.sas.com/codebase/graph/v92/sasgraph.exe#version=9,2"
No les are installed without the users permission. Users can refuse installation by refusing the licensing agreement at the beginning of the installation process. Also note that the installation program does not run if the control has already been installed. To be able to access the installation program, Web users must be able to access its storage location. You might need to copy the installation program to another location to ensure availability. You can use the CODEBASE= option with the ODS HTML statement to congure the HTML output le to reference the installation program when the HTML le is opened. For example:
ods html body="myGraph.html" codebase="http://www.ourco.com/sasweb/graph/sasgraph.exe#version=9,2,0,8183";
If the installation program is not stored on a Web server, then you can use a le specication as the value of the CODEBASE attribute. For example:
ods html body="myGraph.html" codebase="/grsrc/sasgraph.exe#version=9,2,0,8183";
Conguring an Existing ActiveX Presentation to Prompt Users to Install the SAS/GRAPH ActiveX Control
You can edit an existing presentation that was generated with the ACTIVEX device so that the presentation prompts your users to install the SAS/GRAPH ActiveX Control if it is not already installed. Follow these steps to add the installation capability to your ACTIVEX presentation:
1 In a text editor, open the initial HTML le of your Web presentation. 2 In the OBJECT tag, insert the CODEBASE= attribute. The attribute references
the location of the installation program. The following CODEBASE value references a public directory:
459
CODEBASE="file://grsrc/sasgraph.exe"
If the installation program is stored on a Web server, use an HTTP reference. For example:
CODEBASE="http://www.ourco.com/sasweb/graph/sasgraph.exe#version=9,2,0,8183"
With the le thus modied, displaying the HTML le gives users who need it the option of installing the control in the default location on their local computers. Note: If you want to install the control in a non-default location, you must install the control manually, as described in Manually Installing the SAS/GRAPH ActiveX Control on page 457. 4
Application Internet Explorer Microsoft Word Adobe Acrobat Reader Ghostview, and so on
Note:
460
Chapter 17
Table 17.1 on page 456 lists the SAS/GRAPH procedures that generate output for ActiveX. Follow these steps to generate a default Web presentation that runs the SAS/GRAPH ActiveX Control. 1 Reset the graphics options and specify the ACTIVEX device:
goptions reset=all device=activex;
3 Open an ODS destination that is listed in Table 17.2 on page 459. Use the
STYLE= option to specify an ODS style (see Chapter 10, Controlling The Appearance of Your Graphs, on page 131), and use the PATH= and BODY= options to specify an output lename other than the default. For example:
ods html path="C:\" body="your_file.htm" style="banker";
4 Run a procedure or procedures that are supported by the ACTIVEX device (see
5 Close the ODS destination that you opened in step 3, and then reopen the ODS
The preceding program assumes that your Web users have installed the SAS/GRAPH ActiveX Control in advance. If the SAS/GRAPH ActiveX Control is not already installed on a users computer, your Web presentation automatically prompts the user to install the SAS/GRAPH ActiveX Control. For information on prompting new users to start the SAS/GRAPH ActiveX Control installation process, see Conguring Your Program to Prompt Users to Install the SAS/GRAPH ActiveX Control on page 458. For further troubleshooting information, see Troubleshooting Web Output on page 635. For information on enhancing the default Web presentation, see Conguring Drill-Down Links with ACTIVEX on page 462.
461
Table 17.4
BEST D EUROX IB MINGUO
462
Chapter 17
Table 17.5
DATE DDMMYYB DDMMYYS DTYEAR JULDAY MMDDYYC MMSS MMYYP NENGO TIME WEEKDAY YYMM YYMMDDC YYMMN YYQC YYQRC YYQS
Note: The ACTIVEX and ACTXIMG devices do not support nested formats. If you create a custom format to use with these devices, do not nest existing formats in your new format. 4
463
The SAS/GRAPH ActiveX Control enables the URL, HTML, and Script drill-down modes for charts and maps. Drill-down functionality is not enabled for contour plots. These drill-down modes are implemented in ActiveX in the same way that they are implemented in Java. For information on implementing these drill-down modes, see Chapter 27, Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality, on page 597. Note: You can convert the Java examples to ActiveX by changing the DEVICE=JAVA graphics option in the GOPTIONS statement to DEVICE=ACTIVEX. The following table lists the procedures and statements that generate output that can be used in ActiveX presentations with drill-down functionality.
Table 17.6
Procedure GBARLINE GCHART GPLOT GMAP G3D
ActiveX Examples
The following sections provide examples of how to create interactive graphs using the ACTIVEX device: Generating an ActiveX Graph for a Microsoft Word Document on page 463 Generating an Interactive Contour Plot in ActiveX on page 465 Providing JavaScript Drill-Down with ActiveX on page 466 Providing More JavaScript Drill-Down with ActiveX on page 468 The following additional samples are available in the Sample Library: 3 GWBAXBLKGenerating an Interactive Block Diagram 3 GWBAXCONGenerating an Interactive Contour Plot 3 GWBAXMAPGenerating an Interactive Map for the Web
464
Chapter 17
pie type / detail=drivetrain detail_percent=best detail_value=none detail_slice=best detail_threshold=2 legend; run; quit; ods rtf close; ods listing;
The SAS/GRAPH ActiveX Control provides a pop-up menu that enables you to change many aspects of the graph, including the chart type. For example, to change the pie chart to a bar chart, right-click the graph, and then select ChartType I VerticalBar in the pop-up menu. The chart changes from a pie chart to a vertical bar chart. Note: The SAS/GRAPH ActiveX pop-up menu does not display if the SAS/GRAPH ActiveX Control is in the design mode in Microsoft Word. If the ActiveX object is in the design mode, in Microsoft Word, click the Exit Design Mode icon in the Control Toolbox. 4
465
466
Chapter 17
467
/* Change the following line to specify your output file. */ filename odsout "states.htm" ; /* If your site has already installed the map data sets and /* defined the MAPS libref, then you can delete the LIBNAME /* statement below and the sample code should work. /* If not, contact your on-site SAS support personnel /* to determine how to define the MAPS libref. *libname maps SAS-MAPS-library; /* Create a data set that contains the US states. */ proc sql; create table work.mydata as select unique state from maps.us; quit; /* Add state abbreviations to the new data set. */ data work.mydata; length Statename $2; set work.mydata; Statename=trim(left(upcase(fipstate(state)))); run; /* Specify the ACTIVEX device. */ goptions reset=all device=activex; /* Specify the HTML output file, the Script */ /* drill-down mode, and the callback method. */ /* Close ODS LISTING to conserve resources. */ ods listing close; ods html file=odsout style=default parameters=("DRILLDOWNMODE"="Script" "EXTERNALNAME"="GIDX" "DRILLTARGET"="_self" "DRILLFUNC"="MapDrill") attributes=("NAME"="GIDX"); /* Specify a map title and generate the map. */ title "State Abbreviations"; proc gmap map=maps.us data=work.mydata all; id state; choro statename / nolegend; run; quit; /* Close the HTML destination and /* open the listing destination. ods html close; ods listing; */ */ */ */ */ */ */
/* Create the MapDrill script that is specified on */ /* the ODS HTML statements DRILLFUNC parameter. */ /* Write the script to the same file that contains */
468
Chapter 17
/* the HTML output from the GMAP procedure. */ data _null_ ; file odsout mod; /* modify rather than replace file */ put " " ; put "<SCRIPT LANGUAGE=JavaScript>" ; put "function MapDrill( appletref )" ; put "{" ; put " " ; put "/* Open an alert box to show the abbreviated state name. */" ; put "for(i = 2; i < MapDrill.arguments.length; i += 2 )" ; put " {" ; put " if (MapDrill.arguments[i] == G_DEPV,f ) " ; put " alert(MapDrill.arguments[i+1]);" ; put " }" ; put " " ; put "}" ; put "</SCRIPT>"; run ;
469
/* create own custom maps data set where id is 2--letter state abbreviation(statecode) not state fips number(state) */ data cus_map; length stateabbrev $2; set maps.us; stateabbrev=fipstate(state); run; ods listing close; ods html body=odsout nogtitle style=default parameters=("DRILLDOWNMODE"="Script" "EXTERNALNAME"="GIDX" "DRILLTARGET"="_self" "DRILLFUNC"="MapDrill") attributes=("NAME"="GIDX"); legend1 label=("Closed Stores") value=(t=1 j=l "No" t=2 j=l "Yes") frame; proc gmap map=cus_map(where=(state ^in(2, 15))) data=stores; id stateabbrev; choro closedstore/discrete missing legend=legend1; run; quit; ods html close;
470
Chapter 17
ods listing; data _null_ ; file odsout mod; put put put put put put put put put put put put put put put put "<SCRIPT LANGUAGE=JavaScript>" ; " var isclosed = null; "; " var newWin; "; " var stateabbrev; "; " stateabbrev = ; "; "function MapDrill( appletref )" ; "{" ; " " ; "/* Open an alert box to show the abbreviated state name. */"; " for(i = 2; i < MapDrill.arguments.length; i += 2 )"; " { "; " if (MapDrill.arguments[i] == G_DEPV,f ) {isclosed=MapDrill.arguments[i+1]; }"; " if (MapDrill.arguments[i] == G_LABELV,f) {stateabbrev =MapDrill.arguments[i+1] + ; }"; " } "; " if (isclosed == 1.000000){ alert(stateabbrev) }"; "}";
471
CHAPTER
18
Creating Interactive Output for Java
Overview 471 When to Use the JAVA Device 472 Generating Output for Java 472 About the Java HTML Output and the Java Runtime Environment Plug-In About Languages in JAVA 474 About Special Fonts and Symbols in JAVA 474 SAS Formats Supported for Java 474 Conguring Drill-Down Links for Java 477 Examples of Interactive Java Output 477 Local Drill-Down Mode with Java 477 Script Drill-Down Mode with Java 479 URL Drill-Down Mode with Java 481 HTML Drill-Down Mode 484
473
Overview
The JAVA device generates interactive presentations that run in the Graph, Map, Tile, and Contour applets. These applets can display the output of certain SAS/GRAPH procedures as follows: Graph applet Map applet Tile applet Contour applet G3D scatter plots, GCHART, GPLOT GMAP GTILE G3D surface plots, GCONTOUR
The Java applets enable Web users to display data tips, to change the graph type, to pan, rotate, and zoom, and to change colors, fonts, axes, legends, and variable roles. Note: The Java applets do not support the GAREABAR, GBARLINE, or GRADAR procedures. To provide interactivity with the output of these procedures, use the ACTIVEX device instead, as described in Chapter 17, Creating Interactive Output for ActiveX, on page 455. ActiveX output can also appear in Microsoft Word documents or other OLE applications. 4 You can enhance JAVA-device-generated graphs by setting applet parameters and specifying Output Delivery System (ODS) options. Applet parameters let you congure drill-down links and override default values in the user interface. Information on parameters is provided in Chapter 19, Attributes and Parameters for Java and ActiveX, on page 487. You can use ODS styles to enhance the appearance of JAVA-device-generated charts, as described in Chapter 10, Controlling The Appearance of Your Graphs, on page 131.
472
Chapter 18
To generate a Web presentation that runs the Graph, Map, or Contour applet, you generally specify the JAVA device in a GOPTIONS statement, open the HTML destination, generate one or more graphs, and then close the HTML destination, as described in Generating Output for Java on page 472. You can generate the same graphs as static images using the DEVICE=JAVAIMG graphics option. Static images can be displayed without requiring that the Web user install the applets or Java Runtime Environment (JRE). For details, see ACTXIMG and JAVAIMG Devices on page 508. You can also use the JAVAMETA device to create interactive metagraphics output. See Chapter 22, Generating Interactive Metagraphics Output, on page 533.
3 Open the ODS HTML destination. You can use the BODY= option to specify an
HTML lename, and the STYLE= option to specify an ODS style (see Chapter 10, Controlling The Appearance of Your Graphs, on page 131). Use the PARAMETERS= option to congure the applet (see Specifying Parameters and Attributes for Java and ActiveX on page 487). For example:
ods html file="your_file.htm" style=gears parameters=("tips"="none");
Note: To run an applet, your users must be able access the appropriate Java archive les. Two archives are referenced by default: one is the Java plug-in from Sun Microsystems, and the other is the SAS Java archive.
In the HTML output le, the location of the Java plug-in from Sun Microsystems is specied in the CODEBASE attribute of the OBJECT tag. If you need to change this default value, then use the ATTRIBUTES= option of the ODS statement, as described in Specifying Parameters and Attributes for Java and ActiveX on page 487. On Windows systems, the user is prompted to install the plug-in if it is not already installed. On other systems, the plug-in can be installed
About the Java HTML Output and the Java Runtime Environment Plug-In
473
from the Sun Microsystems site (http://www.sun.com) or from the SAS Third-Party Software References Web page:
http://support.sas.com/resources/thirdpartysupport/index.html
The location of the SAS Java archive is specied in the JAVA_CODEBASE and the ARCHIVE parameters in the body of the APPLET tag. The default JAVA_CODEBASE is specied by the APPLETLOC= system option. If the default value of this system option species a widely accessible URL, then you do not need to change this value. If you need to specify a different location, then you can change the value of the system option. Another alternative is to override the APPLETLOC= system option by specifying a value for the ODS statement option CODEBASE=, as described in Specifying Parameters and Attributes for Java and ActiveX on page 487. Note: When specifying a location for the SAS Java archive, you can use an HTTP address, or you can use a UNC path, such as //sasjava, with forward slashes instead of backward slashes. 4
4 Run a procedure or procedures that are used by the JAVA device (see Table 17.1 on
page 456):
proc gchart data=sashelp.class; vbar height / group=age; run; quit;
5 Close the ODS HTML destination, and then reopen the ODS LISTING destination:
ods html close; ods listing;
Running your program starts the applet and displays the initial graph. If the browser display differs from what you see in SAS, then ensure that your SAS/GRAPH procedure is fully enabled in the applet. Refer to Appendix 1, Summary of ActiveX and Java Support, on page 1593 for details. Note: Using the GMAP procedure to generate a highly detailed map might create a large HTML output le, which might cause problems on certain browsers. If this is the case, you can run the GREDUCE procedure to remove some of the complexity and produce a more usable map. 4 For further information on troubleshooting Web output, see Resolving Differences Between Graphs Generated with Different Technologies on page 640.
About the Java HTML Output and the Java Runtime Environment Plug-In
The Java Runtime Environment (JRE) plug-in is required to open HTML output that is generated by the JAVA device. If you open an HTML le that you generated using the JAVA device and you do not have the JRE plug-in installed for your Web browser, the browser prompts you to install the JRE plug-in. You must install the JRE plug-in for your browser in this case. When your users open your HTML le, they will also have to install the JRE plug-in for their Web browser if the plug-in is not already installed on their computer. The 9.2 SAS/GRAPH Java applets will work with JRE 1.5.0_12. They have also been tested with 1.5.0_13 and 1.5.0_15. We recommended that you use one of these versions. If future JREs are backward compatible, then the applets should work without any issues.
474
Chapter 18
Table 18.1
$ $F
475
Table 18.2
BEST D EUROX NLBEST
NLMNIBRL NLMNIDKK NLMNIHKD NLMNIINR NLMNIMOP NLMNIPLN NLMNISGD NLMNIUSD NLMNLBRL NLMNLDKK NLMNLHKD NLMNLINR NLMNLMOP NLMNLPLN NLMNLSGD NLMNLUSD NLNUMI OCTAL RSTDOCNY RSTDOPYY
Table 18.3
AFRDFDD AFRDFMN CATDFDE CATDFMY CRODFDN
476
Chapter 18
DATE DDMMYYN DESDFDWN DEUDFDD DEUDFMN DTDATE ENGDFDD ENGDFMN ESPDFDE ESPDFMY EURDFDN EURDFWDX FINDFDT FINDFWKX FRADFDWN FRSDFDD FRSDFMN HOUR HUNDFDWN ITADFDD ITADFMN JDATEMON JULDATE MACDFDN MACDFWDX MMYY NLDATE NLDATEYM NLDATMAP NLDATMWN NLDDFDD NLDDFMN NLSTRQTR NORDFDE NORDFMY POLDFDN POLDFWDX PTGDFDT
DATEAMPM DESDFDD DESDFMN DEUDFDE DEUDFMY DTMONYY ENGDFDE ENGDFMY ESPDFDN ESPDFWDX EURDFDT EURDFWKX FINDFDWN FRADFDD FRADFMN FRSDFDE FRSDFMY HUNDFDD HUNDFMN ITADFDE ITADFMY JDATEQRW JULDAY MACDFDT MACDFWKX MMYYN NLDATEMD NLDATEYQ NLDATMDT NLDATMYM NLDDFDE NLDDFMY NLSTRWK NORDFDN NORDFWDX POLDFDT POLDFWKX PTGDFDWN
DATETIME DESDFDE DESDFMY DEUDFDN DEUDFWDX DTWKDATX ENGDFDN ENGDFWDX ESPDFDT ESPDFWKX EURDFDWN FINDFDD FINDFMN FRADFDE FRADFMY FRSDFDN FRSDFWDX HUNDFDE HUNDFMY ITADFDN ITADFWDX JDATEQTR JULIAN MACDFDWN MMDDYY MONNAME NLDATEMN NLDATEYR NLDATMMD NLDATMYQ NLDDFDN NLDDFWDX NLTIMAP NORDFDT NORDFWKX POLDFDWN PTGDFDD PTGDFMN
DAY DESDFDN DESDFWDX DEUDFDT DEUDFWKX DTYEAR ENGDFDT ENGDFWKX ESPDFDWN EURDFDD EURDFMN FINDFDE FINDFMY FRADFDN FRADFWDX FRSDFDT FRSDFWKX HUNDFDN HUNDFWDX ITADFDT ITADFWKX JDATESEM MACDFDD MACDFMN MMDDYYN MONTH NLDATEW NLDATEYW NLDATMTM NLDATMYR NLDDFDT NLDDFWKX NLTIME NORDFDWN POLDFDD POLDFMN PTGDFDE PTGDFMY
DDMMYY DESDFDT DESDFWKX DEUDFDWN DOWNAME DTYYQC ENGDFDWN ESPDFDD ESPDFMN EURDFDE EURDFMY FINDFDN FINDFWDX FRADFDT FRADFWKX FRSDFDWN HHMM HUNDFDT HUNDFWKX ITADFDWN JDATEMD JDATESMW MACDFDE MACDFMY MMSS MONYY NLDATEWN NLDATM NLDATMW NLDATMYW NLDDFDWN NLSTRMON NORDFDD NORDFMN POLDFDE POLDFMY PTGDFDN PTGDFWDX
477
PTGDFWKX RUSDFDN RUSDFWDX SLODFDT SLODFWKX SVEDFDWN TIME WEEKDAY WORDDATX YYMMN YYQRN
QTR RUSDFDT RUSDFWKX SLODFDWN SVEDFDD SVEDFMN TIMEAMPM WEEKU YEAR YYMON YYWEEKU
QTRR RUSDFDWN SLODFDD SLODFMN SVEDFDE SVEDFMY TOD WEEKV YYMM YYQ YYWEEKV
RUSDFDD RUSDFMN SLODFDE SLODFMY SVEDFDN SVEDFWDX WEEKDATE WEEKW YYMMDD YYQN YYWEEKW
RUSDFDE RUSDFMY SLODFDN SLODFWDX SVEDFDT SVEDFWKX WEEKDATX WORDDATE YYMMDDN YYQR
Note: The JAVA and JAVAIMG devices do not support nested formats. If you create a custom format to use with these devices, do not nest existing formats in your new format. 4
478
Chapter 18
The following picture shows output produced by the sample program. The top of the picture shows the initial graph. The bottom of the picture shows the graph that results from a user clicking on a portion of the initial graph.
479
East NC 13611 1999 East MA 11084 1999 East NC 19660 1999 West CA 12536 1998 West OR 17888 1998 West CA 15623 1998 West OR 17963 1998 East NC 17638 1998 East MA 12811 1998 East NC 12184 1998 East MA 12760 1998 ; goptions reset=all
1 2 2 1 1 2 2 1 1 2 2 device=java;
ods html file=odsout style=gears; title "Company Sales, Mid Year"; proc gchart data=sales; vbar3d region / sumvar=sales group=year subgroup=state; run; quit; ods html close; ods listing;
You can also use the HTML= procedure option to implement local drill-down links in your graphs. See Adding Links with the HTML= and HTML_LEGEND= Options on page 603.
480
Chapter 18
/* Change the next two lines to run this program. */ filename odsout "states.htm" ; /* If your site has already installed the map data sets and */ /* defined the MAPS libref, then you can delete the LIBNAME statement */ /* below and the sample code will work. */ /* If not, contact your on-site SAS support personnel */ /* to determine how to define the MAPS libref. */ *libname maps SAS-MAPS-library; /* Create a data set that contains the US states. */ proc sql; create table work.mydata as select unique state from maps.us; quit; /* Add state abbreviations to the new data set. */ data work.mydata; length Statename $2; set work.mydata; Statename=trim(left(upcase(fipstate(state)))); run; /* Specify the JAVA device. */ goptions reset=all device=java; /* Close the LISTING destination to save */ /* system resources. /* Specify the HTML output file, the script */ /* drill-down mode, and the callback method. */ ods listing close; ods html file=odsout style=default parameters=("DRILLDOWNMODE"="Script" "DRILLFUNC"="MapDrill"); /* Specify a map title and generate the map. */ title1 "State Abbreviations";
*/
481
proc gmap map=maps.us data=work.mydata all; id state; choro statename / nolegend; run; quit; /* Close the HTML destination and */ /* open the listing destination. */ ods html close; ods listing; /* Create the MapDrill script that is specified on */ /* the ODS HTML statements DRILLFUNC parameter. */ /* Write the script to the same file that contains */ /* the HTML output from the GMAP procedure. */ data _null_ ; file odsout mod; /* Modify the file rather than replacing it. */ put " " ; put "<SCRIPT LANGUAGE=JavaScript>" ; put "function MapDrill( appletref )" ; put "{" ; put " " ; put "/* Open an alert box to show the abbreviated state name. */ " ; put "for(i = 2; i < MapDrill.arguments.length; i += 2)" ; put " {" ; put " if (MapDrill.arguments[i] == G_DEPV,f )"; put " alert(MapDrill.arguments[i+1]);" ; put " }" ; put " " ; put "}" ; put "</SCRIPT>"; run ;
482
Chapter 18
/* Change web-output-path in the following statements */ filename urldrill "web-output-path"; filename sales "web-output-path/sales.html"; filename central "web-output-path/central.html"; filename south "web-output-path/south.html"; filename west "web-output-path/west.html"; /* Close the ODS listing destination to conserve resources. */ ods listing close; /* Specify the device. */ goptions reset=all device=java; /* Create the data set REGSALES. */ data regsales; length Region State $ 8; format Sales dollar8.; input Region State Sales; /* Initialize the link variable. */ length rpt $40; /* Assign values to the link variable. */ if Region="Central" then rpt="href=central.html"; else if Region="South" then
483
rpt="href=south.html"; else if Region="West" then rpt="href=west.html"; datalines; West CA 13636 West OR 18988 West WA 14523 Central IL 18038 Central IN 13611 Central OH 11084 Central MI 19660 South FL 14541 South GA 19022 ; /* Open the HTML output file and specify the URL drill-down mode. */ ods html body=sales path=urldrill style=money parameters=("drilldownmode"="url"); /* Create a chart that uses the link variable. */ title "Company Sales"; proc gchart data=regsales; vbar3d region / sumvar=sales patternid=midpoint html=rpt; run; quit; /* Create an HTML file for Central sales. */ ods html body=central path=urldrill style=money; title "Central Sales"; proc print data=regsales noobs; var state sales; where region="Central"; run; /* Create an HTML file for Southern sales */ ods html body=south path=urldrill style=money; title "Southern Sales"; proc print data=regsales noobs; var state sales; where region="South"; run; /* Create an HTML file for Western sales. */ ods html body=west path=urldrill style=money; title1 "Western Sales"; proc print data=regsales noobs; var state sales; where region="West"; run;
484
Chapter 18
quit; /* Close the HTML destination and open the listing destination. */ ods html close; ods listing;
ods html file="your_HTML_file.htm" style=default parameters=("DRILLDOWNMODE"="HTML") parameters=("DRILLPATTERN"="http://www.state.{&statename}.us") parameters=("BACKCOLOR"="FFFFFF"); /* Specify the JAVA device and set up customizations. goptions reset=all device=java; /* Create data for the graph. */ proc sql; create table work.mydata as select unique state from maps.us; quit; run; data work.mydata; length statename $1020; set work.mydata; /* Place the state name in the data set. */ statename=trim(left(lowcase(fipstate(state)))); run; title1 "Click on a state to go to that states home page"; /* Generate the graph. */ */
485
proc gmap map=maps.us data=work.mydata all; id state; choro statename / levels=1 discrete coutline=black nolegend des="US Government Web Sites" name="usgov"; run; quit; /* Close the HTML output file and open the listing /* destination. ods html close; ods listing; */ */
486
487
CHAPTER
19
Attributes and Parameters for Java and ActiveX
Specifying Parameters and Attributes for Java and ActiveX 487 Specifying the Location of Control and Applet Files (CODEBASE= and ARCHIVE= Options) Specifying the Location of the ActiveX Control 489 Specifying the Location of the Java Applets 489 Specifying the CODEBASE= URL 489 Specifying the Location of the Java Plug-In (CODEBASE= Attribute) 490 Parameter Reference for Java and ActiveX 490 Parameter Denitions 493
488
488
Specifying the Location of Control and Applet Files (CODEBASE= and ARCHIVE= Options)
Chapter 19
Note: Using ,n is not the same as using the applet parameter PATTERNSTRIP. The PATTERNSTRIP parameter removes blank spaces from data values before those values are applied to substitution strings. 4 Most of the examples in the following topics specify parameters:
3 Examples of Interactive Java Output on page 477 3 ActiveX Examples on page 463
For information on other ODS statement options, see the SAS Output Delivery System: Users Guide. In HTML output that runs an applet or a control, all values of the ATTRIBUTES= option appear in the opening OBJECT tag. For example, a SAS/GRAPH program can specify the WIDTH attribute as follows:
ods html file="C:\sashtml\piechart.htm" attributes=("width"="720");
In the HTML output le, the WIDTH attribute appears inside the beginning OBJECT tag as shown in the following:
<script language="javascript" type="text/javascript"> <!-document.writeln("<OBJECT"); document.writeln(style=" width: 720px; height: 480px; background-color: #4E5056; border-width: 0px;"); document.writeln("ALIGN=\"baseline\" class=\"Graph\""); . . . //--> </script>
Valid attribute names are those that are enabled for the OBJECT tag in HTML. Valid attributes must also be specied as required by JAVA or ACTIVEX device drivers that run in the operating environment. All of the name/value pairs that are specied in the ODS statement option PARAMETERS= appear in the body of the OBJECT tag. For example, a SAS program can disable the tooltips and set the background color for a graph as follows:
ods html file="test.html" parameters=("tips"="none" "backdropcolor"="CXff0000");
Valid parameter values for the ActiveX control, Graph applet, Map applet, and Contour applet are dened in Parameter Reference for Java and ActiveX on page 490. Parameters for other applets, such as the Metaview applet, are provided in the sections that apply to those applets, as in Metaview Applet Parameters on page 536.
Specifying the Location of Control and Applet Files (CODEBASE= and ARCHIVE= Options)
When you generate Web presentations with the JAVA and ACTIVEX device drivers, the SAS/GRAPH software generates HTML pages that automatically look for the Java archive les or the ActiveX control le in the default installation location. If you install the ActiveX control .exe le or the Java archive .jar les in a location other than the default or if you want to publish Output Delivery System (ODS) output containing the SAS/GRAPH control or the applets in a Web server, then you might need to specify the location of the .exe le or the .jar les when you generate your Web presentation.
Specifying the Location of Control and Applet Files (CODEBASE= and ARCHIVE= Options)
489
You can use the CODEBASE= option to specify the location of the ActiveX control or the Java applets. You can use the ARCHIVE= option to specify the name of the Java archive le. Note: The ActiveX control must be installed locally on each PC where the Web presentation will be viewed. 4
The ARCHIVE= option species the lename of the .jar le(s). You do not need to specify the ARCHIVE= option in the ODS statement unless you have renamed the .jar les. For applets generated with macros, specify the CODEBASE= argument for the macro. For example:
%ds2const(codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm ... );
For the DS2TREE and DS2CONST macros, you do not need to specify the ARCHIVE= argument unless you have renamed the .jar les.
490
Chapter 19
to any Web server without modifying the HTML (assuming the control or the applets are installed on that server). If you are creating HTML that will be viewed from an e-mail or copied to a Web server on which the applets are not installed, then you should use a full URL to point to the applet .jar les at a known location.
On Windows systems, the user is prompted to install the plug-in if it is not already installed. On other systems, the plug-in can be installed from the Sun Microsystems site (http://www.sun.com) or from the SAS Third-Party Software References Web page: http://support.sas.com/resources/thirdpartysupport/index.html.
These parameters are not supported by the JAVAIMG and ACTXIMG device
Table 19.1
Parameter AMBIENT on page 493 BACKDROPCOLOR on page 493 BACKIMAGE on page 493 CLIPTIPS on page 493 COLORNAMELIST on page 493 COLORNAMES on page 493 COLORSCHEME on page 493 DDLEVELn on page 494 DIRECT on page 494 DRAWIMAGE on page 494 DRAWMISSING on page 494 x
4
ActiveX Parameter DRAWSIDES on page 494 DRILLDOWNFUNCTION on page 494 DRILLDOWNMODE on page 494 DRILLPATTERN on page 495 DRILLTARGET on page 495 DUPLICATEVALUES on page 495 FILLPOLYGONEDGES on page 496 FREQNAME on page 496 G_COLOR on page 496 G_COLORV on page 496 G_DEP on page 496 G_DEPTH on page 496 G_DEPTHV on page 496 G_DEPV on page 496 G_GROUP on page 497 G_GROUPV on page 497 G_INDEP on page 497 G_INDEPV on page 497 G_LABEL on page 497 G_LABELV on page 497 G_SUBGR on page 497 G_SUBGRV on page 497 GRADIENTBACKGROUND on page 497 GRADIENTENDCOLOR on page 498 GRADIENTSTARTCOLOR on page 498 HONORASPECT on page 498 IMAGEPOSX on page 498 IMAGEPOSY on page 498 LEGENDFIT on page 498 LEGENDFONT on page 498 LEGENDFONTSIZE on page 498 LEGENDHEIGHTPERCENT on page 498 LEGENDPERCENT on page 498 LEVELOFDETAIL on page 499 x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
491
Graph Applet
Map Applet
Contour Applet x
x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
492
Chapter 19
ActiveX Parameter LEGENDWIDTHPERCENT on page 498 LIGHTING on page 499 LOADFUNC LOCALE on page 499 LODCOUNT on page 499 MENUREMOVE on page 499 MINLEGENDFONTSIZE on page 499 MISSINGCOLOR on page 500 NAME on page 500 NAVIGATERENDERMODE on page 500 NOJSOOBJECT on page 500 OUTLINES on page 500 OVERFLOWCOLOR on page 500 PATTERNSTRIP on page 500 PROJECTION on page 500 PROJECTIONRATIO on page 500 RENDERMODE on page 500 RENDEROPTIMIZE on page 501 RENDERQUALITY on page 501 SHOWBACKDROP on page 501 SIMPLEDEPTHSORT on page 501 SIMPLETHRESHOLD on page 502 STACKED on page 502 STACKPERCENT on page 502 SURFACESIDECOLOR on page 502 TIPBACKCOLOR on page 502 TIPBORDERCOLOR on page 502 TIPS on page 502 TIPMODE on page 502 TIPSTEMSIZE on page 503 TIPTEXTCOLOR on page 503 UNDERFLOWCOLOR on page 503 USERFMTn on page 503 VIEW2D on page 503 x x x x
Graph Applet
Map Applet
Contour Applet x x
x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x
x x x x x x
4
ActiveX Parameter VIEWPOINT on page 503 XBINS on page 503 YBINS on page 503 Graph Applet
Parameter Denitions
493
Map Applet
Contour Applet x x x
Parameter Denitions
AMBIENT=light-level species the intensity of non-directional ambient light in relation to direct light. Valid values range from 0.0 to 1.0. The default value is 0.4. The sum of direct light (see the DIRECT parameter) and ambient light can never exceed 1.0. Direct light is given priority. If you specify a sum of these two values that is greater than one, the ambient value will be reduced so that the sum of the two values equals one. This parameter is valid in the ActiveX control and for the Contour applet. BACKDROPCOLOR=color species the color of all walls in the applet, including the oor. The default value is white. This parameter is valid only in the Contour applet. BACKIMAGE=image-URL species the URL of the image that is applied to the background of the applet image area. By default, no image is used and the background is drawn in a single solid color. The way that the image will be applied to the background is specied with the DRAWIMAGE parameter. For the ActiveX control, the background image must be in GIF, JPEG, or BMP format. For the Graph, Map, or Contour applet, the URL must be absolute and not relative. CLIPTIPS=TRUE | FALSE indicates whether data tips should be clipped. The default value of TRUE does not display data tips when the cursor is outside of the plot area. A value of FALSE displays data tips when the cursor is outside of the plot area. The data tips window hugs the boundary and displays the value of the element that is closest to the cursor along that edge of the plot. This parameter is valid only in the Contour applet. COLORNAMELIST=string species which of two named color lists has priority when searching for named colors. The default is to search the list of HTML 3.2 colors rst, followed by the SAS name list. Specifying SAS as the string reverses this priority, giving SAS names higher priority. This parameter is valid only in the Contour applet. COLORNAMES=name1=value1,name2=value2, ... nameN=valueN species the color names and associated 6-digit hexadecimal RGB values that will be displayed in the Standard Colors list box in the Color Edit dialog box. In the parameter value, no white space is allowed. The color name can be any valid string, and is displayed as specied in the list box. This parameter is valid in the Graph, Map, and Contour applets. COLORSCHEME=scheme-name species the name of the color scheme that is applied to the graph. By default, no color scheme is applied to the graph. This parameter is valid in the ActiveX control and the Graph applet.
494
Parameter Denitions
Chapter 19
DDLEVELnconguration-string congures the drill-down graph that is generated at the drill-down level that is specied by the letter n. The drill-down graph is congured using drill-down tags such as G_INDEPV. For details, see Conguring Drill-Down Links with ACTIVEX on page 462. This parameter is valid in the ActiveX control and in the Graph and Map applets. DIRECT=light-level species the intensity of direct light (from a light source) in relation to the ambient (non-directional) light. Valid values range from 0.0 to 1.0. The default value is 0.6. The sum of direct light and ambient light (see the AMBIENT parameter) cannot exceed 1.0. Direct light is given priority. If you specify a sum of these two values that is greater than one, the level of ambient light will be reduced so that the sum of the two values equals one. This parameter is valid in the ActiveX control and the Contour applet. DRAWIMAGE=background-image-application species how the image specied in the BACKIMAGE parameter is applied to the background of the applet window. This parameter is valid for the Graph, Map, and Contour applets. Here are the valid values: CENTER centers a single instance of the image in the background, without resizing the image. POSITION places a single instance of the image at the location supplied by the IMAGEPOSX and IMAGEPOSY parameters, without resizing. If these parameters are not specied, then the image is centered in the applet window. SCALE lls the entire background of the applet window with a single instance of the specied image, which is resized as necessary. TILE lls the entire background of the applet window using multiple instances of the specied image, without resizing that image. The images are arranged in rows and columns. DRAWMISSING=TRUE | FALSE species whether missing values should be drawn. By default, missing values are not drawn. Missing values are drawn only when this parameter is set to TRUE and the Styles menu option is set to Block, Smooth, or Surface. This parameter is valid only in the Contour applet. DRAWSIDES=TRUE | FALSE species that sides should be drawn when the value of the STACKED parameter is TRUE and when the Styles menu option is set to Surface, Areas, or LinesAndAreas. The default value is FALSE. To override this parameter, you can specify an ODS style denition. This parameter is valid in the Contour applet. DRILLDOWNFUNCTION=function-name DRILLFUNC=function-name species the name of the JavaScript function that is called in Script drill-down mode. This parameter is valid in the ActiveX control and in the Graph and Map applets. DRILLDOWNMODE=HTML | LOCAL | SCRIPT | URL species the drill-down mode. This parameter is valid in the ActiveX control and in the Graph and Map applets. Here are the valid values:
Parameter Denitions
495
HTML uses a substitution string to dynamically generate a URL based on the selected chart elements, and then passes the URL to the browser. Local mode (Graph applet only) constructs and displays a new graph based on the data in the previous level of a drill-down graph. Script mode invokes the JavaScript function specied in the DRILLDOWNFUNCTION parameter, and passes into the function data from the selected graph element. URL mode provides static drill-down, using an image map in the HTML le. The image map is generated using the IMAGEMAP= and HTML= options in SAS/GRAPH. The default drill-down mode is Local for the Graph applet. The Map applet and the ActiveX control do not enable user-selectable drill-down modes. DRILLPATTERN=substitution-string species how to construct the drill-down URL when the drill-down mode is HTML. The substitution string is constructed with drill-down tags, which are expressed in parameters such as G_DEPV, as described in Conguring Drill-Down Links with ACTIVEX on page 462. This parameter is valid in the ActiveX control and in the Graph and Map applets. DRILLTARGET=target species where the drill-down destination is displayed in the browser. The default target is _BLANK, which is an HTML reserved word that displays the drill-down destination in a new browser window. The target can be specied as another reserved target name or as the name of a window or frame in your Web presentation. This parameter is valid in the ActiveX control and in the Graph and Map applets. DUPLICATEVALUES=string determines how the applet will handle data values for grid positions that already have a data value. This parameter is valid in the Contour applet. Specify one of the following values: COUNT stores at each grid location the number of values found for that location. FIRST stores the rst value found. LAST stores the last value found. MAX stores the maximum value found. MEAN stores the mean (average) of all values found. This is the default value. MIN stores the maximum value found. NMISS stores the number of missing values found.
496
Parameter Denitions
Chapter 19
RANGE stores the range of values found. The range is computed as the maximum value minus the minimum value. SUM stores the sum of all values found. FILLPOLYGONEDGES=ALWAYS | NEVER | OS/2 species whether to adjust rendering to x a temporary vendor rendering defect. This parameter is valid only in the Contour applet. When you set the value to ALWAYS, the adjusted rendering is always performed, regardless of the operating system on which the applet is running. Similarly, if you set the value to NEVER, the adjusted rendering is never performed on any operating system. If the value of this parameter equals the os.name Java system property, then the Contour applet sets the default value of this parameter to OS/2, which lets draw Polygon correctly ll in (render) the polygon edges, yet this extra drawing effort slows performance. If you set this parameter to the value of the parameter of the name of the operating system returned in os.name, then the adjusted rendering is performed when the applet runs on that operating system because the applet noties the Java console. FREQNAME=variable-name species a name for a new variable that contains the frequency count when a frequency chart is produced. By default, the name assigned to this variable is Frequency. This parameter might be overridden if you specify an ODS style denition. This parameter is valid in the Graph applet. G_COLOR=variable-name species a new color variable for the current drill-down level. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_COLORV=variable-name species that the current color variable is the same variable that was used to congure the previous drill-down level. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_DEP=variable-name species a new dependent variable for the current drill-down level. This parameter is valid in the ActiveX control and in the Graph and Map applets. Note: The value of the G_DEP tag cannot be set to None because it is always represented in the graph. 4 G_DEPV=variable-name species that the drill-down graph at the specied drill-down level is to use the same dependent variable that was used in the previous drill-down level. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_DEPTH=variable-name species a new depth variable for the current drill-down level. Drill-down graphs that use this variable can be vertical bar charts or scatter plots. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_DEPTHV=variable-name species that the depth variable for the current drill-down level is the same depth variable that was used in the previous drill-down level. Drill-down graphs that use this variable can be vertical bar charts or scatter plots. This parameter is valid in the ActiveX control and in the Graph and Map applets.
Parameter Denitions
497
G_GROUP=variable-name species a new group variable for the current drill-down level. Drill-down graphs that use this variable can be bar charts. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_GROUPV=variable-name species that this group variable should be the same group variable that was used at the previous drill-down level. Drill-down graphs that use this variable can be bar charts. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_INDEP=variable-name species a new independent variable for the current drill-down level. Drill-down graphs that use this variable can be charts and maps. This parameter is valid in the ActiveX control and in the Graph and Map applets. Note: The values of the G_INDEP tags cannot be set to None because it is always represented in the graph. 4 G_INDEPV=variable-name species that an independent variable at the current drill-down level is the same variable that was used at the previous drill-down level. Drill-down graphs that use this variable can be charts and maps. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_LABEL=variable-name species a new label variable for the current drill-down level. Drill-down graphs that use this variable can be maps. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_LABELV=variable-name species that this label variable should be the same label variable that was used at the previous drill-down level. Drill-down graphs that use this variable can be maps. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_SUBGR=variable-name species a new subgroup variable for the current drill-down level. Drill-down graphs that use this variable can be bar charts and scatter plots. This parameter is valid in the ActiveX control and in the Graph and Map applets. G_SUBGRV=variable-name species that a subgroup variable at this drill-down level is the same subgroup variable that was used at the previous drill-down level. Drill-down graphs that use this variable can be bar charts and scatter plots. This parameter is valid in the ActiveX control and in the Graph and Map applets. GRADIENTBACKGROUND=TRUE | FALSE | VERTICAL | HORIZONTAL species that the background of the window is or is not using a color gradient. To override this parameter, you can specify an ODS style denition. This parameter is valid in the ActiveX control and in the Graph, Map, and Contour applets. TRUE and FALSE are valid only for the Graph and Map applets. VERTICAL and HORIZONTAL specify the orientation of the color gradient and are valid only for the Contour applet. This parameter is ignored in the Contour applet if you specify the BACKIMAGE parameter. Use GRADIENTSTARTCOLOR and GRADIENTENDCOLOR to dene the colors used to draw the background.
498
Parameter Denitions
Chapter 19
GRADIENTENDCOLOR=color GRADIENTSTARTCOLOR=color specify the start color and the end color when two colors are blended in a gradient across a wall, background, or graph element. The color can be an HTML 3.2 color name or a 6-digit hexadecimal RGB value. This parameter might be overridden if you specify an ODS style denition. This parameter is valid in the ActiveX control and in the Graph, Map, and Contour applets. HONORASPECT=TRUE | FALSE species whether the aspect of the data being displayed is or is not honored. The default value FALSE scales the shortest axis (x or y). This parameter is valid in the Contour applet. Note that certain annotations, such as pies, might display differently in the applet than in SAS when the value is FALSE. IMAGEPOSX=horizontal-pixels IMAGEPOSY=vertical-pixels specify the location of the upper-left corner of the background image that is named in the BACKIMAGE parameter. These parameters are ignored unless the value of the DRAWIMAGE parameter is POSITION. Positive pixel values are measured from the top-left corner of the applet window. Negative pixel values are measured from the bottom-right corner of the applet window. These parameters are valid in the ActiveX control and in the Graph, Map, and Contour applets. LEGENDFIT=TRUE | FALSE species whether the legend should t within the height of the contour plot area. By default the legend occupies as much of the applet height as is feasible. If TRUE, the height of the legend is restricted to the height of the contour plot within the legend. When you set this parameter, any value specied for LEGENDHEIGHTPERCENT is ignored. This parameter is valid only in the Contour applet. LEGENDFONT=font species which font to use in the legend. Except for the case, the font name must match the name of a Java font available in the browser. This parameter is valid only in the Contour applet. LEGENDFONTSIZE=font-size species the default size of the font to be used in the legend. Only positive values are valid. This parameter is valid only in the Contour applet. LEGENDHEIGHTPERCENT=percentage restricts the height of the legend to a specied percentage of the height of the Contour applet. A vertical margin is always maintained. Valid values are greater than 0 and less than 100 percent, with the default value being 20. This parameter is valid only in the Contour applet. LEGENDPERCENT=percentage species how much of the Contour applet space (width) to use as the legend area. Valid values are 0 to 80 percent. The default value is 20. This parameter is valid only in the Contour applet. LEGENDWIDTHPERCENT=percentage restricts the width of the legend to a specied percentage of the width of the Contour applet. A horizontal margin is always maintained. Valid values are greater than 0 and up to 80 percent, which the default value being 20. This parameter is valid only in the Contour applet.
Parameter Denitions
499
LEVELOFDETAIL=TRUE | FALSE species whether the level-of-detail processing should be used when drawing plots. The default value is TRUE, which allows level-of-detail processing. See also the LODCOUNT parameter. This parameter is valid only in the Contour applet. LIGHTING=HEADLIGHT | OVERHEAD | NORTHEAST | SOUTHEAST species the position of the light source relative to the position of the graph. The default value is HEADLIGHT, which directs two light sources at the graph from the front-center of the screen. This parameter is valid in the Contour applet. LOADFUNC=Java-method species the name of a JavaScript method in the HTML output le that loads values and specications. This parameter is valid in the Graph applet. This parameter should not be specied if you are using ODS. LOCALE=xx_yy<_variant> species the language and country to use when displaying locale-sensitive text. This parameter is valid in the Graph, Map and Contour applets. Here are the values for this parameter, which are java.util locale speciers: xx represents the required two-digit ISO-639 language code, as dened at http://www.loc.gov/standards/iso639--2/. yy represents the required two-digit ISO-3166 country code, as dened at http://www.niso.org/standards/resources/3166.html. <_variant> represents the optional variant code, which depends on the browser and operating environment. If a variant is specied, the initial underscore character is required. LODCOUNT=number-of-cell(s) species the number of cells to use as the level-of-detail threshold. The default value is 2000. When the number of cells involved in drawing a plot in the applet exceeds this value and level-of-detail processing is on, then some cells are ignored when rendering the plot representation. See also the LEVELOFDETAIL parameter. This parameter is valid only in the Contour applet. MENUREMOVE=menu-item(s) disables items in the Graph applet menu and in the Map applet menu. Here is the syntax of menu-item(s): menu1-item<.menu2-item... .menuN-item, menuitem2, ...menu-itemN> In the menu-item(s) value, periods (.) separate menu levels in menu paths. In menu paths, the menu item that is disabled is the last item in the path. Commas separate menu items and menu paths in a series. Menu items are specied using the text that is displayed by the applet, with blank spaces removed. For example, the menu item Graph Properties would be specied as GRAPHPROPERTIES. To apply the MENUREMOVE parameter, rst generate the graph without the MENUREMOVE parameter. Then note the menu paths of the items that you want to disable. This parameter is valid in the Graph applet and the Map applet. MINLEGENDFONTSIZE=font species the minimum font to be used when attempting to t the legend in the available applet area. Only positive integers are valid values. This parameter is valid only in the Contour applet.
500
Parameter Denitions
Chapter 19
MISSINGCOLOR=color species an HTML 3.2 color name or 6-digit hexadecimal RGB value that is to be used to draw missing values. The default color is black. This parameter is valid in the Contour applet. NAME=applet-name species the name for this instance of the applet. Use this parameter only if you have more than one instance of the APPLET tag in your HTML le, and if you have included your own scripts or DHTML that communicates with or acts on a particular instance of the applet. This parameter might be overridden if you specify an ODS style denition. This parameter is valid in the Graph, Map, and Contour applets. NAVIGATERENDERMODE=NONE | POINT | SOLID | WIREFRAME species how to render the graph during pan, rotate, and zoom. The default value is WIREFRAME. This parameter is valid when the RENDERQUALITY parameter is set to CUSTOM. This parameter might be overridden if you specify an ODS style denition. This parameter is valid in the Contour applet. NOJSOOBJECT species that no JavaScript callback options can be created or used within the applet. This parameter might be overridden if you specify an ODS style denition. This parameter is valid in the Graph applet. OUTLINES=TRUE | FALSE species whether outlines should be drawn for the current contour style. Outlines are drawn when this parameter is TRUE and the Styles menu option is set to Area, Block, or Surface. This parameter is valid only in the Contour applet. OVERFLOWCOLOR=color species an HTML 3.2 color name or a 6-digit hexadecimal RGB color for colors that are assigned to data values that exceed the maximum range of colors that have been dened in the style or color list. The default value is CYAN. This parameter is valid in the ActiveX control and in the Contour applet. PATTERNSTRIP=TRUE | FALSE removes preceding and trailing white space from drill-down substitution patterns before the substituted text is added into a dynamically generated drill-down URL. The default value is FALSE. This parameter is valid in the ActiveX control and in the Graph and Map applets. PROJECTION=ORTHOGRAPHIC | PERSPECTIVE species the type of projection that is used to draw contours. The default value is ORTHOGRAPHIC. This parameter is valid in the Contour applet. PROJECTIONRATIO=plot-size-ratio species the ratio of the plot area (applet size minus legend reserve) to the longest dimension of the plot. For example, specifying a value of 2.0 means that the area that contains the contour plot is twice the size of the longest plot dimension. This guarantees that the plot will be surrounded by a space that measures half the length of the longest projection (not including axes). The default value is 1.5. Values must be greater than or equal to 1.0. This parameter is valid in the Contour applet. RENDERMODE=string species how to render the contours when you are not navigating (panning, rotating, or zooming) the Contour applet. This parameter is valid only in the Contour applet. In some cases, changing the representation can provide additional information about the image, such as more clearly displaying cell boundaries.
Parameter Denitions
501
Here are the valid values for the polygon representations that determine how the Contour applet image can be drawn: POINT draws polygons using only single-pixel points at the polygon vertices. SOLID draws lled polygons. This is the default value and the normal representation. WIREFRAME draws polygons using only lines to represent their edges. RENDEROPTIMIZE=ALWAYS| NAVIGATION | NEVER | ONNAVIGATION sets the default for rendering optimization for the Contour applet. This parameter is valid only in the Contour applet. To correctly render images, the applet must rst sort the polygons that comprise the image. Some polygons require additional sorting steps to ensure that they are correctly drawn. In many cases, these additional steps are unnecessary because they only slow applet performance and do not add to image quality. This parameter lets you specify if and when the applet should attempt to optimize or reduce the number of sorting operations to be performed. The RENDEROPTIMIZE parameter is ignored unless you set the RENDERQUALITY parameter to CUSTOM. The default value depends on the value of the RENDERQUALITY parameter. When the RENDERQUALITY parameter is set to BESTQUALITY, the default value for the RENDEROPTIMIZE parameter is NEVER. When the RENDERQUALITY parameter is set to FASTERNAVIGATION, the default value for the RENDEROPTIMIZE parameter is ONNAVIGATION. When the RENDERQUALITY parameter is set to BESTPERFORMANCE, the default value for the RENDEROPTIMIZE parameter is ALWAYS. RENDERQUALITY=value species how two available rendering algorithms, one slower and one faster, are applied to the graph. This parameter might be overridden if you specify an ODS style denition. This parameter is valid for the Map and Contour applets. Here are the valid values: BESTPERFORMANCE | PERFORMANCE always uses the faster, less complex rendering algorithm. BESTQUALITY | QUALITY always uses the slower, more complex rendering algorithm. FASTERNAVIGATION | NAVIGATION uses the faster, less complex rendering algorithm during pan, rotate, and zoom, and uses the more complex algorithm otherwise. This is the default value. CUSTOM (Contour applet only) lets the user select individual elements that control speed and quality directly, rather than as a group when rendering an image. SHOWBACKDROP=TRUE | FALSE species whether all walls (including the oor) should be displayed. This parameter overrides any ODS settings and is valid only in the Contour applet. SIMPLEDEPTHSORT=TRUE | FALSE the default value TRUE indicates that the simpler polygon sorting algorithm is used when rendering the plot. This parameter is valid in the Contour applet.
502
Parameter Denitions
Chapter 19
SIMPLETHRESHOLD=number-of-elements | NEVER species an integer for the threshold that is used to determine whether the graph should be rendered using simple geometry. For bar charts, simple geometry means that graphical elements are represented as lines. For plots, simple geometry means that graphical elements are represented as plus signs (+). If the graph contains a number of elements that is greater than the SIMPLETHRESHOLD value, simple geometry is used and the Shape menu is made unavailable. The default value is 500. You can also specify the value NEVER. In that case, simple geometry is never used and the Shape menu is always available. Note that if you select and display a subset of the graph, and if the number of elements in the resulting graph drops below the value of the SIMPLETHRESHOLD parameter, regular markers are drawn and the Shape menu is made available. This parameter is valid in the Graph applet. STACKED=TRUE | FALSE species whether the contours should be displayed in stacked form, where height is added to the contour plot based on the contour level. This parameter takes effect only when the Style menu option is set to Areas or LinesAndAreas. The default value of this parameter is FALSE. See also the DRAWSIDES parameter. This parameter is valid in the Contour applet. STACKPERCENT=height-percentage species the maximum stacking height as a percentage of the longest axis. The default value is 30. This parameter is valid in the Contour applet. SURFACESIDECOLOR=color species the color of the sides of a contour plot when that plot uses multiple colors. The value of the parameter is ignored when drawing a surface plot in a single color. The default color is the color of the minimum data value. The value must be an HTML 3.2 color name or a 6-digit hexadecimal RGB value. This parameter is valid in the Contour applet. TIPBACKCOLOR=color species an HTML 3.2 color name or a 6-digit hexadecimal RGB value for the background of the data tips. The default value is YELLOW. This parameter is valid in the Contour applet. TIPBORDERCOLOR=color species an HTML 3.2 color name or a 6-digit hexadecimal RGB value for the border of the data tips. The default value is BLACK. This parameter is valid in the Contour applet. TIPS=NONE | STATIONARY | TRUE | FALSE species whether to display data tips. NONE and STATIONARY are valid values only for the Graph and Map applets, and TRUE and FALSE are valid only for the Contour applet. Specifying the default value of STATIONARY or TRUE enables displays data tips, and NONE and FALSE disables this. This parameter is valid in the ActiveX control and in the Graph, Map, and Contour applets. TIPMODE=STANDARD | HTML | TABULAR | ALL species which of two types of data tips are to be displayed. One set of data tips is specied with the TIPS parameter. The other set of data tips is specied with the HTML= statement option. Specify TIPMODE=HTML to display only the data tips that are indicated by the HTML= statement option. Specify TIPMODE=TABULAR to display only the data tips that are indicated by the value of the TIPS parameter. Specify TIPMODE=STANDARD to display both sets of data tips. The default value is STANDARD.
Parameter Denitions
503
To display data tips with the HTML= statement option. You can specify the HTML= option. The syntax of that option is HTML=ALT=text | variable-name. For further information on data tips, see Data Tips for Web Presentations on page 600. TIPSTEMSIZE=line-length species the length in pixels of the line that connects the data tips to the graph element that makes use of that data. The default value is 20. This parameter is valid in the Contour applet. TIPTEXTCOLOR=color species an HTML 3.2 color name or a 6-digit hexadecimal RGB value for the text in the data tips. The default value is BLACK. This parameter is valid in the Contour applet. UNDERFLOWCOLOR=color species an HTML 3.2 color name or a 6-digit hexadecimal RGB value for the color that is assigned to data values that are smaller than the minimum range of colors that have been dened in the style or color list. The default value is WHITE. This parameter is valid in the Contour applet. USERFMTn=string(s) denes the user format specication. The syntax is the same as that of the VALUE and PICTURE statements for PROC FORMAT. You can specify multiple USERFMTn parameters by replacing n with the appropriate number from 1 to n, where n is the number of format parameters to be dened. For example, to dene a simple YESNO format, specify the parameter <PARAM NAME=USERFMT1 VALUE=VALUE YESNO 1=Yes 2=No >. This parameter is valid only in the Contour applet. VIEW2D=TRUE | FALSE indicates whether the view point should be locked to two dimensions. The default value is TRUE for the Contour applet and FALSE for the Graph applet and ActiveX control. This parameter might be overridden if you specify an ODS style denition. XBINS=bin-number-orvalues YBINS=bin-number-or-values congures the bins uses to generate a contour plot. Specifying a single integer uses that number of bins. The single integer must be greater than 2. Specifying multiple values uses multiple bins with those values. Multiple values are real numbers that are separated by semicolons, as follows:
ods html file=filename.html parameters=("XBINS"="-1;0;2.5;3.5;4" "YBINS"="1;2;3;4;5;6");
These parameters are enabled in the Contour applet. VIEWPOINT=2D| SE | SOUTHEAST denes the initial viewpoint for the Contour applet. The value SE or SOUTHEAST set the initial viewpoint to Southeast, a three-dimensional viewpoint. The value 2D sets the value to be two-dimensional. The default value is 2D for PROC GCONTOUR output and SOUTHEAST for PROC G3D. Setting this parameter unlocks the 2D view. (See VIEW2D.) This parameter is valid only in the Contour applet.
504
505
CHAPTER
20
Generating Static Graphics
What is a Static Graphic? 505 Creating a Static Graphic 506 ACTXIMG and JAVAIMG Devices Compared to GIF, JPEG, SVG, and PNG Devices 508 GIF, JPEG, SVG, and PNG Devices 508 ACTXIMG and JAVAIMG Devices 508 Output From Different Devices and the GSTYLE/NOGSTYLE System Options 508 Developing Web Presentations with the GIF, JPEG, SVG, and PNG Devices 510 About the GIF, JPEG, SVG, and PNG Devices 510 When to Use the GIF, JPEG, SVG, and PNG Devices 511 Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device 511 Developing Web Presentations with the JAVAIMG and ACTXIMG Devices 512 About the JAVAIMG and the ACTXIMG Devices 512 When to Use the JAVAIMG or ACTXIMG Device 513 Using JAVAIMG in the z/OS Environment 513 Generating an HTML Output File Using the JAVAIMG or the ACTXIMG Device 513 Adding Drill-Down Links to Web Presentations Generated with a Static-Graphic Device 514 Sample Programs for Static Images 514 Using the ACTXIMG Device 514 Generating PNG Output 516 GIF Output with Drill-Down Links 517
506
Chapter 20
create GIF images with different default dimensions, the following GIF device variants are provided: GIF160 GIF260 GIF373 GIF570 GIF733 160 x 120 260 x 195 373 x 280 570 x 430 733 x 550
However, we recommend that you use the XPIXELS= and YPIXELS= graphics options with the GIF device to change the default size of your GIF graph to whatever size you need. See Using the XPIXELS= and YPIXELS= Graphics Options to Set the Size of Your Graph on page 95. You can also use the following additional variants: PNG300 PNGT SVGZ SVGT SVGVIEW Zdevice produces PNG images with 300 DPI resolution provides support for transparency in PNG images produces compressed SVG images provides support for transparency in SVG images provides navigational control buttons for multipage SVG images devices provided for compatibility with previous releases of the SAS/GRAPH software
See Chapter 6, Using Graphics Devices, on page 67 for more information on these devices. When you send your graph output to the ODS HTML destination, you can add data tips and drill-down links to your static graphic. See Chapter 27, Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality, on page 597.
output les. To generate only one output le, specify the le reference, lename, and storage location as follows:
filename mygif1 "C:\mysas\images\barchart.gif"; /* Path to output file */
The le reference can be up to eight characters in length. To generate multiple images in a single program, specify a le reference for the path only, as follows:
filename imageout "C:\mysas\images"; /* Path to output directory */
When you generate multiple image output les, the SAS/GRAPH software automatically generates the names of the graphics output les, as described in
507
Summary of How Output Filenames and GRSEG Names are Handled on page 102.
2 Add a GOPTIONS statement to specify the output format using the DEVICE=
graphics option, and the le reference using the GSFNAME= graphics option as follows:
goptions reset=all device=gif gsfname=mygif1;
The value of the GSFNAME= graphics option is the name of your previously dened le reference, whether that le reference references a lename or a directory. If you do not specify a value for the GSFNAME= graphics option, the SAS/GRAPH software uses default names for your graphics output les as described in Summary of How Output Filenames and GRSEG Names are Handled on page 102. 3 Run the procedure that generates the graph. For example:
proc gchart data=sashelp.class; hbar3d sex / sumvar=height type=mean; run; quit;
The output is stored in the format specied by the DEVICE= graphics option, and in the output location specied by the GSFNAME= graphics option. For example, C:\mysas\images\barchart.gif. To create an HTML le that embeds the image, use the ODS HTML destination with the following options: BODY= PATH= GPATH= The lename of the output HTML le (FILE= is a synonym for BODY=). The location (URL or le reference) of the HTML le and static graphic le. The location of the graphics output le that is created. Note: You must specify a value for the GPATH= option only if you specify the FILE= option as a complete path and lename, and you do not specify the PATH= option. If you specify FILE= as just a lename (and extension), and you specify PATH=, then both the HTML le and the graphics output le are written to the same location (as specied by PATH=.) 4 STYLE= The style to be applied. If you do not specify a style, the default style is applied.
For samples, see Sample Programs for Static Images on page 514. For complete information on these options, see SAS Output Delivery System: Users Guide.
508
ACTXIMG and JAVAIMG Devices Compared to GIF, JPEG, SVG, and PNG Devices
Chapter 20
ACTXIMG and JAVAIMG Devices Compared to GIF, JPEG, SVG, and PNG Devices
509
Display 20.1
A Bar Chart Using the GIF Device with the Statistical Style and GSTYLE System Option
The output is similar for the other devices. Here is an example that applies the Statistical style to a GIF image with the NOGSTYLE system option on:
options nogstyle; ods listing close; ods html style=statistical; goptions reset=all device=gif; proc gchart data=sashelp.cars; vbar make; where MPG_Highway >= 37; run; quit; ods html close; ods listing;
510
Developing Web Presentations with the GIF, JPEG, SVG, and PNG Devices
Chapter 20
Display 20.2
A Bar Chart Using the GIF Device with the Statistical Style and the NOGSTYLE System Option
Notice that STYLE=STATISTICAL is overridden by the NOGSTYLE system option and that no style is applied to the graph. The NOGSTYLE system option is valid only for the GIF, JPEG, SVG, and PNG devices. For the ACTXIMG and JAVAIMG devices, the NOGSTYLE system option has no effect. In this example, if the DEVICE=JAVAIMG or DEVICE=ACTXIMG graphics option is used, the Statistical style is applied even though the NOGSTYLE system option is on.
Developing Web Presentations with the GIF, JPEG, SVG, and PNG Devices
You can use the GIF, JPEG, SVG, and PNG devices to create Web presentations that consist of static graphics. You can also add data tips and drill-down links to your graphs.
Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device
511
3 the chart elements (such as the bars, plot markers, or GMAP areas) using the
HTML= option
3 the legend using the HTML_LEGEND= option 3 the titles and footnotes using the LINK= option in the title or footnote statement 3 the annotated text or graphics or both that use the HTML= variable in the
annotate data set For details, see Adding Drill-Down Links to Web Presentations Generated with a Static-Graphic Device on page 514.
Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device
Follow these steps to generate a complete Web presentation that consists of an HTML output le and one or more images:
1 To conserve resources, close the ODS LISTING destination (the Output window,
2 Enter your DATA step, if necessary. 3 Specify your ODS HTML statement, with the following options:
ods html path="C:/Public/graph" (url=none)/* HTML output directory */ body="webgif1.htm" /* HTML filename */ gpath="C:/Public/graph/images"; /* graphics output file location */
Specifying URL=NONE tells ODS to reference the graphics output le simply by name without prexing the full path (assuming that the graphics output le is in the same directory as the HTML le). Note: With the GIF, JPEG, SVG, or PNG device, footnotes and titles are stored in the graphics output le by default. To move footnotes and titles out of the graphics output le and into the HTML le, specify the ODS HTML options NOGTITLE or NOGFOOTNOTE, or both. See Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192. 4
4 Specify your device:
goptions reset=all device=png;
512
Chapter 20
You can use BY statements to create multiple graphs. 6 Close the HTML output le and reopen the ODS listing destination:
ods html close; ods listing;
Reopening the listing destination establishes standard operating conditions for later programs that you run in the same SAS session. 7 Open the HTML output le in your Web browser. For example, open le C:\Public\graph\webgif1.htm. Note: Using this technique, however, you cannot create drill-down links or data tips for your graphs. 4 For an example, see Generating PNG Output on page 516.
Generating an HTML Output File Using the JAVAIMG or the ACTXIMG Device
513
whether the GTITLE and GFOOTNOTE options are set. See Controlling Titles and Footnotes with Java and ActiveX Devices in HTML Output on page 192. 4
Generating an HTML Output File Using the JAVAIMG or the ACTXIMG Device
The procedure for generating an HTML output le for viewing JAVAIMG or ACTXIMG device output is similar to the procedure for generating an HTML output le for the GIF, PNG, SVG, or JPEG devices. See Generating an HTML Output File Using the GIF, PNG, SVG, or JPEG Device on page 511. For an example, see Using the ACTXIMG Device on page 514.
514
Chapter 20
3 titles and footnotes using the LINK= option in the TITLE or FOOTNOTE
statement.
515
Display 20.3
The following is the complete SAS code for this example. In this example, the output les are sent to the default location. If you want to send the output les to a different location, add the BODY= option to the ODS HTML statement to specify the new location of the output les. You can specify the complete path and lename with the BODY= option (or the FILE= option, which is the same), or you can specify the path separately using the PATH= option, and just the lename with the FILE= or BODY= option. If you want to send the PNG les to a separate location, add the GPATH= option to the ODS HTML statement to specify the new location for the PNG les. See the section ODS HTML Statement in the SAS Output Delivery System: Users Guide.
/* Create data set from sashelp.prdsale */ data prdsummary; set sashelp.prdsale; where year=1993 and (country = "GERMANY" or country = "CANADA") and region="EAST" and division="CONSUMER" and (product="SOFA" or product="TABLE" or product="BED"); run; /* Sort the data set by quarter */ proc sort data=work.prdsummary; by quarter; run; /* Since the LISTING destination is not used, close it to save system resources */ ods listing close;
516
Chapter 20
/* Send output to an HTML file */ ods html style=seaside; /* Specify device as actximg */ goptions reset=all device=actximg border; title1 "1993 Sales"; /* Chart total 1993 sales for each country by quarter */ proc gchart data=work.prdsummary; hbar country / sumvar=actual subgroup=product sum; by quarter; run; quit; /* Close HTML file */ ods html close; /* Reopen the LISTING destination */ ods listing;
517
The following is the complete SAS code for this example. In this example, the output les are sent to the default location. If you want to send the output les to a different location, add the BODY= option to the ODS HTML statement to specify the new location of the output les. You can specify the complete path and lename with the BODY= option (or the FILE= option, which is the same), or you can specify the path separately using the PATH= option, and just the lename with the FILE= or BODY= option. See the section ODS HTML Statement in the SAS Output Delivery System: Users Guide. If you want to send the PNG les to a separate location, add the GPATH= option to the ODS HTML statement to specify the new location for the PNG les.
/* Create data set from sashelp.prdsale */ data prdsummary; set sashelp.prdsale; where year=1993 and (country = "GERMANY" or country = "CANADA") and region="EAST" and division="CONSUMER" and (product="SOFA" or product="TABLE" or product="BED"); run; /* Sort the data set by quarter */ proc sort data=work.prdsummary; by quarter; run; ods listing close; ods html style=seaside; goptions reset=all border; title1 "1993 Sales"; proc gchart data=prdsummary(where=(year=1993)); vbar3d country / sumvar=actual subgroup=product sum; by quarter; run; quit; ods html close; ods listing;
Notice that a device is not specied in the GOPTIONS statement in this example. ODS uses the PNG device as the default device for the HTML destination.
518
Chapter 20
Display 20.5
If you click one of the three blocks in the chart, you see a table of the data for that block. For example, if you click the Central block, the following table is displayed.
Here is the example code, which is available in the SAS Sample Library under the name GWBDRILL:
519
/* Close the LISTING destination. */ ods listing close; /* Set graphic options. */ goptions reset=all border device=gif; /* Create the data set REGSALES. */ data regsales; length Region State $ 8; format Sales dollar8.; input Region State Sales; /* Initialize the link variable. */ length rpt $40; /* Assign values to the link variable. */ if Region="Central" then rpt="href=central.html"; else if Region="South" then rpt="href=south.html"; else if Region="West" then rpt="href=west.html"; datalines; West CA 13636 West OR 18988 West WA 14523 Central IL 18038 Central IN 13611 Central OH 11084 Central MI 19660 South FL 14541 South GA 19022 ; /* Open the HTML destination for ODS output. Specify the */ /* filename in BODY=. */ ods html body="company.html" style=statistical; /* Create a chart that uses the link variable. title1 "Company Sales"; proc gchart data=regsales; vbar3d region / sumvar=sales patternid=midpoint html=rpt; run; quit; /* Create the Central sales page */ ods html body="central.html"; title1 "Central Sales"; proc print data=regsales noobs; */
520
Chapter 20
var state sales; where region="Central"; run; quit; /* Create the Southern sales page */ title1 "Southern Sales"; ods html body="south.html"; proc print data=regsales noobs; var state sales; where region="South"; run; quit; /* Create the Western sales page */ title1 "Western Sales"; ods html body="west.html"; proc print data=regsales noobs; var state sales; where region="West"; run; quit; /* Close the HTML output file and /* open the listing destination. ods html close; ods listing; */ */
521
CHAPTER
21
Generating Web Animation with GIFANIM
Developing Web Presentations with the GIFANIM Device 521 When to Use the GIFANIM Device 521 Creating an Animated Sequence 522 Preparing the Header 522 Preparing the Body 522 Preparing the Trailer 522 GOPTIONS for Controlling GIFANIM Presentations 523 Sample Programs: GIFANIM 524 Creating an Animated GIF with BY-Group Processing 524 Results Shown in a Browser 524 SAS Code 524 About the HTML File 526 Creating an Animated GIF with RUN-Group Processing 526 Results Shown in a Browser 526 SAS Code 527 Creating an Animated GIF with the GREPLAY Procedure 529 Results Shown in a Browser 529 SAS Code 529
522
Chapter 21
applet, as described in Developing Web Presentations for the Metaview Applet on page 533.
3 If you do not use BY-group processing in the last procedure, set GOPTIONS
GEPILOG=3BX before the last SAS/GRAPH procedure.
3 If you use BY-group processing in the last procedure, do not assign a value to the
GEPILOG= option. If you assign a value to GEPILOG=, because the GEPILOG= value is written after each graph in a BY-group, the GIF decoder interprets the rst 3Bx as the end of the animation. Instead, use a DATA step to add the trailer to the data stream as follows:
data _null_; file out recfm=n mod; put "3B"x; run;
523
In the preceding example, OUT is the le reference of the GIF output le. After the animation is complete, issue a GOPTIONS RESET=ALL statement to prepare for subsequent SAS jobs.
524
Chapter 21
3 Creating an Animated GIF with BY-Group Processing on page 524 3 Creating an Animated GIF with RUN-Group Processing on page 526 3 Creating an Animated GIF with the GREPLAY Procedure on page 529
See also example GWBANIMA in the Sample Library.
SAS Code
The following is the complete SAS code for this example. Notice the following features:
3 The GSFNAME= graphics option species the le reference that denes the name
of the GIF le that is to be created. In this example, the value of GSFNAME= is specied as gifout, which is dened as the le gifanim1.gif in a FILENAME statement.
525
3 FILENAME statements specify the lename of the GIF le and the HTML le to
be created by the PUT statements.
/* Specify output files for the images and the HTML code */ filename gifout "gifanim1.gif"; /* Image output */ filename htmlout "gifanim1.htm"; /* HTML output */ /* Set the graph style */ ods listing style=harvest; /* Delete the previously created graphs before creating new ones */ proc greplay igout=work.gseg nofs; delete _all_; run; quit; /* Use gifout to specify the name of the GIF file */ goptions reset=all device=gifanim gsfname=gifout gsfmode=replace /* not necessary when using "BY" */ delay=150 /* set delay between images */ border; /* Create our data set by extracting information on Canada */ /* and Germany from sashelp.prdsale. */ data work.qsales; set sashelp.prdsale(where=(country="CANADA" or country="GERMANY") keep=Actual Country Product Quarter Year); run; /* Sort our data by quarter */ proc sort data=work.qsales; by quarter; run; /* Generate the first set of graphs */ title1 "1993 Sales"; proc gchart data=work.qsales(where=(year=1993)); vbar3d country / sumvar=actual subgroup=product sum shape=hexagon; where product in ("BED" "TABLE" "CHAIR"); by quarter; run; quit; /* Set the GSFMODE= graphics option to append the subsequent graphs to the file */ goptions gsfmode=append; /* Generate the second set of graphs */ title1 "1994 Sales"; proc gchart data=work.qsales(where=(year=1994)); vbar3d country / sumvar=actual subgroup=product sum shape=hexagon; where product in ("BED" "TABLE" "CHAIR"); by quarter;
526
Chapter 21
run; quit; /* Write the trailer to the GIF file. Since we */ /* used BY-group processing, use a DATA step */ data _null_; file gifout recfm=n mod; put "3B"x; run; /* Create the HTML file to view the animated GIF */ data _null_ ; file htmlout ; put "<HTML>"; put "<HEAD>"; put "<TITLE> GIFANIM </TITLE>"; put "</HEAD>"; put "<BODY>"; put "<IMG src=gifanim1.gif>"; put "</BODY>"; put "</HTML>"; run; quit;
527
The animation iterates through the sales data for Canada, Germany, and the U.S.A. The animation waits two seconds between each image and iterates through the animation four times. The animation stops after the fourth iteration and displays the rst graph (desks).
SAS Code
The images are generated using the GCHART procedure with RUN-group processing and WHERE clauses to select individual products. Transparency is enabled for each image, so that the Web browser background shows through the unoccupied areas of each image. PUT statements are then used to generate an HTML le that enables you to view the animation with a Web browser. The <BODY> tag in the HTML code species a Web browser background color of #F2F2CF, which shows through the image. You can change the delay between each image by changing the DELAY= graphics option. You can change the number of iterations by changing or removing the ITERATIONS= graphics option. You can also remove the TRANSPARENCY graphics option or change it to NOTRANSPARENCY to see the affect that transparency has on the image. The SAS code for this example follows.
/* Create file references for the output */ filename gifout "gifanim2.gif"; /* Image output */ filename htmout "gifanim2.html"; /* HTML output */ /* Set the graph style */ ods listing style=highcontrast; /* Delete the previously created graphs before creating new ones */ proc greplay igout=Work.Gseg nofs; delete _all_; run; quit; /* Set graphics options */
528
Chapter 21
goptions reset=all device=gifanim gsfmode=replace gsfname=gifout noborder transparency /* Let the browser background show through */ disposal=background /* Restore the background between images */ delay=200 /* Wait 2 seconds between each image (200 x 0.01s) */ iterations=4 /* Run the animation four times */ gsfname=gifout gsfmode=replace; /* Generate the graphs using RUN-group processing */ title1 "1993 Sales"; proc gchart data=sashelp.prdsale(where=(year=1993)); title2 "Desks"; vbar3d country / sumvar=actual; where product="DESK"; run; /* Set the GSFMODE= graphics option to append the remaining graphs */ goptions gsfmode=append; title2 "Tables"; vbar3d country / sumvar=actual; where product="TABLE"; run; title2 "Chairs"; vbar3d country / sumvar=actual; where product="CHAIR"; run; title2 "Sofas"; vbar3d country / sumvar=actual; where product="SOFA"; run; /* For the last graph, set the GEPILOG= graphics option to */ /* append the trailer */ GOPTIONS GEPILOG="3B"X; /* Generate the last graph */ title2 "Beds"; vbar3d country / sumvar=actual; where product="BED"; run; quit; /* Create the HTML file to view the animated GIF */ data _null_ ; file htmout ; put "<HTML>"; put "<HEAD>"; put "<TITLE> GIFANIM </TITLE>"; put "</HEAD>"; put "<BODY STYLE=background:#F2F2CF>"; put "<IMG STYLE=border:none src=gifanim2.gif>"; put "</BODY>"; put "</HTML>"; run;
4
quit;
529
The animation iterates through the 1993 sales data for Canada, Germany, and the U.S.A. The animation waits two seconds between each image and iterates through the animation continuously.
SAS Code
The SAS code for this example follows.
/* Create file references for the output */ filename gifout "gifanim3.gif"; /* Image output */ filename htmout "gifanim3.html"; /* HTML output */ /* Create catalog Mygraphs */ libname Mygraphs "C:\"; /* Set the graph style */ ods listing style=harvest;
530
Chapter 21
/* Delete the previously created graphs before creating new ones */ proc greplay igout=Mygraphs.Sales nofs; delete _all_; run; quit; /* Create our data set by sorting sashelp.prdsale by product */ proc sort data=sashelp.prdsale out=Work.sales; by product; run; quit; /* Set graphics options */ goptions reset=all device=gif noborder nodisplay; /* Generate the graphs */ title1 "1993 Sales"; proc gchart data=work.sales(where=(year=1993)) gout=Mygraphs.Sales; pie3d country / sumvar=actual type=mean; by product; run; quit; /* Specify the replay options */ goptions reset=all device=gifanim noborder disposal=background /* Restore the background between images */ delay=200 /* Wait 2 seconds between each image (200 x 0.01s) */ gsfname=gifout gsfmode=replace; /* The graphs are to be replayed in the following product order: */ /* desks, tables, chairs, sofas, and beds */ /* This means that we have to replay the GRSEGs in the following order: */ /* GCHART2, GCHART4, GCHART1, GCHART3, and GCHART */ /* Replay the first graph */ proc greplay igout=Mygraphs.Sales nofs; replay GCHART2; run; quit; /* Set the GSFMODE= graphics option to append the remaining graphs */ goptions gsfmode=append; /* Replay the remaining graphs */ proc greplay igout=Mygraphs.Sales nofs; replay GCHART4 GCHART1 GCHART3 GCHART; run; quit; /* Write the trailer to the animated GIF file. */ /* Since we used BY-group processing, use a DATA step */ data _null_; file gifout recfm=n mod; put "3B"x; run;
531
/* Create the HTML file to view the animated GIF */ data _null_ ; file htmout ; put "<HTML>"; put "<HEAD>"; put "<TITLE> GIFANIM </TITLE>"; put "</HEAD>"; put "<BODY>"; put "<IMG STYLE=border:none src=gifanim3.gif>"; put "</BODY>"; put "</HTML>"; run; quit;
532
533
CHAPTER
22
Generating Interactive Metagraphics Output
Developing Web Presentations for the Metaview Applet 533 Advantages of Using the JAVAMETA Device 534 Using ODS With the JAVAMETA Device 534 Enhancing Web Presentations for the Metaview Applet 535 Specifying Non-English Resource Files and Fonts 535 Metaview Applet Parameters 536 Specifying Applet Parameters Using the ODS PARAMETERS= Statement Example: Generating Metacode Output With the JAVAMETA Driver 538
538
You can use a GOPTIONS statement with a DEVICE=JAVAMETA to create metacode output from one or more SAS/GRAPH procedures. When the graph is viewed, the browser passes the metacodes as a parameter to the Metaview applet. The Metaview applet renders the output dened by the metacodes, and displays the interactive graph to the user. Most SAS/GRAPH procedures that generate GRSEG catalog entries, as well as some other SAS procedures such as PROC GANTT, can be used with the JAVAMETA device to generate metagraphics output. For a list of these procedures, see Metaview Applet on page 446. Interactive features of the Metaview Applet include pan and a play mode for animations. You can add data tips, specify resource les for language translation, specify background colors and text fonts, and drill down to HTML les, metagraphics les, and sets of metacodes. You can also provide a list of selectable drill-down URLs in the pop-up menu. Whereas regular HTML drill-down only allows a single drill-down, the metaview applet allows a selection list of multiple drill-downs per each chart element. For information on these enhancements, see Enhancing Web Presentations for the Metaview Applet on page 535. To generate a Metaview applet presentations, use ODS with the JAVAMETA device driver.
534
Chapter 22
To see examples of programs that generate a Web presentation for the Metaview Applet, see Example: Generating Metacode Output With the JAVAMETA Driver on page 538.
3 Open the HTML destination. You can also specify an HTML lename with the
BODY= option. If you do not specify an HTML output lename, the default lename is
sashtml.htm
. The APPLETLOC= system option species the default location of the applet JAR les. If necessary, you can specify another location with the CODEBASE= option in the SAS program.
ods html body="filename.htm" <codebase="location-of-jar-files">;
You can enhance your Web presentation by specifying other applet parameters, as described in Metaview Applet Parameters on page 536. 4 Include the SAS/GRAPH procedure code.
proc gchart data=sashelp.class; vbar height / group=age; run; quit;
5 Close the HTML destination. You must close the HTML destination to generate
535
Submit the program to generate the HTML output le, which includes the metacodes generated by the JAVAMETA device. When you view the HTML le in a Web browser, the Metaview applet renders the graph dened by the metacodes.
536
Chapter 22
3 Name your resources le MVAResources.properties. 4 Store your resources le in the same directory as either the HTML output le or
value of the parameter RESOURCESFONTNAME. To display this font, your Web audience must have this font installed.
7 Run your program and test your Web output.
For information on specifying applet parameters, see Specifying Applet Parameters Using the ODS PARAMETERS= Statement on page 538. For reference information on the Metaview Applet parameters, see Metaview Applet Parameters on page 536.
537
LOGRESOURCES=TRUE | FALSE specifying a value of TRUE logs tag/value pairs in the key denition le. The default value is FALSE. The tag value pairs are copied out of the key denition le and modied to create a resource le. The resource le is named MVAResources.properties, and it enables the Metaview Applet text to be translated to another language. See also the RESOURCESFONTNAME parameter. METACODES=codes-or-le-specication identies a text le that contains metagraphics codes, or it provides inline metagraphics codes. The le specication is an absolute or relative URL address. METACODES1-METACODESn=codes-or-le-specication identies additional metacode specications when you need to identify more than one le or more than one set of inline metagraphics codes. METACODESLABEL=menu-label METACODES1LABEL-METACODESnLABEL=menu-label names the text labels that are used to identify the graphs specied in the METACODES and METACODESn parameters. If specied, there should be as many METACODESLABEL parameters as there are METACODESn parameters. Always specify METACODESLABEL parameters in sequential order (METACODESLABEL, METACODES1LABEL, METACODES2LABEL, and so on). The applet displays the labels in an embedded graph-selection control. RESOURCESFONTNAME=font-name species the name of the font family that is used to display the resource values in a user-dened resource le. This allows the Metaview Applet, which is Java 1.02 compliant, to emulate the language translation capabilities of Java 1.2. The applet rst tries to use the specied font-name, then it tries to use the SansSerif font, then it tries to use the Serif font, then it uses the rst font that is returned by the Java.Awt.Toolkit. The rst font that is found is the font that is used. See also the LOGRESOURCES parameter. ZOOMCONTROLENABLED=TRUE | FALSE displays the embedded zoom control under the graph. The default is TRUE. Specifying a value of FALSE suppresses the display of the zoom control. Unless you choose to suppress it, the Metaview applet always displays a zoom control which allows a user to zoom in on and out of the image. To suppress the zoom control, specify ZOOMCONTROLENABLED=FALSE in the ODS statement, as follows: ods html body=ncpop.htm parameters=(ATATIPSTYLE=STICK ZOOMCONTROLENABLED=FALSE); ZOOMCONTROLMIN=minimum-percentage species a new lower limit for the zoom feature. The default value is 25 percent of initial size. Valid values range from 1 to 99. ZOOMCONTROLMAX=maximum-percentage species a new upper limit for the zoom feature. The default value is 500 percent of initial size. Valid values range from 100 to 25000.
538
Chapter 22
You can specify any number of parameters in a single PARAMETERS= statement. The parameters can be specied in any order. Blank spaces separate multiple parameter specications. You can also use multiple PARAMETERS= statements within a given ODS statement. The quotation marks and parentheses are required. Additional quotation marks are required in the specication of certain parameter values.
539
The following is the complete SAS code to generate a Web presentation. The HTML le is created using ODS HTML.The statement GOPTIONS DEVICE=JAVAMETA causes PROC GCHART to produce metacodes which are embedded in the HTML le produced by ODS and passed to the Metaview applet as parameters.
proc sort data= sashelp.prdsale out=prdsummary; by year quarter; run; goptions reset=all device=javameta ftext="Trebuchet" htext=1.5 hby=2; ods listing close; ods html; proc gchart data=prdsummary; by year quarter; hbar country / sumvar=actual subgroup=product sum; run; quit; ods html close;
540
541
CHAPTER
23
Generating Web Output with the Annotate Facility
Overview of Generating Web Output with the Annotate Facility 541 Generating Web Output with the Annotate Facility 541 When to Use PROC GANNO to Generate Web Output 542 When to Apply Annotate Data Sets to Web Output 542 Generating Web Links with the Annotate Facility 542 Examples 543
542
Chapter 23
3 When you cannot add drill-down functionality by other means. Some SAS/GRAPH
statements do not support the HTML= option, which SAS/GRAPH needs to generate an image map in the HTML output le. If the procedure does support the ANNOTATE= option, then you can use that procedure as the basis of a drill-down Web presentation.
3 When you do not want Web users to drill down by selecting graph elements. For
example, if you did not want your Web users to drill down by selecting the bars in a bar chart, you could dene graphics elements with drill-down links using the Annotate facility. To use the Annotate facility to add drill-down links to a Web presentation, see Generating Web Links with the Annotate Facility on page 542.
Annotate graphical elements with drill-down links. Also determine your drill-down URLs.
2 Generate an Annotate data set. Elements that can be dened as drill-down hot
zones are generated by Annotate functions that use the HTML variable. To see which functions use the HTML variable, refer to Figure 29.4 on page 649. To generate the Annotate data set, see Chapter 29, Using Annotate Data Sets, on page 643.
3 Specify the ACTXIMG, GIF, JPEG, or PNG device driver using the DEVICE=
Examples
543
5 Generate a GIF, JPEG, or PNG image and identify the Annotate data set. Use the
GANNO procedure or another SAS/GRAPH procedure that uses the ANNOTATE= option.
6 Close the HTML output le. 7 Generate any additional HTML les or images as needed to provide les that are
Examples
For an example of creating web output with the GANNO procedure, see Example 4 on page 925. For examples of applying Annotate data sets to output, see Examples on page 660.
544
545
CHAPTER
24
Creating Interactive Treeview Diagrams
Creating Treeview Diagrams 546 When to Use the Treeview Applet 546 Interactivity Enabled by the Treeview Applet 547 Programming with the DS2TREE Macro for the Treeview Applet Enhancing Presentations for the Treeview Applet 548 DS2TREE Macro Arguments 549 Sample Programs: Treeview Macro 549 Sample Treeview with XML Embedded in the HTML File 550 Results Shown in a Browser 550 SAS Code 550 Sample Treeview with XML Written to an External File 551 SAS Code 551 Treeview with Hotspots 552 SAS Code 552
547
546
Chapter 24
You can scroll across the diagram by selecting off-center nodes or by searching for nodes. Positioning the cursor over a node can display optional data tips. If you then right-click, you access a pop-up menu. The menu enables you to highlight or hide subtrees or drill-down to an optional URL. The menu also enables you to select all nodes, display all previously hidden nodes, reset the view, display applet help, and search for nodes using various search parameters. SAS/GRAPH programming for the Treeview applet differs from some of the other applets in that it does not use ODS, a device driver specication, or a SAS/GRAPH procedure. Instead, the DS2TREE macro references data sets to generate and congure an HTML output le that runs the Treeview applet.
547
If you need a higher degree of congurability to illustrate weighted relationships between the nodes and links in your diagram, then the Constellation applet might be a better choice than the Treeview applet, as described in Creating Constellation Diagrams on page 555.
548
Chapter 24
/* 3. Specify titles and footnotes: (optional). */ title1 Organizational Chart; footnote1 To display the department name, place the cursor over a node.; footnote2 To rotate the chart, click and drag a node.; /* 4. Run the DS2TREE macro. */ /* You must change the CODEBASE= argument (using either http:// */ /* or a directory path such as C:/) to specify the location of your */ /* sas.graph.treeview.jar file and its associated jar files */ /* (sas.graph.nld.jar, sas.graph.j2d.jar). See the CODEBASE= argument in: /* Arguments for the APPLET Tag*/ /* Make sure that the ods listing destination is open. */ ods listing; %ds2tree(ndata=myorg, /* data sets and files */ codebase=&jarfiles, xmltype=inline, htmlfile=&htmlfile, nid=empno, /* roles of variables */ nparent=mgrno, ntip=deptname, nlabel=name, height=500, /* appearance */ width=600, tcolor=navy, fcolor=black);
*/
Display the resulting HTML le in a Web browser to run the Treeview applet and display the node/link diagram. The preceding example shows how the arguments of the DS2TREE macro identify a data set and specify how the variables in that data set are to be interpreted to generate the diagram. Appearance arguments dene the size of the diagram and the color of the text in the title and footnotes. For information on generating more complex diagrams for the Treeview applet, see Enhancing Presentations for the Treeview Applet on page 548. For denitions of all DS2TREE macro arguments, see DS2TREE Macro Arguments on page 549.
549
and identies the DS2TREE arguments that implement them. For a complete list of macro arguments, see Macro Arguments on page 571.
Table 24.1 Treeview Applet Enhancements
DS2TREE Argument SSFILE, SSFREF, SSHREF, SSMEDIA, SSREL, SSREV, SSTITLE, SSTYPE LSTIP, LSTIPFAC IBACKPOS, IBACKLOC, IBACKURL NTIP, TIPS NURL ACTION, NACTION FACTOR, FISHEYE SPREAD, TREEDIR, TREESPAN
Enhancement Specify a stylesheet to format your HTML output le. Specify dash patterns for link lines. Specify a background color, image, or drill-down URL. Add pop-up data tips to nodes. Add drill-down URLs to nodes. Specify an action for the pull-down menu. Change the amount of sheye distortion. Determine layout of diagram.
3 Arguments for the APPLET Tag on page 571. The CODEBASE argument is
required.
3 DS2TREE and DS2CONST Arguments for Data Denition on page 573. For
DS2TREE the arguments NDATA and NID are required.
3 3 3 3 3 3
Arguments for Generating HTML and XML Files on page 580. DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581. Arguments for Page Formatting on page 587. Arguments for Stylesheets on page 589. Arguments for the SAS TITLE and FOOTNOTE Tags on page 591. Arguments for Character Transcoding on page 595.
3 Sample Treeview with XML Embedded in the HTML File on page 550 3 Sample Treeview with XML Written to an External File on page 551 3 Treeview with Hotspots on page 552.
550
Chapter 24
SAS Code
The following is the complete SAS code used to generate the Treeview diagram from a SAS data set. Note the following:
3 The parameter HTMLFILE= species the complete path and name of the HTML
le to be created by the DS2TREE macro. If you want to run this sample, then change the values of HTMLFILE and CODEBASE to the locations that you want to use.
3 The parameter XMLTYPE=INLINE tells the DS2TREE macro that the XML it
generates from the SAS data set should be included inline in the HTML le.
3 The parameter CUTOFF=1 species that every node on the graph be labeled. Use
this parameter to suppress node labels for diagrams with numerous nodes.
551
Aaron Parker Bob Parker Charlie Parker David Parker Edward Parker
/* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ /* specify complete url if jar files are not in same directory as html file */ codebase=http://your_path_to_archive, xmltype=inline, htmlfile=your_path_and_filename.htm, nid=id, /* use this variable as the id */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* display this on each node */ height=400, width=400, tcolor=navy, fcolor=black);
SAS Code
The following is the complete SAS code to generate the Treeview diagram from a SAS data set. Note the following: 3 The parameter HTMLFILE= species the complete path and name of the HTML le to be created by the DS2TREE macro. If you want to run this sample, then change the value of HTMLFILE to something that makes sense for you. 3 The parameter XMLTYPE=EXTERNAL tells the DS2TREE that the XML it generates from the SAS data set should be written to an external le. 3 The parameter XMLFILE= species the path and le name of the XML le to be created. 3 The parameter XMLURL= species how the XML le is to be addressed from within the HTML le. 3 The parameter CUTOFF=1 species that every node on the graph be labeled. Use this parameter with a value between 0 and 1 to suppress node labels for diagrams with numerous nodes.
552
Chapter 24
cards; aaron Aaron Parker bob Bob Parker aaron charlie Charlie Parker aaron david David Parker aaron edward Edward Parker david ; run; goptions reset=all; /* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm, xmltype=external, makexml=y, xmlurl=http://www.xtz.com/weboutput_treeview2_sample.xml, xmlfile=u:/public/weboutput_treeview2_sample.xml, nid=id, /* as the id, use this variable specified here */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* display the value of this variable on each node */ height=400, width=400, tcolor=navy, fcolor=black);
SAS Code
The following is the complete SAS code to generate the Treeview diagram from a SAS data set. Note the following: 3 The parameter NURL= species the URL to be opened when the corresponding node is double-clicked. 3 The parameter DRILTARG=_TOP species that the HTML le is to be opened in the same window as the Treeview diagram instead of in a new window, as is the default.
data father_and_sons; input id $8. name $15. cards; aaron Aaron Parker bob Bob Parker charlie Charlie Parker david David Parker edward Edward Parker ;
553
run; /* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ /* specify complete url if jar files are not in same directory as html file */ codebase=http://your_path_to_archive, xmltype=inline, htmlfile=your_path_and_filename.htm, nid=id, /* as the id, use the variable specified here */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* display the value of this variable on each node */ height=400, width=400, tcolor=navy, fcolor=black, nurl=url, driltarg=_top );
554
555
CHAPTER
25
Creating Interactive Constellation Diagrams
Creating Constellation Diagrams 555 When to Use the Constellation Applet 556 Programming with the DS2CONST Macro for the Constellation Applet Enhancing Presentations for the Constellation Applet 561 DS2CONST Macro Arguments 562 Sample Programs: Constellation Macro 562 Constellation Chart with DATATYPE=ARCS 562 Results Shown in a Browser 562 SAS Code 563 Constellation Chart with DATATYPE=ASSOC 564 Results Shown in a Browser 564 SAS Code 565 Constellation Chart with XML Written to an External File 566 SAS Code 566 Constellation Chart with Hotspots 568 SAS Code 568
557
556
Chapter 25
Display 25.1
A Constellation Diagram
Interactive features of the Constellation Applet include pop-up data tips for links and nodes, subsetting of links via an embedded scroll bar, pan and zoom, and several node and link selection modes. You can dene drill-down URLs for nodes, specify menu text for the drill-down action, insert a background image, and specify a drill-down URL for the background image, among other enhancements. You can also specify your own JavaScript methods to dene responses to drill-down actions. The Constellation Applet, like the Treeview applet, differs from the other applets in that the diagrams that they display are not generated by SAS/GRAPH procedures. The DS2CONST macro generates and formats an HTML output le, and species the appearance and behavior of the node/link diagram based on values in a data set.
557
organizational trees, because of its unique layout capabilities. For information on the Treeview Applet, see Creating Treeview Diagrams on page 546.
558
Chapter 25
MACW 430 220 19 Mid-Atlantic Area Council - West UPNY 450 160 18 Upstate New York DSNY 500 170 18 Downstate New York NYC 530 200 18 New York City LILC 570 170 18 Long Island Lighting Company NENG 570 90 18 New England Power Pool ; run; /*--- Define the node connections. */ data &lib..links; length from to $4 ltip $12; format capacity comma.; input from to capacity; ltip = left(put(capacity, comma.) || " MW"); if capacity < 500 then width = 1; else if capacity < 1000 then width = 2; else if capacity < 2000 then width = 3; else if capacity < 3000 then width = 4; else width = 5; cards; MECS ECAO 2250 ECAO MECS 2250 ECAO MACW 2957 ECAO MANO 1655 ECAO TVA 1890 ECAO VACA 2334 ERCT SPPS 635 MACE MACW 1500 MACE DSNY 1130 MACS MACW 1800 MACS VACA 3075 MACW ECAO 2612 MACW MACE 3368 MACW MACS 3075 MACW UPNY 481 MANO ECAO 3033 MANO WUMS 608 MANO MAPP 531 MANO SPPN 1191 MANO TVA 2207 MANO ENTG 1245 WUMS MANO 1080 WUMS MAPP 676 MAPP MANO 1150 MAPP WUMS 324 MAPP SPPN 1172 MAPP ENTG 1000 MAPP NWPE 150 MAPP RMPA 233 NENG DSNY 1425 UPNY MACW 1418 UPNY DSNY 3750 DSNY LILC 788
559
DSNY MACE 308 DSNY NENG 1125 DSNY UPNY 3750 DSNY NYC 3750 NYC LILC 788 NYC DSNY 3750 LILC DSNY 938 LILC NYC 788 SPPN MANO 1228 SPPN MAPP 891 SPPN SPPS 525 SPPN ENTG 636 SPPS ERCT 569 SPPS ENTG 636 SPPS SPPN 900 SPPS AZNM 315 SPPS ENTG 1200 ENTG SOU 1136 ENTG TVA 1278 ENTG MANO 1399 ENTG SPPS 292 ENTG SPPN 292 ENTG MAPP 856 SOU FRCC 4516 SOU TVA 1810 SOU VACA 1346 SOU ENTG 1902 FRCC SOU 21 TVA ECAO 2235 TVA MANO 2331 TVA SOU 2052 TVA ENTG 2153 TVA VACA 2261 VACA ECAO 2822 VACA MACS 2794 VACA SOU 3042 VACA TVA 2240 CALI PNW 4922 CALI AZNM 0 CALI NWPE 1184 PNW CALI 5903 PNW NWPE 1050 RMPA MAPP 233 RMPA AZNM 518 RMPA NWPE 413 NWPE RMPA 413 NWPE CALI 1574 NWPE MAPP 113 NWPE AZNM 840 NWPE PNW 2145 AZNM CALI 5663 AZNM NWPE 638 AZNM RMPA 518 AZNM SPPS 315
560
Chapter 25
; run; /*--- Make sure ods listing is open when running macro. */ ods listing; /*--- Set chart title. */ title1 "Electric Power Regional Interconnections"; title2 "Created with SAS/GRAPH Constellation Applet"; footnote1 "Link: Base Electricity Transfer Capacity"; footnote2 "Node: Generation Reserve Margin"; /*--- Use the DS2CONST macro to %ds2const(ndata=&lib..regions, ldata=&lib..links, datatype=assoc, nvalue=reserve, nodeshap=circle, cnode=red, colormap=y, height=520, width=600, codebase=&jarfiles, htmlfile=&htmlfile, openmode=replace, archive=&archive, nid=regionID, border=y, fntsize=14, fntstyl=plain, nlabel=regionID, labels=y, linktype=line, layout=user, nx=xLoc, ny=yLoc, lfrom=from, lto=to, lwidth=width, ntip=RegionName, ltip=ltip, center=y, tcolor=#0000FF, fcolor=#0000FF, tsize=3, fsize=2, bgtype=color, bg=#DDDDDD, septype=none); generate the chart. */ /* Node parameters */ /* Node linkage parameters */ /* Size nodes by nvalue var */ /* Var for node sizes */ /* Node shape */ /* Node fill color */ /* Use colormap for link/node colors */ /* Applet window height */ /* Applet window width */ /* Path to archive file */ /* Output file name */ /* Create a new html file */ /* Java archive file name */ /* Var for node ID string */ /* Enclose diagram */ /* Node label font size */ /* Node label font style */ /* Var for node label string */ /* Display node labels */ /* Do not show flow direction */ /* Use nx/ny to position nodes */ /* x-coordinate of node */ /* y-coordinate of node */ /* Var for from-node ID */ /* Var for to-node ID */ /* Var for line widths */ /* Var for popup node text */ /* Var for popup line text */ /* Center chart on the page */ /* Title text color */ /* Footnote text color */ /* Title text size */ /* Footnote text size */ /* Use page background color */ /* The page background color */ /* No separator line */
Display the resulting HTML le in a Web browser to run the applet and generate the diagram. Arguments in the DS2CONST macro identify the name of the nodes and links data sets. In the nodes data set, arguments identify a node ID variable and a node label
561
variable. Other arguments identify the links data set and the variables that dene the nodes at the start and end of each link line. For information on more complex presentations for the Constellation Applet, see Enhancing Presentations for the Constellation Applet on page 561.
Enhancements Specify link weights and congure a scroll bar that controls the display of links based on weight. Lay out the diagram automatically or as specied in a data set. Specify a stylesheet to format the HTML output le.
LAYOUT BDCLASS, SEPCLASS, SPCLASS, SSFILE, SSHREF See Arguments for Stylesheets on page 589.
Add pop-up data tips to nodes and links. Dene drill-down URLs for nodes and links. Specify menu option text for a drill-down action. Specify a browser window or frame that displays drill-down URLs. Add a background color, image, or drill-down URL. Specify text colors, fonts, styles, and sizes.
LTIP, NTIP LURL, NURL ACTION, NACTION DRILTARG IBACKLOC, IBACKPOS, IBACKURL, NFNTNAME, NSFNTNAM, CTEXT, CATEXT See DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581.
Specify colors for nodes and links. Specify dashed link lines.
Note that a number of enhancements apply only to associative data sets when you specify the macro argument DATATYPE=ASSOC. The macro argument denitions identify which features apply only to associative data.
562
Chapter 25
The DS2CONST macro requires you to specify node and link data sets. As an enhancement, you can dene a node styles data set that contains style information only. You can use the node styles data set to standardize the appearance of a series of diagrams, among other uses. Reference information on the arguments of the DS2CONST macro is provided in DS2CONST Macro Arguments on page 562.
3 Arguments for the APPLET Tag on page 571. The CODEBASE argument is
required. 3 DS2TREE and DS2CONST Arguments for Data Denition on page 573. For DS2CONST the arguments NDATA, NID, LDATA, and LTO are required. 3 Arguments for Generating HTML and XML Files on page 580.
3 3 3 3 3
DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581. Arguments for Page Formatting on page 587. Arguments for Stylesheets on page 589. Arguments for the SAS TITLE and FOOTNOTE Tags on page 591. Arguments for Character Transcoding on page 595.
3 3 3 3
Constellation Chart with DATATYPE=ARCS on page 562 Constellation Chart with DATATYPE=ASSOC on page 564 Constellation Chart with XML Written to an External File on page 566 Constellation Chart with Hotspots on page 568.
563
SAS Code
The following is the complete SAS code used to generate a Constellation diagram from a SAS data set. Notice the following:
3 The parameter HTMLFILE= species the complete path and name of the HTML
le to be created by the DS2CONST macro. If you want to run this sample, then change the value of HTMLFILE to the location where you want the HTML le stored.
3 The parameter NSHAPE= species the variable in the SAS data set that encodes
the shape of each node.
3 The parameter NCOLOR= species the variable in the SAS data set that encodes
the color of each node.
/*Define a nodes data set of countries and languages data nodedata; input nodeLabel $15. shape $10. color $8. size; cards; France square red .1 Germany square red .1 Italy square red .1 Belgium square red .1 Switzerland square red .1 Holland square red .1 German triangle blue .1 French triangle blue .1 Italian triangle blue .1 Flemish triangle blue .1 Dutch triangle blue .1 ; run; /*Define a links data set */ data linkdata; input from $15. to $15.; cards;
*/
564
Chapter 25
France French Germany German Belgium French Belgium German Belgium Flemish Belgium Dutch Switzerland French Switzerland German Switzerland Italian Italy Italian Italy German Holland Dutch ; run; goptions reset=all; /* make sure ods listing is open when running macro */ ods listing; /*Run the DS2CONST macro*/ %ds2const(ndata=nodedata, ldata=linkdata, datatype=arcs, cnode=red, colormap=y, height=400, width=500, code=ConstChart, codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm, nid=nodelabel, nlabel=nodelabel, lfrom=from, lto=to, fntsize=12, nshape=shape, ncolor=color, nsize=size);
565
SAS Code
The following is the complete SAS code to generate a Constellation diagram from a SAS data set. Notice the following: 3 The parameter HTMLFILE= species the complete path and name of the HTML le to be created by DS2CONST. If you want to run this sample, then change the value of HTMLFILE to something that makes sense for you. 3 The parameter NVALUE= species the data set variable that is used to determine the size and color of each node. 3 The parameter LVALUE= species the data set variable that is used to determine the width and color of each line between nodes.
data nodedata; length nodeID value 8 label $11 tip $25; input nodeID value @11 label $char11. @25 tip $char25.; cards; 0 6556 depression depression: #6556 1 6322 anxiety anxiety: #6322 2 5980 fatigue fatigue: #5980 3 5286 headache headache: #5286 4 4621 chest pain chest pain: #4621 6 3149 nausea nausea: #3149 ; run; data linkdata; length from to linkvalue 8 tip $40; input from to linkvalue @13 tip $char40.; cards; 2 0 5978 #5978, Support:63.0790, Conf:99.9833 4 1 4621 #4621, Support:48.7602, Conf:100.0000 1 0 4307 #4307, Support:45.4469, Conf:68.1272
566
Chapter 25
1 2 2 3 0 3 1 6 4 6 4 0 4 2 3 0 3 1 3 2 1 3 4 3 0 6 2 6 6 3 3 6 6 0 run;
3964 3010 3009 2772 2609 2606 2263 1980 1701 1701 1593 1152 623 623 597 372 344
#3964, Support:41.8276, Conf:62.7017 #3010, Support:31.7611, Conf:50.3429 #3009, Support:31.7506, Conf:47.5957 #2772, Support:29.2498, Conf:43.8469 #2609, Support:27.5298, Conf:56.4596 #2606, Support:27.4982, Conf:56.3947 #2263, Support:23.8789, Conf:48.9721 #1980, Support:20.8927, Conf:40.6821 #1701, Support:17.9487, Conf:34.9497 #1701, Support:17.9487, Conf:34.9497 #1593, Support:16.8091, Conf:25.1977 #1152, Support:12.1557, Conf:24.9297 #623, Support:6.5738, Conf:9.8545 #623, Support:6.5738, Conf:10.4198 #597, Support:6.2995, Conf:20.0268 #372, Support:3.9253, Conf:7.6433 #344, Support:3.6298, Conf:11.5398
/* make sure ods listing is open when running macro */ ods listing; title1 "Diagnosis Sequence Diagram."; %ds2const(ndata=nodedata, ldata=linkdata, datatype=assoc, minlnkwt=30, height=450, width=600, codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm, colormap=y, nid=nodeID, nlabel=label, nvalue=value, fntsize=12, ntip=tip, lfrom=from, lto=to, lvalue=linkvalue, ltip=tip, linktype=arrow);
SAS Code
The following is the complete SAS code to generate the Constellation diagram from a SAS data set. You can notice the following:
567
3 The parameter HTMLFILE= species the complete path and name of the HTML
le to be created by DS2CONST. If you want to run this sample, then change the value of HTMLFILE to something that makes sense for you.
3 The parameter XMLTYPE=EXTERNAL tells the DS2CONST macro that the XML
that it generates from the SAS data set should be written to an external le.
3 The parameter XMLFILE= species the path and le name of the XML le to be
created.
data nodedata; length nodeID value 8 label $11 tip $25; input nodeID value @11 label $char11. @25 tip $char25.; cards; 0 6556 depression depression: #6556 1 6322 anxiety anxiety: #6322 2 5980 fatigue fatigue: #5980 3 5286 headache headache: #5286 4 4621 chest pain chest pain: #4621 6 3149 nausea nausea: #3149 ; run; data linkdata; length from to linkvalue 8 tip $40; input from to linkvalue @13 tip $char40.; cards; 2 0 5978 #5978, Support:63.0790, Conf:99.9833 4 1 4621 #4621, Support:48.7602, Conf:100.0000 1 0 4307 #4307, Support:45.4469, Conf:68.1272 1 2 3964 #3964, Support:41.8276, Conf:62.7017 2 3 3010 #3010, Support:31.7611, Conf:50.3429 0 3 3009 #3009, Support:31.7506, Conf:47.5957 1 6 2772 #2772, Support:29.2498, Conf:43.8469 4 6 2609 #2609, Support:27.5298, Conf:56.4596 4 0 2606 #2606, Support:27.4982, Conf:56.3947 4 2 2263 #2263, Support:23.8789, Conf:48.9721 3 0 1980 #1980, Support:20.8927, Conf:40.6821 3 1 1701 #1701, Support:17.9487, Conf:34.9497 3 2 1701 #1701, Support:17.9487, Conf:34.9497 1 3 1593 #1593, Support:16.8091, Conf:25.1977 4 3 1152 #1152, Support:12.1557, Conf:24.9297 0 6 623 #623, Support:6.5738, Conf:9.8545 2 6 623 #623, Support:6.5738, Conf:10.4198 6 3 597 #597, Support:6.2995, Conf:20.0268 3 6 372 #372, Support:3.9253, Conf:7.6433 6 0 344 #344, Support:3.6298, Conf:11.5398 run; title1 "Diagnosis Sequence Diagram."; /* make sure ods listing is open when running macro */ ods listing;
568
Chapter 25
%ds2const(ndata=nodedata, ldata=linkdata, datatype=assoc, minlnkwt=30, height=450, width=600, codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm, xmltype=external, makexml=y, xmlurl=http://www.xyz.com/Web_output/const_assoc_external.xml, xmlfile=u://Web_output/const_assoc_external.xml, colormap=y, nid=nodeID, nlabel=label, nvalue=value, fntsize=12, ntip=tip, lfrom=from, lto=to, lvalue=linkvalue, ltip=tip, linktype=arrow);
SAS Code
The following is the complete SAS code to generate the Constellation diagram from a SAS data set. Notice the following: 3 The parameter NURL= species the variable in the SAS data set that contains the URL to be linked to when a user double-clicks the node.
/*Define a nodes data set of countries and languages */ data nodedata; input nodeLabel $15. shape $10. color $8. size url $40.; cards; France square red .1 http://www.xyz.com Germany square red .1 http://www.xyz.com/rnd/webgraphs/ Italy square red .1 http://www.xyz.com Belgium square red .1 http://www.xyz.com/rnd/webgraphs/ Switzerland square red .1 http://www.xyz.com Holland square red .1 http://www.xyz.com German triangle blue .1 http://www.xyz.com French triangle blue .1 http://www.xyz.com/rnd/webgraphs/odssyntax.htm Italian triangle blue .1 http://www.xyz.com Flemish triangle blue .1 http://www.xyz.com Dutch triangle blue .1 http://www.xyz.com ;
569
run; /*Define a links data set: */ data linkdata; input from $15. to $15.; cards; France French Germany German Belgium French Belgium German Belgium Flemish Belgium Dutch Switzerland French Switzerland German Switzerland Italian Italy Italian Italy German Holland Dutch ; run; goptions reset=all; /* make sure ods listing is open when running macro */ ods listing; /*Run the DS2CONST macro:*/ %ds2const(ndata=nodedata, ldata=linkdata, nurl=url, datatype=arcs, cnode=red, colormap=y, height=400, width=500, code=ConstChart, codebase=http://your_path_to_archive, htmlfile=your_path_and_filename.htm, nid=nodelabel, nlabel=nodelabel, lfrom=from, lto=to, fntsize=12, nshape=shape, ncolor=color, nsize=size);
570
571
CHAPTER
26
Macro Arguments for the DS2CONST and DS2TREE Macros
Macro Arguments 571 Arguments for the APPLET Tag 571 DS2TREE and DS2CONST Arguments for Data Denition 573 Arguments for Generating HTML and XML Files 580 DS2TREE and DS2CONST Arguments for Diagram Appearance Arguments for Page Formatting 587 Arguments for Stylesheets 589 Arguments for the SAS TITLE and FOOTNOTE Tags 591 Arguments for Character Transcoding 595 Reserved Names 596
581
Macro Arguments
Macro arguments specify the conguration of the HTML output le, the location of the data that is used to generate the diagram, and the conguration of the applets interactive features. The macros use the following syntax: %macroname(argument1=value1, argument2=value2, ...);
3 Arguments for the APPLET Tag on page 571. The CODEBASE argument is
required.
3 DS2TREE and DS2CONST Arguments for Data Denition on page 573. For 3 3 3 3 3 3
DS2TREE, the arguments NDATA and NID are required. For DS2CONST the arguments NDATA, NID, LDATA, and LTO are required. Arguments for Generating HTML and XML Files on page 580. DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581. Arguments for Page Formatting on page 587. Arguments for Stylesheets on page 589. Arguments for the SAS TITLE and FOOTNOTE Tags on page 591. Arguments for Character Transcoding on page 595.
572
Chapter 26
ALIGN=position species the alignment of the applet window in the browser window or frame. Values can be LEFT, RIGHT, TOP, BOTTOM, TEXTTOP, MIDDLE, ABSMIDDLE, BASELINE, or ABSBOTTOM.
Used by: DS2TREE, DS2CONST
ALT=text species the text that will be displayed on mouseover by browsers that understand the tag but cannot run Java applets. The default value is SAS Institute Inc. applet_name.
Used by: DS2TREE, DS2CONST
ARCHIVE=lename species the name of the Java archive le(s). Note: The path to the Java archive is specied in the CODEBASE argument. 4 The following table shows what archive les to use with each of the macros. For DS2TREE and DS2CONST, you do not have to specify a value for ARCHIVE= because the values shown are generated by default. DS2TREE DS2CONST archive=%str(sas.graph.treeview.jar, sas.graph.nld.jar, sas.graph.j2d.jar) archive=%str(sas.graph.constapp.jar, sas.graph.nld.jar, sas.graph.j2d.jar)
Note: Before SAS 9.1, treeview.jar and constapp.jar also contained the classes that are now included in the auxiliary JAR les (sas.graph.nld.jar and sas.graph.j2d.jar). Although you can continue to use the older JAR les by specifying ARCHIVE=treeview.jar or ARCHIVE=constapp.jar, future versions may not support these older JAR les. 4
Used by: DS2TREE, DS2CONST
AWUNITS=PIXELS | PERCENT species the units of the WIDTH= argument. The default value is PIXELS. See also the HEIGHT= and AHUNITS= arguments.
Used by: DS2TREE, DS2CONST
CODEBASE=path-or-URL species the path of the SAS Java archives specied in the ARCHIVE= argument. The CODEBASE argument is required. You can specify CODEBASE=. if the HTML le and Java archive les are in the same directory. Note: You can specify the location pointed to by the SAS system option APPLETLOC=, or you can specify a different location. To display the current value of APPLETLOC, run the following code:
proc options option=appletloc; run;
The value of the APPLETLOC system option is not used as the default value.
Used by: DS2TREE, DS2CONST
HEIGHT=applet-height species the height of the applet window. The unit of measure is pixels unless changed by the AHUNITS= argument. The default value is 600 for all macros.
Used by: DS2TREE, DS2CONST
573
HSPACE=pixels species the amount of horizontal space, in pixels, to the left and right of the graph or diagram.
Used by: DS2TREE, DS2CONST
NAME=applet-name species the name for this instance of the applet. You need to use this argument only if you have more than one instance of the APPLET tag in your HTML le, and if you have included your own scripts or DHTML that communicates with or acts on a particular instance of the applet.
Used by: DS2TREE, DS2CONST
VSPACE=pixels species the amount of vertical space, in pixels, to the top and bottom of the graph or diagram.
Used by: DS2TREE, DS2CONST
WIDTH=applet-width species the width of the applet window. The unit of measure defaults to pixels unless specied by the AWUNITS= argument.
Used by: DS2TREE, DS2CONST
LABELS=Y | N indicates whether or not node labels are displayed in the diagram. The default value is Y.
Used by: DS2CONST, DS2TREE
LAYOUT=AUTO | USER when the value is AUTO (default), species that the Constellation Applet lays out the diagram using stress and strain equations. Specifying the value USER indicates that the node positions are specied in the NX and NY arguments.
Used by: DS2CONST
574
Chapter 26
LCOLOR=variable-name species the name of the variable that determines the color of the link lines. The values of this variable must be HTML 3.2 color names, or you must use the LCOLFMT= argument to convert those values to valid color names. The default color is provided by the CLINK= argument (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581). In the DS2CONST macro, the LCOLOR= argument is overridden by the LCOLVAL= argument. Used by: DS2CONST, DS2TREE LCOLFMT=user-dened-format-name species the name of a user-dened SAS format that converts the values in the variable named in the LCOLOR= argument to valid HTML color names. Note that the SAS format does not change any values in the data set. The formatted values are applied to the diagram only. Used by: DS2CONST, DS2TREE LCOLVAL=variable-name species the name of the variable that determines the color mapping of link lines. This argument is valid only when the value of the DATATYPE= argument is ASSOC, and only when the value of the COLORMAP= argument is Y. If the LCOLVAL= argument is not specied, the link colors are determined by the following arguments in the following order: LCOLOR= (see above) and CLINK= (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581). Used by: DS2CONST LDATA=data-set-name species the name of the SAS data set that contains the link data that is used to generate the diagram. This argument is required. Used by: DS2CONST LFROM=variable-name species the name of the variable whose values dene the nodes at the start of link lines. The LFROM variable values must be coordinated with the values of the variables that are named in the NID= and LTO= arguments. This argument is required. Used by: DS2CONST LINKTYPE=LINE | ARROW when the value is ARROW (default), indicates that link lines are to be drawn with arrowheads that indicate the direction of ow. Used by: DS2CONST LPT=password species the password that is needed for accessing a password-protected link data set (specied with the LDATA= argument). The LPT= argument is required if the data set has a READ or PW password. You do not need to specify this argument if the data set has a WRITE or ALTER password. Used by: DS2CONST LSTIP=variable-name species the name of the variable in the data set that determines the stipple mask. The stipple mask generates dashed or dotted link lines. The value of the variable must be an integer, which is then converted into a binary value. In the binary value, a 1 bit means that a pixel is to be drawn and a 0 bit means that
575
no pixel is to be drawn. For example, if the variable has a value of 61680, the binary conversion of that value will be 1111000011110000. This stipple mask generates a dashed link line with dashes and spaces that are four pixels wide. See also the LSTIPFAC= argument.
Used by: DS2CONST, DS2TREE
LSTIPFAC=variable-name species the name of the variable in the data set whose value species a multiplier for the binary stipple mask (see the LSTIP= argument). The multiplier lengthens the dashes in the base mask. For example, if the multiplier is 2, a stipple mask that species 4-pixel dashes and 4-pixel spaces will generate link lines with 8-pixel dashes and spaces.
Used by: DS2CONST, DS2TREE
LTIP=variable-name species the name of the variable in the data set that provides the text that is displayed in the pop-up data tips windows for links.
Used by: DS2CONST, DS2TREE
LTIPFMT=user-dened-format-name species the name of a user-dened SAS format that is applied to the values in the variable specied in the LTIP= argument to congure those values for display in the pop-up data tips window. Note that the SAS format does not change any values in the data set. The formatted values are applied to the diagram only.
Used by: DS2CONST, DS2TREE
LTO=variable-name species the name of the variable whose values identify the nodes at the ends of link lines. The LTO variable values must be coordinated with the values of the variables that are named in the LFROM and NID arguments. This argument is required.
Used by: DS2CONST
LVALUE=variable-name species the name of the variable whose values determine the weights of the link lines, which determines the color and relative thickness of link lines. The variable values must be real numbers. The link weights are used with the MINLNKWT= argument (see below) and the SCLNKWT= argument (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581) to control the display of link lines. The LVALUE= argument is valid only when the value of the DATATYPE= argument is ASSOC.
Used by: DS2CONST
LWHERE=subset-expression species a WHERE clause that subsets the link data for display in the diagram. If the expression contains any special characters (for example, % or &), include %NRBQUOTE in the expression to process those characters correctly. The following example shows how to correctly specify INT%:
LWHERE=%NRBQUOTE(value="Int%")
LWIDTH=variable-name species the name of the variable in the data set that determines the width of the link lines.
576
Chapter 26
For DS2CONST: When this argument is not specied, the width is determined by the LVALUE argument. This argument is valid for DS2CONST only when the value of the DATATYPE argument is ASSOC. Used by: DS2CONST, DS2TREE MINLNKWT=minimum-link-weight species the initial minimum link weight, which determines which links are initially displayed. The initial diagram show only those links that have weights that are greater than or equal to the minimum weight. In the Constellation Applet, a scroll bar allows the Web user to change the minimum link weight to change the number of links that are displayed. Selecting the browers Refresh option restores the intial minimum link weight that is specied in the MINLNKWT argument. Link weights are determined by the LVALUE argument. This argument is valid only when the value of the DATATYPE argument is ASSOC. Used by: DS2CONST NACTION=variable-name species the name of the variable in the nodes data set that provides the menu text that is displayed when the Web user selects a node with the right mouse button. Selecting this menu option text displays the URL that is associated with that node in the NURL= argument. This argument overrides the ACTION= argument (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581). The default menu option text is Open URL. Used by: DS2CONST, DS2TREE NCOLFMT=SAS-format-name species the name of a user-dened SAS format that converts the values in the variable named in the NCOLOR= argument to valid HTML color names. Note that the data in the data set is not altered; the formatted value is used in the hierarchical tree rather than the data value. Used by: DS2CONST, DS2TREE NCOLOR=variable-name species the variable in the nodes data set that determines the background color of the nodes, using HTML 3.2 color names or 6-digit hexadecimal RGB values . If the variable does not contain valid HTML color names, then you can use the NCOLFMT=argument to convert those values to the HTML color names. See also the NCOLVAL= and NVALUE=arguments. Used by: DS2CONST, DS2TREE NCOLVAL=variable-name species the name of the variable in the nodes data set that determines the color mapping for the nodes. This argument is valid only when the DATASET= argument is set to ASSOC, and only when the value of the COLORMAP= argument is Y. If this argument is not specied, then the node color is determined by the LVALUE= argument. Used by: DS2CONST NDATA=SAS-data-set-name species the SAS data set that contains the node data. This argument is required. Used by: DS2CONST, DS2TREE NFNTNAME=node-font-variable-name species the name of the variable that determines the text font for the node labels. The variable value can be SERIF, SANSSERIF, DIALOG, DIALOGINPUT, or MONOSPACED. The default node font is specied by the FNTNAME= argument
577
(see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581).
Used by: DS2CONST, DS2TREE
NFNTSIZE=variable-name species the name of the variable in the nodes data set that determines the size of the text font used for node labels. This font size is expressed in points. This argument overrides the FNTSIZE= argument.
Used by: DS2CONST, DS2TREE
NFNTSTYL=node-font-style-variable-name species the name of the variable that determines the font style for the node label. The valid values that can be assigned to the variable are BOLD, ITALIC, and PLAIN.
Used by: DS2CONST, DS2TREE
NID=variable-name species the name of the variable in the nodes data set whose values are to illustrated as the nodes in the diagram. The node ID variable type can be either numeric or character. For the DS2CONST macro, the values of the NID variable must be coordinated with the values of the LFROM and LTO variables. This argument is required.
Used by: DS2CONST, DS2TREE
NLABEL=node-label-variable-name species the name of the variable that represents the node labels. This variable type can be either numeric or character.
Used by: DS2CONST, DS2TREE
NPARENT=node-parent-variable-name species the name of the variable that represents the parent nodes. This variable type can be either numeric or character.
Used by: DS2TREE
NPW=password species the password that is needed for accessing a password-protected data set. This argument is required if the data set has a READ or PW password. You do not need to specify this argument if the data set has only WRITE or ALTER passwords.
Used by: DS2CONST, DS2TREE
NSCBACK=variable-name species the name of the variable in the node styles data set that determines the background color of the nodes. The variable values must be HTML 3.2 color names. The default value is determined by the CNODE= argument (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581).
Used by: DS2CONST, DS2TREE
NSCTEXT=variable-name species the name of the variable in the node styles data set that provides the colors for the node label text. Valid variable values must be HTML 3.2 color names. The default color is provided by the CATEXT= argument.
Used by: DS2CONST, DS2TREE
578
Chapter 26
NSFNTNAM=variable-name species the name of the variable in the node styles data set that determines the text font that is to be used for node labels. Valid variable values can be SERIF, SANSSERIF, DIALOG, DIALOGINPUT, or MONOSPACED. This argument overrides the FNTNAME= argument.
Used by: DS2CONST, DS2TREE
NSFNTSIZ=variable-name species the name of the variable in the node styles data set that determines the size of the node label text, in points. This argument overrides the FNTSIZE= argument.
Used by: DS2CONST, DS2TREE
NSFNTSTY=variable-name species the name of the variable in the node styles data set that determines the style of the node label text. Valid variable values can be BOLD, ITALIC, or the default value, PLAIN. This argument overrides the FNTSTYL= argument.
Used by: DS2CONST, DS2TREE
NSHAPE=variable-name species the name of the variable that determines the shape of the nodes. Valid variable values can be CIRCLE, DIAMOND, NONE, SQUARE, or TRIANGLE. The default value is SQUARE. This argument overrides the NODESHAP= argument.
Used by: DS2CONST
NSID=variable-name species the name of the variable in the node styles data set that represents the nodes.
Used by: DS2CONST, DS2TREE
NSIZE=variable-name species the name of the variable that determines the size of the nodes. The values of this variable can be real numbers. Node sizes are determined based on the value of the LAYOUT= argument. When LAYOUT=USER, the values of the NSIZE variable are interpreted as literal pixel measurements. When LAYOUT=AUTO, the values of the NSIZE variable determine the size of the nodes based on the relative size of individual values. The values of the NSIZE variable can be scaled with the SCNSIZE= argument (see DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581). This argument is valid only when the value of the DATATYPE= argument is ASSOC.
Used by: DS2CONST
NSPW=password species the password that is needed to access a password-protected node styles data set. This argument is required if the data set has a READ or PW password. You do not need to specify this argument if the data set has only WRITE or ALTER passwords.
Used by: DS2CONST, DS2TREE
NSTYLE=variable-name species the name of the variable that determines the style of the nodes. This variable type can be either numeric or character, and the values must correspond to the node identiers specied in the NSID= argument.
Used by: DS2CONST, DS2TREE
579
NSWHERE=subset-expression species a WHERE clause that subsets the node styles data set for display in the diagram. If the expression contains any special characters (for example, % or &), then include %NRBQUOTE in the expression to process those characters correctly. The following example shows how to correctly specify INT%:
NSWHERE=%NRBQUOTE(value="Int%")
NTEXTCOL=variable-name species the name of the variable that determines the color of the text for the node labels. Valid variable values must be HTML 3.2 color names.
Used by: DS2CONST, DS2TREE
NTIP=variable-name species the name of the variable that provides the data or text that is displayed in the pop-up data tips window.
Used by: DS2CONST, DS2TREE
NTIPFMT=user-dened-format-name species the name of a user-dened SAS format that is applied to the data tips variable that is named in the NTIP= argument. Note that the data set is not altered; the formatted value is used only in the diagram.
Used by: DS2CONST, DS2TREE
NURL=drill-down-URL species the name of the variable that provides the drill-down URLs for the nodes. These URLs are displayed when the Web user double-clicks on a node or selects the node with the right mouse button and chooses an option from the pop-up menu. Menu text is determined by the NACTION= argument above and by the ACTION= argument in DS2TREE and DS2CONST Arguments for Diagram Appearance on page 581. The default menu option text is Open URL.
Used by: DS2CONST, DS2TREE
NVALUE=variable-name species the name of the variable that determines the relative node size. This argument is valid only when DATATYPE=ASSOC. If you do not specify a particular node color using either the NCOLOR or NCOLVAL argument (and if COLORMAP=Y), then this argument also determines a default node color. By default, the largest value of NVALUE is mapped to red, the median value to green, and the lowest value to blue. Values in between result in interpolated colors.
Used by: DS2CONST
NWHERE=subset-expression species a WHERE clause that subsets the nodes data set for display in the diagram. If the expression contains any special characters (for example, % or &), then include %NRBQUOTE in the expression to process those characters correctly. The following example shows how to correctly specify INT%:
NWHERE=%NRBQUOTE(value="Int%")
580
Chapter 26
NX=variable-name NY=variable-name specify the variables that determine the locations of the centers of the nodes. These arguments are valid only when the LAYOUT= argument is set to USER. The values are expressed in pixels. Positive values are measured from the top-left corner of the screen. Negative values are measured from the bottom-right corner of the screen.
Used by: DS2CONST
HTMLFREF=leref species the SAS leref that identies the name and storage location of the HTML output le. If the external le does not exist, then it is created for you. Either this argument, or HTMLFILE=lename, is required if you specify MAKEHTML=Y. Note: Do not use the HTMLFREF= argument if you use the HTMLFILE= argument, and do not use a reserved name (see Reserved Names on page 596).
Used by: DS2TREE, DS2CONST
MAKEHTML=Y | N species whether or not an HTML le is to be generated. The default value is Y, which generates the HTML output le. If you specify MAKEHTML=N and MAKEXML=Y, then only an XML le is generated.
Used by: DS2TREE, DS2CONST
MAKEXML=Y | N species whether or not an XML le is to be generated. The default value is Y, which generates the XML output le. If you specify MAKEXML=N and MAKEHTML=Y, then only an HTML le will be generated. Note that under these circumstances, you must specify a value for the XMLURL= argument.
Used by: DS2TREE, DS2CONST
OPENMODE=REPLACE | APPEND indicates whether the new HTML or XML output or both overwrites the information that is currently in the specied le(s), or if the new output is appended to the end of the existing le(s). The default value is REPLACE. Specify APPEND to add your new HTML-enhanced output to the end of an existing le. Note: OPENMODE=APPEND is not valid if you are writing your resulting HTML to a partitioned data set (PDS) on z/OS.
Used by: DS2TREE, DS2CONST
RUNMODE=B | S species whether you are running the DS2TREE macro in batch or server mode. Batch mode (RUNMODE=B, the default) means that you are submitting the DS2TREE macro in the SAS Program Editor or you have included it in a SAS
581
program. Server mode (RUNMODE=S) generates the HTTP header that is required by Application Dispatcher in the SAS/INTRNET software. Used by: DS2TREE, DS2CONST XMLFILE=external-lename species the name and storage location of the XML output le. If the external le does not exist, then it is created for you. This argument, or XMLFREF=, is required if you specify MAKEXML=Y and XMLTYPE=EXTERNAL. Note: Do not use the XMLFILE= argument if you use the XMLFREF= argument. Used by: DS2TREE, DS2CONST XMLFREF=leref species the SAS leref that identies the name and storage location of the XML output le. If the external le does not exist, then it is created for you. This argument, or XMLFILE=, is required if you specify MAKEXML=Y and XMLTYPE=EXTERNAL. Note: Do not use the XMLFREF= argument if you use the XMLFILE= argument, and do not use a reserved name (see Reserved Names on page 596). Used by: DS2TREE, DS2CONST XMLTYPE=INLINE | EXTERNAL species whether the XML output le is to be written to an external le or included inline with the HTML. The default value is INLINE. If you specify EXTERNAL you must also specify a value for either the XMLFILE= or XMLFREF= arguments. This argument is required if you specify MAKEXML=Y. Used by: DS2TREE, DS2CONST XMLURL=URL species the URL of the existing le that contains the XML tags that dene the node/link diagram. This argument is required if specied XMLTYPE=EXTERNAL. Used by: DS2TREE, DS2CONST
582
Chapter 26
is zero (0) and the V shape opens to the right, as if the letter V was rotated 90 degrees clockwise, to the three-oclock position. Values of the ANGLE= argument that are greater than zero rotate the V shape counterclockwise away from the three-oclock position. Valid values for the ANGLE= argument range from zero (0) to 360 degrees.
Used by: DS2TREE
BORDER=Y | N species whether or not a border is drawn around the background area. The default value is N.
Used by: DS2CONST, DS2TREE
CATEXT=default-text-color species a default color for the text in the diagram, using an HTML 3.2 color name or a 6-digit hexadecimal RGB value. For DS2CONST, this argument is overridden by the FNTNAME= argument (see below) and the NTEXTCOL argument (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST, DS2TREE
CBACK=color species a background color for the Treeview Applet. The value must be a valid HTML 3.2 color name.
Used by: DS2TREE
CHANDLE=color species the color of the Collapse/Expand handle on the nodes. The handle is represented by a small plus sign (+) that is prexed to the label of the node when its subtree is collapsed. The value must be a valid HTML color name.
Used by: DS2TREE
CLINK=default-link-color species a default color for the links in the diagram, using an HTML 3.2 color name or a 6-digit RGB value. For DS2CONST, this argument is overridden by the LCOLOR= and LCOLVAL= arguments (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST, DS2TREE
CNODE=color species the node background color. The value must be a valid HTML color name. The value specied here can be overridden by specifying a value for the NCOLOR= argument.
Used by: DS2TREE
CNODE=default-node-color species a default background color for the nodes, using an HTML 3.2 color name or a 6-digit RGB value. This argument is overridden by the NCOLOR=, NCOLVAL=, NVALUE=, or NSCBACK= arguments (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST
COLORMAP=N | Y when the value is N (default), species that the Constellation Applet is to use the NCOLOR= and LCOLOR= arguments (see DS2TREE and DS2CONST Arguments for Data Denition on page 573) to determine node and link colors rather than using the color map.
Used by: DS2CONST
583
CSELECT=color species a color for nodes that are selected by the mouse or as the result of a node search. The value must be a valid HTML 3.2 color name.
Used by: DS2CONST, DS2TREE
CUTOFF=detail-percentage species the percentage of the nodes that will be displayed with node labels. After the percentage has been reached, nodes are drawn as rectangles. The size of those rectangles decreases as the distance from the starting node increases. Valid values range from 0.0 to 1.0 (The decimal value is mapped to a percentage from 0% to 100%). The default value is 0.5. See also the DEPTH argument. Used by: DS2CONST, DS2TREE DEPTH=max-path-length species a whole number greater than zero that determines the maximum number of links that are to be displayed in the node/link diagram. Paths whose lengths exceed the limit are truncated. This argument affects only the initial display of the diagram. Nodes that are initially hidden can become visible as a user selects nodes and navigates around the diagram. Note that this value is ignored if CUTOFF= 1.0. There is no default value for this argument.
Used by: DS2TREE
DRILTARG=target-window-or-frame species the HTML target or the name of the browser window or frame where drill-down URLs are displayed. The default behavior is to open a new browser window and reuse it for subsequent drill-down requests. Specically, the default value is _BLANK, which is one of several reserved names for targets in HTML. The value can also be the name of a window or frame in the Web presentation.
Used by: DS2CONST, DS2TREE
DUPCHECK=TRUE | FALSE species whether or not the applet will check for duplicate node IDs. The default value is FALSE. When set to TRUE, this argument will cause the applet to update an ID if a duplicate ID is found, instead of creating a new node with the same ID. This enables you to collect node information from different locations in the data set.
Used by: DS2TREE
FACTOR=sh-eye-distortion-factor species the distortion factor for the sh-eye lens. The distortion factor determines the amount that the central region of the display is to be expanded (or zoomed). The value specied must be greater than or equal to 1.0. The default value is 1.0, which represents the lowest amount of distortion. This argument is valid only when the value of the FISHEYE= argument is Y. The maximum effective value (beyond which no further distortion is visible) is variable depending upon the number of nodes in the diagram.
Used by: DS2TREE
FISHEYE=Y | N indicates whether or not the diagram is to be displayed with the sh-eye distortion, which displays the central region of the diagram at a specied size and displays the rest of the diagram as if it were mapped onto a ball, with the nodes and links disappearing over a curved horizon. The Web user can move the diagram past the central region by scrolling or searching for nodes. The amount of distortion used in the sh-eye lens is determined by the FACTOR= argument. The default value is Y.
Used by: DS2TREE
584
Chapter 26
FNTNAME=default-node-label-font species the default text font for node labels. Valid values can be SERIF, SANSSERIF, DIALOG, DIALOGINPUT, or MONOSPACED. This argument is overridden by the NFNTNAME or NSFNTNAM= arguments (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST, DS2TREE
FNTSIZE=node-font-size species the size of the node label text font, in points. This argument is overridden by the NFNTSIZE= argument.
Used by: DS2CONST, DS2TREE
FNTSTYL=node-font-style species the text font style for node labels. Valid values are BOLD, ITALIC, and PLAIN. PLAIN is the default value. This argument is overridden by the NFNTSTYL= argument.
Used by: DS2CONST, DS2TREE
IBACKLOC=image-URL species a URL for the image that you want to use in the background of the diagram. See also the IBACKPOS= argument.
Used by: DS2CONST, DS2TREE
IBACKPOS=CENTER | SCALE | TILE | POSITION species how to display the background image in the IBACKLOC= argument. Specify one of the following options: CENTER centers the image in the browser window without resizing the image. SCALE resizes the image to t the browser window. TILE lls the browser window by replicating the image at its original size. POSITION positions the image without resizing at the values specied by the IBACKX= and IBACKY= arguments.
Used by: DS2CONST, DS2TREE
IBACKURL=background-drilldown-URL species the URL that is displayed when you click on the background image. This argument is valid only when the value of the IBACKPOS= argument is POSITION. If you are including the Powered by SAS logo, then you must use this argument to link the image to the SAS Web site.
Used by: DS2CONST, DS2TREE
IBACKX=corner-coordinate IBACKY=corner-coordinate species the x (horizontal) and y (vertical) pixel coordinates of the upper left-hand corner of the background image. Positive values are measured from the upper-left corner of the background area. Negative values are measured from the lower-right corner of the background area. These values are valid only if the value of the IBACKPOS= argument is POSITION. Always specify both the IBACKX= and IBACKY= arguments.
Used by: DS2CONST, DS2TREE
585
NODEBDR=LINE | NONE | FILL | OUTLINE species the appearance of the node border line, using one of the following values: LINE show solid border lines around the nodes. NONE show no border lines or background. FILL show background but no border lines. OUTLINE show a border line and background. This is the default value.
Used by: DS2TREE
NODESHAP=shape species the shape of the nodes. Valid values can be CIRCLE, DIAMOND, NONE, SQUARE, or TRIANGLE. The default value is SQUARE. This argument is overridden by the NSHAPE= argument (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST
RBSIZING=Y | N the default value N indicates that size information from the resource bundle is not to be used for sizing the two dialog boxes that can be invoked from the pop-up menu that appears when a user right-mouse-clicks on a diagram. The two dialog boxes are the About dialog box and the Mouse Help dialog box. Specify Y for this argument for languages other than English.If you specify Y, then the height and the width of the dialog box frames are read in from the resource bundle. This allows translators to set appropriate heights and widths for the frames in the resource bundle, based on the length of the message strings in each language.
Used by: DS2CONST, DS2TREE
SCLNKWT=Y | N when the value is Y (default), species that the link weight values are to be scaled into the range of 01, which corresponds to 0100%. When SCLNKWT=Y, the scroll bar in Constellation Applet displays a percentage of the range of the link weights. When SCLNKWT=N, the link weights are not scaled and the scroll bar reects the actual link weight data values. These values are real numbers that are specied in the LVALUE= argument (see DS2TREE and DS2CONST Arguments for Data Denition on page 573). The SCLNKWT= argument is valid only when the value of the DATATYPE= argument is ASSOC. Note that the range of link weights (maximum minus minimum) must be greater than 2 when SCLNKWT=N. Otherwise, the scroll bar will not correctly map the link weights.
Used by: DS2CONST
SCLWIDTH=Y | N when the value is Y (default), indicates that the link width values are to be scaled into the range of 01. Specifying N indicates that the link widths are already scaled into that range. This argument is valid only when the value of the DATATYPE= argument is ASSOC. Used by: DS2CONST SCNSIZE=Y | N when the value is Y (default), indicates that the node size values are to be scaled into the range of 01. Specifying N indicates that the node sizes are already scaled
586
Chapter 26
into that range. This argument is valid only when the value of the DATATYPE= argument is ASSOC. Node sizes are specied with the NSIZE= argument (see DS2TREE and DS2CONST Arguments for Data Denition on page 573).
Used by: DS2CONST
SHOWLINKS=Y | N species whether initially to display all arc lines between nodes. Specifying N suppresses all arc lines. The default value is Y. Note: This argument affects only the initial display. A viewer can subsequently control which arc lines are displayed by right-mouse clicking and selecting a Show links option from the pop-up menu. 4
Used by: DS2CONST
SPREAD=angular-factor species the angular spreading factor for the layout of the diagram. The value specied must be greater than or equal to 1.0. The default value is 1.25.
Used by: DS2TREE
TIPS=Y | N indicates whether or not pop-up data tips are displayed when the cursor is positioned over nodes or links or both. The default value is Y.
Used by: DS2CONST, DS2TREE
TIPTYPE=TRACKING | STATIONARY when the value is TRACKING (default), indicates that the pop-up data tips windows are to move with the cursor while the cursor moves within the area of a single node or link.
Used by: DS2CONST
TREEDIR=C | D | L | R | U determines the growth direction of the node/link diagram using the following values. C | CIRCULAR grows the tree in a circular pattern. This is the default value. D | DOWN grows the tree from top to bottom using center alignment. L | LEFT grows the tree from left to right and top to bottom. R | RIGHT grows the tree from right to left and top to bottom. U | UP grows the tree from the bottom up using center alignment. If the value of the TREEDIR= argument is UP or DOWN, then the value of the TREESPAN= argument is used to set the angular width of the diagram. The starting node is aligned horizontally in the center of the applet. The diagram grows out of the starting node based on the angular width specied in the TREESPAN= argument. The wider the angle, the wider the layout of the diagram. The TREEDIR= argument overrides the ANGLE= argument.
Used by: DS2TREE
587
TREESPAN=angular-diagram-width species the angular width of the diagram in degrees. Valid values must be greater than zero and less than 360. The default value is 60. For details, see the TREEDIR= and ANGLE= arguments. Used by: DS2TREE ZOOM=starting-percentage species the zoom value that is used for the initial display of the diagram. After the initial display, the Web user can change the zoom percentage dragging the mouse up and down while pressing the Ctrl + left mouse button. Selecting the Refresh button on the browser runs the applet and restores the initial zoom setting. The default value is 100 percent. The initial diagram can be scaled up with a value greater than 100 or scaled down with a value less than 100. Used by: DS2CONST
588
Chapter 26
CENTER= Y | N species whether or not the graph or diagram is centered in the browser window. The default value is N.
Used by: DS2TREE, DS2CONST
CTEXT=default-text-color species a default text color that replaces the default text color in the browser. Other color arguments can be used to override this new default. The color can be specied as an HTML 3.2 color name or as a six-digit hexadecimal RGB value.
Used by: DS2TREE, DS2CONST
DOCTYPE=DOCTYPE-tag generates the following DOCTYPE tag by default, which species HTML version 3.2:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
To use a different DOCTYPE tag, specify the entire contents of the tag as the value of the DOCTYPE= argument, including the angle brackets. If you specify DOCTYPE="", then no DOCTYPE tag is generated in the HTML output le.
Used by: DS2TREE, DS2CONST
ENCODE=Y | N when the value is Y (default), replaces the angle bracket characters (< and >) in SAS TITLE and FOOTNOTE lines with the HTML character entities (> and <) respectively. Specifying ENCODE=N causes the browser to interpret the angle brackets as parts of HTML tags. For example, you would use ENCODE=N if you wanted to use the following TITLE statement:
title "<FONT COLOR="red">Out of Range Data</FONT>";
PAGEPART=ALL | HEAD | BODY | FOOT species which part or parts of the HTML page are to be written into the HTML output le. This argument is helpful when are appending HTML output to the end of an existing HTML le, or when you are using separate les for the head, body, and foot of your Web page. ALL writes the entire HTML le, including the XML tags for the DS2CONST and DS2TREE. This is the default value. Do not use this value if you are appending an existing HTML le. HEAD writes the HTML header information and or XML (for DS2CONST and DS2TREE) into the HTML le. The header information consists of the HEAD and BODY tags. HTML footer information is not included. BODY writes only the XML tags (for DS2CONST and DS2TREE) into the HTML output le. No head or foot information is generated in the HTML output le. FOOT writes metagraphics codes or XML tags and the </BODY> and </HTML> tags to conclude the HTML le.
Used by: DS2TREE, DS2CONST
589
SASPOWER=logo-image-le species the path or URL, relative or absolute, to the image le of the SAS Powered logo. In the HTML le, the image appears at the bottom of the page. Selecting the image displays the SAS home page. By default, the logo is omitted. To obtain the logo image le, see http://www2.sas.com/dispatcher/index.html. See also the SPCLASS= argument.
Used by: DS2TREE, DS2CONST
SEPCLASS=page-separator-stylesheet species the path or URL, relative or absolute, to the style sheet that is used for the page separator. If the value of the SEPTYPE= argument is RULE, then the value of the SEPCLASS= argument is used on the CLASS attribute of the HTML tag <HR>. If the value of the SEPTYPE= argument is IMAGE, then the value of SEPCLASS= argument is used on the CLASS attribute of the HTML tag <IMG>.
Used by: DS2TREE, DS2CONST
SEPLOC=separator-image species the path or URL, relative or absolute, to the image that you want to use as the separator between the graphs in your presentation. This argument is valid only if the value of the SEPTYPE= argument is IMAGE.
Used by: DS2TREE, DS2CONST
SEPTYPE= IMAGE | NONE | RULE species the type of separator that is used between multiple applets in your presentation. The valid values are dened as follows: IMAGE species separate graphs using the image specied in the SEPLOC= argument. NONE species not to use a separator between applets. RULE inserts a line between applets. This is the default.
Used by: DS2TREE, DS2CONST
SPCLASS=logo-stylesheet-name species the name of the style sheet class that is to be used for the Powered by SAS logo.
Used by: DS2TREE, DS2CONST
Use these arguments when you do not want to enter your style information directly into your HTML le when you create that le. Other arguments embed the style information into the header of the HTML le. Use these arguments when you want to collect style information from multiple style sheets. The end result must create a complete STYLE tag in your HTML le.
590
Chapter 26
You can combine LINK tag arguments with arguments that embed style information, but you cannot use the same ordinal number in two arguments. For example, you can specify the arguments SSHREF1= and SSFILE2=, but you cannot specify SSHREF1= and SSFILE1=. The following arguments link to two different style sheets and include text comments for each stylesheet.
ssfile1=comments1.txt, sshref2=/style/style1.css, sstype2=text/css, ssrel2=stylesheet, ssfile3=comments2.txt, sshref4=/style/style2.css, sstype4=text/css, ssrel4=stylesheet, /* embeds text */ /* links to stylesheet */ /* parameters for style sheets */ /* embeds text /* link to stylesheets */ */
SSFILE1SSFILE5=le-specication embeds in the HTML le the entire contents of the specied le.
Used by: DS2TREE, DS2CONST
SSFREF1SSFREF5=leref embeds in the HTML le the entire contents of the le that is referenced by the SAS leref.
Used by: DS2TREE, DS2CONST
SSHREF1SSHREF5=style-sheet-URL species the URL of the stylesheet in the HREF= attribute of the LINK tag. If you specify a relative URL, it must be relative to the location of the HTML output le.
Used by: DS2TREE, DS2CONST
SSMEDIA15=media species the media for which the style sheet was designed. The value is applied to the MEDIA= attribute of the LINK tag. The default value is SCREEN. Examples of other valid MEDIA values include BRAILLE for tactile feedback devices, and HANDHELD for small-screen devices.
Used by: DS2TREE, DS2CONST
SSREL15=relationship species the REL= attribute of the LINK tag, which describes the relationship from the linked le to the HTML le. The value of this tag is generally STYLESHEET. The arguments SSREL15= can also be used with the arguments SSREV15 to link HTML pages in a series. For example, the SSREL1= argument can specify the next document in the series, and the SSREV2= argument can specify the reverse relationship, which would be the previous document in the series. Both arguments, SSRELn= and SSREVn=, can appear in the same LINK tag.
Used by: DS2TREE, DS2CONST
SSREV15=relationship species the REV= attribute of the LINK tag, which describes the relationship from the HTML le to the linked le. See the SSREL15= argument for details.
Used by: DS2TREE, DS2CONST
SSTITLE15=title-of-linked-page species the TITLE= attribute of the LINK tag. The TITLE= attribute provides a title for the referenced page. Use this argument when you are using the SSRELn= and SSREVn= arguments to specify next and previous links in a series of Web pages.
591
SSTYPE15=stylesheet-type species the TYPE= attribute of the LINK tag. For cascading style sheets, this value usually is TEXT/CSS. For JavaScript style sheets, this value is generally TEXT/JAVASCRIPT. Used by: DS2TREE, DS2CONST
For each possible value of the TTAG= and FTAG= arguments, the following table shows the HTML tags that are generated by the macro for the SAS TITLE and FOOTNOTE lines (the corresponding end tags are generated automatically):
TTAG or FTAG Value NO FORMATTING STRONG EMPHASIS HTML Tag or Tags Enclosing the SAS TITLE or SAS FOOTNOTE (none) <STRONG> <EM>
592
Chapter 26
TTAG or FTAG Value HEADER 1 HEADER 2 HEADER 3 HEADER 4 HEADER 5 HEADER 6 PREFORMATTED TEXT CITATION TEXT COMPUTER CODE TEXT KEYBOARD INPUT TEXT LITERAL TEXT VARIABLE TEXT BOLD ITALICIZED TEXT UNDERLINE TEXT TYPEWRITER BIG TEXT SMALL TEXT STRIKE OUT TEXT DEFINING INSTANCE TEXT PREFORMATTED + STRONG PREFORMATTED + EMPHASIS PREFORMATTED + HEADER 1 PREFORMATTED + HEADER 2 PREFORMATTED + HEADER 3 PREFORMATTED + HEADER 4 PREFORMATTED + HEADER 5 PREFORMATTED + HEADER 6 PREFORMATTED + CITATION PREFORMATTED + COMPUTER CODE PREFORMATTED + KEYBOARD INPUT PREFORMATTED + LITERAL PREFORMATTED + VARIABLE PREFORMATTED + BOLD PREFORMATTED + ITALICIZED
HTML Tag or Tags Enclosing the SAS TITLE or SAS FOOTNOTE <H1> <H2> <H3> <H4> <H5> <H6> <PRE> <CITE> <CODE> <KBD> <SAMP> <VAR> <B> <I> <U> <TT> <BIG> <SMALL> <STRIKE> <DFN> <PRE><STRONG> <PRE><EM> <PRE><H1> <PRE><H2> <PRE><H3> <PRE><H4> <PRE><H5> <PRE><H6> <PRE><CITE> <PRE><CODE> <PRE><KBD> <PRE><SAMP> <PRE><VAR> <PRE><B> <PRE><I>
593
TTAG or FTAG Value PREFORMATTED + TYPEWRITER PREFORMATTED + UNDERLINE PREFORMATTED + BIG PREFORMATTED + SMALL PREFORMATTED + STRIKE OUT PREFORMATTED + DEFINING INSTANCE STRONG + EMPHASIS STRONG + ITALICIZED STRONG + CITATION STRONG + COMPUTER CODE STRONG + KEYBOARD INPUT STRONG + LITERAL STRONG + VARIABLE STRONG + TYPEWRITER STRONG + BIG STRONG + SMALL EMPHASIS + CITATION EMPHASIS + COMPUTER CODE EMPHASIS + KEYBOARD INPUT EMPHASIS + LITERAL EMPHASIS + VARIABLE EMPHASIS + TYPEWRITER EMPHASIS + BIG EMPHASIS + SMALL BOLD + EMPHASIS BOLD + ITALICIZED BOLD + CITATION BOLD + COMPUTER CODE BOLD + KEYBOARD INPUT BOLD + LITERAL BOLD + VARIABLE BOLD + TYPEWRITER BOLD + BIG BOLD + SMALL ITALICIZED + CITATION ITALICIZED + COMPUTER CODE
HTML Tag or Tags Enclosing the SAS TITLE or SAS FOOTNOTE <PRE><TT> <PRE><U> <PRE><BIG> <PRE><SMALL> <PRE><STRIKE> <PRE><DFN> <STRONG><EM> <STRONG><I> <STRONG><CITE> <STRONG><CODE> <STRONG><KBD> <STRONG><SAMP> <STRONG><VAR> <STRONG><TT> <STRONG><BIG> <STRONG><SMALL> <EM><CITE> <EM><CODE> <EM><KBD> <EM><SAMP> <EM><VAR> <EM><TT> <EM><BIG> <EM><SMALL> <B><EM> <B><I> <B><CITE> <B><CODE> <B><KBD> <B><SAMP> <B><VAR> <B><TT> <B><BIG> <B><SMALL> <I><CITE> <I><CODE>
594
Chapter 26
TTAG or FTAG Value ITALICIZED + KEYBOARD INPUT ITALICIZED + LITERAL ITALICIZED + VARIABLE ITALICIZED + TYPEWRITER ITALICIZED + BIG ITALICIZED + SMALL STRONG + EMPHASIS + BIG STRONG + CITATION + BIG STRONG + COMPUTER CODE + BIG STRONG + KEYBOARD INPUT + BIG STRONG + LITERAL + BIG STRONG + VARIABLE + BIG STRONG + TYPEWRITER + BIG EMPHASIS + CITATION + BIG EMPHASIS + COMPUTER CODE + BIG EMPHASIS + KEYBOARD INPUT + BIG EMPHASIS + LITERAL + BIG EMPHASIS + VARIABLE + BIG EMPHASIS + TYPEWRITER + BIG BOLD + EMPHASIS + BIG BOLD + ITALICIZED + BIG BOLD + CITATION + BIG BOLD + COMPUTER CODE + BIG BOLD + KEYBOARD INPUT + BIG BOLD + LITERAL + BIG BOLD + VARIABLE + BIG BOLD + TYPEWRITER + BIG ITALICIZED + CITATION + BIG ITALICIZED + COMPUTER CODE + BIG ITALICIZED + KEYBOARD INPUT + BIG ITALICIZED + LITERAL + BIG ITALICIZED + VARIABLE + BIG ITALICIZED + TYPEWRITER + BIG STRONG + EMPHASIS + SMALL
HTML Tag or Tags Enclosing the SAS TITLE or SAS FOOTNOTE <I><KBD> <I><SAMP> <I><VAR> <I><TT> <I><BIG> <I><SMALL> <STRONG><EM><BIG> <STRONG><CITE><BIG> <STRONG><CODE><BIG> <STRONG><KBD><BIG> <STRONG><SAMP><BIG> <STRONG><VAR><BIG> <STRONG><TT><BIG> <EM><CITE><BIG> <EM><CODE><BIG> <EM><KBD><BIG> <EM><SAMP><BIG> <EM><VAR><BIG> <EM><TT><BIG> <BOLD><EM><BIG> <BOLD><I><BIG> <BOLD><CITE><BIG> <BOLD><CODE><BIG> <BOLD><KBD><BIG> <BOLD><SAMP><BIG> <BOLD><VAR><BIG> <BOLD><TT><BIG> <I><CITE><BIG> <I><CODE><BIG> <I><KBD><BIG> <I><SAMP><BIG> <I><VAR><BIG> <I><TT><BIG> <STRONG><EM><SMALL>
595
TTAG or FTAG Value STRONG + ITALICIZED + SMALL STRONG + CITATION + SMALL STRONG + COMPUTER CODE + SMALL STRONG + LITERAL + SMALL STRONG + VARIABLE + SMALL STRONG + TYPEWRITER + SMALL EMPHASIS + CITATION + SMALL EMPHASIS + COMPUTER CODE + SMALL EMPHASIS + KEYBOARD INPUT + SMALL EMPHASIS + LITERAL + SMALL EMPHASIS + TYPEWRITER + SMALL BOLD + EMPHASIS + SMALL BOLD + ITALICIZED + SMALL BOLD + CITATION + SMALL BOLD + COMPUTER CODE + SMALL BOLD + KEYBOARD INPUT + SMALL BOLD + LITERAL + SMALL BOLD + VARIABLE + SMALL BOLD + TYPEWRITER + SMALL ITALICIZED + CITATION + SMALL ITALICIZED + COMPUTER CODE + SMALL ITALICIZED + KEYBOARD INPUT + SMALL ITALICIZED + LITERAL + SMALL ITALICIZED + VARIABLE + SMALL ITALICIZED + TYPEWRITER + SMALL
HTML Tag or Tags Enclosing the SAS TITLE or SAS FOOTNOTE <STRONG><I><SMALL> <STRONG><CITE><SMALL> <STRONG><CODE><SMALL> <STRONG><SAMP><SMALL> <STRONG><VAR><SMALL> <STRONG><TT><SMALL> <EM><CITE><SMALL> <EM><CODE><SMALL> <EM><KBD><SMALL> <EM><SAMP><SMALL> <EM><TT><SMALL> <BOLD><EM><SMALL> <BOLD><I><SMALL> <BOLD><CITE><SMALL> <BOLD><CODE><SMALL> <BOLD><KBD><SMALL> <BOLD><SAMP><SMALL> <BOLD><VAR><SMALL> <BOLD><TT><SMALL> <I><CITE><SMALL> <I><CODE><SMALL> <I><KBD><SMALL> <I><SAMP><SMALL> <I><VAR><SMALL> <I><TT><SMALL>
596
Reserved Names
Chapter 26
CHARSET=char-set-name species the character set name that will be written into the META tag of the HTML output le. For information on available character set names, see http://www.iana.org/assignments/character-sets.
Used by: DS2TREE, DS2CONST, META2HTM
TRANLIST=transcoding-list-name species the name and location of an existing transcoding list, either user-dened or from SAS. The transcoding list name must be a four-level name, and the fourth level must be SLIST, as in the following example:
TRANLIST=SASHELP.HTMLGEN.IDENTITY.SLIST
This argument is required if you are implementing character transcoding. SAS provides a number of transcoding lists in the SASHELP.HTMLNLS catalog. For a description of these transcoding lists, and for information on generating your own transcoding lists, see the SAS Web site at http://support.sas.com/rnd/web/intrnet/format/lang2.html.
Used by: DS2TREE, DS2CONST, META2HTM
Reserved Names
Do not use the following names as the value of a macro variable: Libnames and Filerefs HTML CATENT HTMSS Global Macro Variables _htmovp _htmcap _htmtitl _htmwher Data Sets or Views WORK._BYGRP Catalogs WORK._HTMLG_ SASHELP.HTMLNLS Catalog Entries SASHELP.HTMLGEN.DSPROP.SLIST SASHELP.HTMLGEN.IDENTITY.SLIST SASHELP.HTMLGEN.OUTPROP.SLIST SASHELP.HTMLGEN.TABPROP.SLIST SASHELP.HTMLGEN.TAGS.SLIST
597
CHAPTER
27
Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality
Overview of Enhancing Web Presentations 598 Chart Descriptions for Web Presentations 598 What Is a Chart Description? 598 Example: Adding Custom Chart Descriptions 599 Chart Descriptions in GIF, JPG, PNG, ACTXIMG, and JAVAIMG Presentations 599 Chart Descriptions in SVG, SVGT, SVGView, and SVGZ Presentations 600 Data Tips for Web Presentations 600 What Is a Data Tip? 600 Adding Custom Data Tips with the HTML= Option 600 Data Tips in GIF, JPEG, PNG, JAVAMETA, SVG, SVGT, SVGView, and SVGZ Presentations Data Tips in ACTIVEX, ACTXIMG, JAVA, and JAVAIMG Presentations 602 Adding Links with the HTML= and HTML_LEGEND= Options 603 Working with Link and Enhancement Variables 603 Assigning Values to Link and Enhancement Variables 603 Links in GIF, JPEG, PNG, and SVG Presentations 606 Links in ACTXIMG and JAVAIMG Presentations 606 Links in ACTIVEX Presentations 607 Links in JAVA Presentations 607 Links in Metaview Applet Presentations 610 Links in Animated GIF Presentations 610 Controlling Drill-Down Behavior For ActiveX and Java Using Parameters 610 Using Drill-Down Tags 610 Specifying the Drill-Down Mode 611 Understanding Variable Roles 612 Removing Blank Spaces from Data Values In Substitution Strings 613 Using Variables as Substitution Strings 614 Conguring HTML Drill-Down Mode 615 Specifying Graphs For Each Drill-Down Level 615 Conguring the Drill-Down Response In HTML and URL Modes 617 Conguring Script Drill-Down Mode 618 Working With The Array Of Elements 618 Implementing Script Drill-Down Mode 619 Formatting Data Values in Script Drill-Down Mode 620 Disabling Drill-Down Functionality 620 Example: Creating Bar Charts with Drill-Down for the Web 620 Example Part A 623 Example Part B 628 Example Part C 630 Example Part D 632
602
598
Chapter 27
Table 27.1
Device GIF JPEG PNG SVG family ACTIVEX JAVA ACTXIMG JAVAIMG X X X X X X
599
Figure 27.1
600
Chapter 27
For output generated with the GIF, JPG, PNG, ACTXIMG, and JAVAIMG device drivers, using the ALTDESC graphics option displays the chart description, and is set by default. The NOALTDESC graphics option suppresses the display of the chart description. Specifying DESCRIPTION= provides content to the ALT attribute of your HTML le and replaces the default chart description content. The description value is limited to 256 characters. Chart descriptions are not supported in presentations generated by the ActiveX, Java, and JAVAMETA device drivers. Note: DESCRIPTION=" " can also be used to suppress the chart description.
. 3 Add HTML=data-tip-variable to your procedures statement. The example below species HTML=RPT. When the user positions the mouse pointer over a data element, the browser displays the data tip. The following example generates the data tips North Carolina and Massachusets and California and Oregon.
601
/* Create the temporary data set named sales. */ data sales; length Region $ 4 State $ 2; format Sales dollar8.; input Region State Sales Year Qtr; datalines; West CA 13636 1999 1 West OR 18988 1999 1 West CA 14523 1999 2 West OR 18988 1999 2 East MA 18038 1999 1 East NC 13611 1999 1 East MA 11084 1999 2 East NC 19660 1999 2 West CA 12536 1998 1 West OR 17888 1998 1 West CA 15623 1998 2 West OR 17963 1998 2 East NC 17638 1998 1 East MA 12811 1998 1 East NC 12184 1998 2 East MA 12760 1998 2 ; /* Use an IF statement to assign values to the variable rpt. */ data; set data; if state in ("NC" "MA") then RPT="alt=North Carolina and Massachusets"; if state in ("CA" "OR") then RPT="alt=California and Oregon"; run; /* /* /* /* Close the LISTING destination to conserve resources. Open the HTML destination and create the bar chart. Add the HTML= option to associate custom data tips with each graph element. */ */ */ */
goptions reset=all; ods listing close; ods html file="datatips.htm"; title "Company Sales, Mid Year"; proc gchart data=sales; vbar region / sumvar=sales group=year html=RPT; run; quit; ods html close; ods listing;
602
Data Tips in GIF, JPEG, PNG, JAVAMETA, SVG, SVGT, SVGView, and SVGZ Presentations
Chapter 27
Figure 27.2
Data Tips in GIF, JPEG, PNG, JAVAMETA, SVG, SVGT, SVGView, and SVGZ Presentations
For output generated with the GIF, JPEG, PNG, JAVAMETA, and SVG, SVGT, SVGView, and SVGZ device drivers, data tips are not generated by default. Custom data tips can be implemented for the output of any SAS/GRAPH procedure that supports the HTML= option. For procedures that support the HTML= option, refer to the individual procedure chapter. For more information, see Adding Custom Data Tips with the HTML= Option on page 600.
Custom data tips can be implemented for the output of any SAS/GRAPH procedure that supports the HTML= option. For procedures that support the HTML= option, refer to the individual procedure chapter. For more information, see Adding Custom Data Tips with the HTML= Option on page 600. Note: Terminals set to use 16-bit colors or 32-bit colors are not supported when specifying data tips for output generated using DEVICE=ACTXIMG 4
603
3 JAVAMETA
In these Web presentations, the HTML= and HTML_LEGEND= options identify a variable that provides URLs for drill-down links. This variable is referred to as a link variable. The HTML= option and HTML_LEGEND= options are also used to implement enhancements that run in the Metaview applet. In this case, the variables that are identied by the HTML= and HTML_LEGEND= options are referred to as enhancement variables because they do more than establish links.
Be sure to dene your link variable with a length that will be sufcient to contain your URLs (plus the HREF= option). There is no limit on the length of the variable. The values of the link variable use the following syntax:
"HREF=URL<#anchor name>"
604
Chapter 27
Figure 27.3
Each bar in the chart links to an anchor tag in an HTML le named reports.html. The anchor names in the linked le are Central, South, and West. The following DATA step the IF/ THEN statement to assign values to the the link variable.
/* create data set REGSALES */ data regsales; length Region State $ 8; format Sales dollar8.; input Region State Sales; length rpt $80; /* the link dest. variable */ datalines; West CA 13636 West OR 18988 West WA 14523 Central IL 18038 Central IN 13611 Central OH 11084 Central MI 19660 South FL 14541 South GA 19022 ; /* assign HREF values to link dest. variable */ data regsales; set regsales; if Region="Central" then rpt="HREF=reports.htm#central"; else if Region="South" then rpt="HREF=reports.htm#south"; else if Region="West" then rpt="HREF=reports.htm#west"; run; goptions reset=all device=ActiveX; ods listing close; ods html file="sales.htm";
605
/* create chart that uses link targets */ title "Regional Sales"; proc gchart data=regsales; vbar region / sumvar=sales html=rpt; run; /* create the link targets */ ods html file="reports.htm" anchor="south"; title "Southern Sales"; proc gchart data=regsales; where region="South"; vbar state /sumvar=sales; run; ods html anchor="central"; title "Central Sales"; proc gchart data=regsales; where region="Central"; vbar state /sumvar=sales; run; ods html anchor="west"; title "Western Sales"; proc gchart data=regsales; where region="West"; vbar state /sumvar=sales; run; quit; ods html close; ods listing;
606
Chapter 27
Display 27.1
You could use variable substitution to simplify the DATA step. The URLs used in the preceding program all use the same HTML le name, but the anchor differs depending on the value of the Region variable. You can concatenate the value of the Region variable to the common HTML le name to generate the drill-down URLs.
data regsales; set regsales; rpt="HREF=reports.htm#"||Region||""; run;
3 Use both the HTML= option and the HTML_LEGEND= option with a
SAS/GRAPH procedure to add drill-down functionality to the legend entries.
607
The initial graph displayed by this example is shown in the example below. In this graph, REGION is the independent variable, and SALES is the dependent variable. 3 SALES is the dependent variable. 3 REGION is the independent variable. 3 STATE is the subgroup variable.
608
Chapter 27
Figure 27.4
Clicking the bar segment labeled East generates the graph shown in Figure 27.5 on page 609. The Level 2 drill-down graph retains the dependent variable SALES. The group variable YEAR is promoted to the independent variable role. The drill-down action creates one bar segment for each unique value of YEAR. 3 SALES is the dependent variable. 3 YEAR is the independent variable.
609
Figure 27.5
Clicking the bar segment labeled 1998 generates the graph shown in Figure 27.6 on page 609. The Level 3 drill-down graph retains the dependent variable SALES. The subgroup variable STATE is promoted to the independent variable role. STATE is the last variable that can appear as an independent variable. The drill-down action creates one bar segment for each unique value of STATE. 3 SALES is the dependent variable. 3 STATE is the independent variable.
Figure 27.6
610
Chapter 27
See Chapter 19, Attributes and Parameters for Java and ActiveX, on page 487 for a detailed description of the parameter tags and attributes that are available for use with ActiveX and Java.
Description Use new colors for the graph elements Use the color variable from the preceding level Use a new dependent variable Use the dependent variable from the previous level
Denition of the Value That Follows the Tag Name of the new color variable None Name of the new dependent variable None
611
Description Use a new depth variable Use the depth variable that was used in the previous level Use a new group variable Use the group variable that was used in the previous level Use a new independent variable Use the independent variable that was used in the previous level Use a new label Use the same label that was used in the previous level Use a new subgroup variable Use the same subgroup variable that was used in the previous level
Denition of the Value That Follows the Tag Name of the new depth variable None
Applied in Vertical bar charts and scatter plots Vertical bar charts and scatter plots Bar charts Bar charts
G_GROUP G_GROUPV
G_INDEP G_INDEPV
G_LABEL G_LABELV
Maps Maps
G_SUBGR G_SUBGRV
Bar charts and scatter plots Bar charts and scatter plots
When you specify a variable name after a tag, that name must be specied exactly the way it appears in the data set, because variable names are case-sensitive in JavaScript. To nd out how a variable was dened in the data set, use the CONTENTS procedure.
612
Chapter 27
variable roles, and colors. Local is the default drill-down mode for the Graph applet. Featured in: Local Drill-Down Mode with Java on page 477. Restriction: Supported by the Graph applet only. See also: Links in JAVA Presentations on page 607. Script mode calls a JavaScript method that you specify in your SAS/GRAPH program. You provide the JavaScript that responds to the selected area. The data passed to the JavaScript method determines the graphic portion selected, and the appropriate action. Featured in: Script Drill-Down Mode with Java on page 479, Providing JavaScript Drill-Down with ActiveX on page 466, and Providing More JavaScript Drill-Down with ActiveX on page 468. Restriction: Supported by the Map applet and ActiveX control only. See also: Conguring Script Drill-Down Mode on page 618. URL mode displays URLs that are provided by the HTML= variable. The URLs identify HTML les. Featured in: URL Drill-Down Mode with Java on page 481. See also: DRILLDOWNMODE=HTML in Parameter Denitions on page 493. Restriction: If the graphics procedure that generates the graph species the HTML= option, then the value of the DRILLDOWNMODE parameter is automatically set to URL. All modes specied in ODS are overridden. HTML mode generates drill-down URLs based on a substitution pattern that you specify in your SAS/GRAPH program. The ActiveX control, the Graph applet, and the Map applet complete the URL by inserting the specied data from the selected graph element.
ods html file=statepop.htm parameters=("DRILLDOWNMODE"="HTML" "DRILLPATTERN"="http://www.state.{&statename}.us");
The data set variable value STATENAME completes the drill-down URL. Featured in: HTML Drill-Down Mode on page 484. See also: Adding Links with the HTML= and HTML_LEGEND= Options on page 603. Note: Dene the variable with the partial URL when creating the graphic. 4 Any mode attempts to implement the four drill-down modes in succession until a valid Web destination is found. The order is Local (Graph applet only), Script, URL, and HTML. Restriction: Supported by Graph applet and ActiveX control only. See: Specifying Parameters and Attributes for Java and ActiveX on page 487 for a complete list of ODS parameters.
613
and another is always assigned the role of dependent variable. Once the initial graph has been displayed in the applet or control, Web users can change the variable roles using menu options. Variable roles are used to congure the Local, HTML, and Script drill-down modes. The roles are assigned with parameters, using the PARAMETERS= option in the ODS statement. In the specication of a parameter, the assignment of roles is done with drill-down tags.
614
Chapter 27
NONE is the default value. Any blank spaces in the data value are inserted into the substitution string. YES removes all blank spaces from the end of the data value, but retains blank spaces elsewhere. COMPRESS removes all blank spaces from the data value, wherever they occur.
The substitution string above could be used in a Web presentation that begins with a map of the United States. In response to a drill-down action in HTML mode, the value of the STATENAME variable for the selected state would be substituted into the URL. The resulting URL would point to a Web page that contains a table of population information for the selected state. In the HTML drill-down mode, you can specify variable roles or labels as substitution strings, using drill-down tags, as described in Understanding Variable Roles on page 612. The syntax of these substitution strings is as follows: {&drill-down-tag} where drill-down-tag species a variable role or label in the initial graph. The applet or control replaces the substitution string by deriving a variable name from the role or label, and applying the value of that variable to the URL. The value is taken from the data that is associated with the selected graph element. For example, a Web presentation could be congured using this URL:
http://ourweb.com/regstaff/{&G_INDEPV}/stafflist.htm.
When a Web user selects a data element with the independent variable REGION, if the value of REGION is East, the applet displays this URL:
http://ourweb.com/regstaff/East/stafflist.htm.
The URL that is created points to an HTML le that is in the same directory as the top level HTML le. The name of the le is a concatenation of formatted values for the rst independent, group, and subgroup variables that are dened in the data set. See URL Drill-Down Mode with Java on page 481 for more information.
615
In this example, the value of the data set variable STATENAME completes the drill-down URL. When ODS is congured as shown above, the applet or control dynamically generates URLs in response to drill-down actions. The applet or control replaces the substitution strings with data values from the graph element that was selected in the drill-down action. The URL-with-substitution-strings can include multiple substitution strings. Substitution strings can include combinations of variable names, variable roles or labels, and drill-down tags. For details, see Using Variables as Substitution Strings on page 614. All substitution strings are enclosed in curly brackets ( { and } ) and begin with an ampersand character (&). When you specify a variable name as a substitution string in drill-down mode, the applet or control replaces the string with the variable value.
616
Chapter 27
3 species the color of the data elements. 3 names the variable to subset, to create the next graph.
The syntax of the string argument is as follows: {CHART} {chart_type} {tag_1} {variable_1...} {...tag_n} {variable_n} | {subset_tag_1...} <{...subset_tag_n}> {CHART} {chart_type} identies the type or style of the graph. This tag is case sensitive: it must always be specied in uppercase. The values of the tag (chart types) are not case sensitive. To use the same chart type as the preceding drill-down level, do not specify the CHART tag. Available chart types are as follows: HBAR generates a two-dimensional horizontal bar chart. HBAR3D generates a three-dimensional horizontal bar chart. VBAR generates a two-dimensional vertical bar chart. VBAR3D generates a three-dimensional vertical bar chart. PIE generates a two-dimensional pie chart. PIE3D generates a three-dimensional pie chart. SCATTER generates a scatter plot that is similar in appearance to the plot shown in Example 4 on page 1555. LINE generates a line or needle plot that is similar in appearance to Figure 14.17 on page 259. BOX generates a box plot that is similar in appearance to Figure 14.15 on page 255. HILO generates a high-low chart that is similar in appearance to Figure 14.16 on page 257. {tag_1} {variable_1...} {...tag_n} {variable_n} associates drill-down tags with data set variables, to specify roles for variables in the new graph, and to determine the color of the elements in the new graph (optional). For denitions of the drill-down tags, see Table 19.1 on page 490. {subset_tag_1...} <{...subset_tag_n}> species one or more variable roles from the original graph whose values are used to subset the data in the preceding graph. If you specify G_GROUPV, then the data that is used to draw the new graph, is only the data that is associated with the group variable in the preceding graph. If the group variable in the preceding graph is REGION, and the data element labeled East is selected, only observations where REGION=EAST are represented in the next graph. At least one of the following tags must be specied as the subset variable: G_INDEPV, G_GROUPV, G_SUBGRV, or G_DEPTHV. For denitions of these tags, see Table 19.1 on page 490.
617
Specifying multiple subset variables means that two or more values must match the value in the selected graph element for that observation to be used in the new graph. For example, assuming that you specify {G_INDEPV}{G_SUBGRV} as the subset variables, and that the selected graph element has an independent variable of YEAR and a subgroup variable of STATE. Also assume that the values for these variables in the selected graph element were 2000 and NC. The observations that would be used in the drill-down graph would include those with YEAR=2000 and STATE=NC. The following example shows how the DDLEVENn parameter can be used to specify the default behavior for the rst drill-down level.
ods html file=odsout parameters=("drilldownmode"="local" "ddlevel1"="{chart}{vbar3d} {g_dep}{sales} {g_indep}{year} | {g_indepv}" );
As the example shows, the value of the DDLEVELn parameter is divided into two halves, which are separated by a vertical bar character. The drill-down graph is congured in the syntax that appears before the vertical bar character ( | ). After the vertical bar, drill-down tags specify how the data from the previous drill-down level is to be subset for use in the current drill-down graph. The rst drill-down level (DDLEVEL1) is congured as a three-dimensional vertical bar chart. The dependent variable is SALES and the independent variable is YEAR. The G_INDEPV tag species that the data is to be based on the values of the independent variable. In our example the independent variable in the initial graph is REGION. If the Web user selects a graph element that describes the WEST region, the graph has only observations where the value of REGION is WEST. If you do not specify a role for a variable, then that variable does not appear in the drill-down graph. If you do not specify variables for the G_DEP and G_INDEP tags, then the Graph applet uses the independent and dependent variables of the graph in the preceding drill-down level. You can explicitly remove a variable role from the drill-down graph by specifying a $ character as the drill-down value, as in the following code:
{G_GROUP} {$}
Web users can make this change in the Graph applet menus by selecting the None option from the list of variables that can be applied to a given variable role. Note: Note that you cannot assign a $ to the G_INDEP and G_DEP variables, because they must always be present in the drill-down graph. 4
618
Chapter 27
_BLANK displays the drill-down graph in a newly opened, unnamed browser window. _SELF displays the drill-down graph in the same frame or window as the initial graph. This is the default behavior in most browsers. _PARENT displays the drill-down graph in the parent frame in a frame set. If no frames are dened, this value is the same as _SELF. _TOP displays the drill-down graph in the full browser window, thereby replacing any frames that were dened in that window. any_named_target displays the drill-down graph in the appropriately named frame or browser window.
619
drill-down tags. The tags identify variable roles or labels and values. For details, see Using Drill-Down Tags on page 610 and Understanding Variable Roles on page 612. The rst element in the array of arguments is the name of the applet or control. The second element in the array is the name of a le. The name of that le is derived from the variable roles in the graph at the preceding drill-down level, using the following substitution string:
{&G_INDEPV,f} {&G_GROUPV,f} {&G_SUBGRV,f}.html
The lename is a concatenation of the formatted values of the independent, group, and subgroup variables in the graph at the preceding drill-down level. Note: The lename and le type are provided as a convenience. If you use this lename and le type, then you must create the actual le and provide its content.
The remaining elements in the array consist of drill-down tags, and the data that is associated with those tags in the graph element that was selected in the drill-down action. Each variable is represented by triplet pairs of arguments in the array: tag variable_name tagV variable_value tagV,F formatted_value For example assume that each graph data element selected is represented by six arguments in the array. The graph shown in Script Drill-Down Mode with Java on page 479 is congured for Script drill-down mode. Selecting the east region sales gures for the state of North Carolina generates the following array:
[appletName East1998NC.html G_DEP Sales G_DEPV 10000 G_DEPV,F $10,000 G_INDEP Region G_INDEPV East G_INDEPV,F East G_GROUP Year G_GROUPV 1998 G_GROUPV,F 1998 G_SUBGR State G_SUBGRV NC G_SUBGRV,F NC]
The output lename is East1998NC.html. The remaining triplet pairs capture the roles, and values of the variables that make up the selected data element. All variable names are case sensitive as they appear in the array. For example, the value Region is capitalized. This is the case only if the variable name is dened as Region in the DATA step.
620
Chapter 27
The format is applied using the FORMAT statement in the DATA step or graphics procedure that generated the data for the graph. Formatted values are specied in the statement that generated the original graph. Formatted values are used for axis labels, legends, and data tips that are displayed when the mouse is positioned over a graph data element.
621
Procedure Features: VBAR3D statement ODS HTML options: ANCHOR= BODY= CONTENTS= FRAME= NEWFILE NOGTITLE PATH= Other Features: AXIS statement BY statement FORMAT statement GOPTIONS statement option: BORDER LEGEND statement RUN-group processing TITLE statement WHERE statement Sample library member: GCHDDOWN The program generates twelve linked bar charts that display data about the worlds leading grain producers. The data contain the amount of grain produced by ve countries in 1995 and 1996. Each of these countries is one of the three leading producers of wheat, rice, or corn, worldwide. The rst chart, shown in Figure 27.7 on page 621 as it appears in a browser, is an overview of the data that shows the total grain production for the ve countries for both years.
Figure 27.7
622
Chapter 27
The next two charts break down grain production by year. These charts are linked to the legend values in Figure 27.7 on page 621. For example, when you select the legend value for 1995, the graph in Figure 27.8 on page 622 appears.
Figure 27.8
Another group of charts breaks down the data by country. These charts are linked to the bars. For example, when you drill down on the bar for China in either Figure 27.7 on page 621 or Figure 27.8 on page 622, the graph in Figure 27.9 on page 622 appears.
Figure 27.9
Finally the data is charted by grain type. These graphs are linked to the bars in Figure 27.9 on page 622. If you select the legend value or bar for Rice, Figure 27.10 on page 623 appears.
Example Part A
623
Figure 27.10
3 Example Part A on page 623 generates the graph shown in Figure 27.7 on page
621.
3 Example Part B on page 628 generates the pair of graphs represented by Figure
27.8 on page 622.
3 Example Part D on page 632 generates the three graphs represented by Figure
27.10 on page 623.
Example Part A
VBAR3D options: DES= DISCRETE GROUP= GSPACE= HTML= HTML_LEGEND= NAME= SUBGROUP= ODS HTML options: BODY= CONTENTS= FRAME= GPATH= NOGTITLE
624
Example Part A
Chapter 27
The rst part of the program, which includes setting the graphics environment and creating the data set, does the following: 3 Adds three HTML variables to the data set. The variables contain the link targets for all of the graphs that support drill-down functionality. The HREF values for the HTML variables in the data set contain this information about the link targets: 3 the name of the body le that is the target. BODY= in the ODS HTML statement names the body le. 3 the anchor name of the output if the target le contains more than one graph. By default, all output is assigned a unique anchor name unless you specify a name with ANCHOR= in the ODS HTML statement.
3 Opens the HTML destination for the frame and contents les and the rst body le. 3 Creates one grouped 3-D vertical bar chart (shown in Figure 27.7 on page 621)
with drill-down on the bars and legend values. The bars, which represent total production for each year for each country, are grouped and labeled by COUNTRY. Instead of displaying the year below each bar, the program suppresses the midpoint values with an AXIS statement and creates a legend that associates bar color and year. To create the legend, the chart variable YEAR is assigned to the SUBGROUP= option. Because the chart variable and the subgroup variable are the same, each bar contains only one "subgroup." As a result, the subgroup legend has an entry for each value of YEAR, thereby creating a legend for the midpoints. The values of COUNTRY label each group of bars. 3 Assigns the HTML variables that contain link information for the bars and for the legend values to the HTML= and HTML_LEGEND= options, respectively.
Assign the Web path. FILENAME assigns the leref ODSOUT, which species a destination for the HTML and GIF les produced by the example program. To assign that location as the HTML destination for program output, ODSOUT is specied later in the program in the ODS HTML statements PATH= option. ODSOUT must point to a Web location if procedure output is to be viewed on the Web.
filename odsout "c:\";
Set the graphics environment. The BORDER goption draws a black border around the graph.
goptions reset=all border;
Create the data set GRAINLDR. GRAINLDR contains data about grain production in ve countries for 1995 and 1996. The quantities in AMOUNT are in thousands of metric tons. MEGTONS converts these quantities to millions of metric tons.
data grainldr; length country $ 3 type $ 5; input year country $ type $ amount; megtons=amount/1000; datalines; 1995 BRZ Wheat 1516 1995 BRZ Rice 11236
Example Part A
625
1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 1996 ;
BRZ CHN CHN CHN IND IND IND INS INS INS USA USA USA BRZ BRZ BRZ CHN CHN CHN IND IND IND INS INS INS USA USA USA
Corn 36276 Wheat 102207 Rice 185226 Corn 112331 Wheat 63007 Rice 122372 Corn 9800 Wheat . Rice 49860 Corn 8223 Wheat 59494 Rice 7888 Corn 187300 Wheat 3302 Rice 10035 Corn 31975 Wheat 109000 Rice 190100 Corn 119350 Wheat 62620 Rice 120012 Corn 8660 Wheat . Rice 51165 Corn 8925 Wheat 62099 Rice 7771 Corn 236064
Add three HTML variables to GRAINLDR to create the NEWGRAIN data set. Each HTML variable is assigned the targets for a certain variable value. These targets are specied by the HREF attribute within an AREA element in the HTML le. Each HREF value species the HTML body le and, can also reference the name of the anchor within the body le that identies the target graph. The HTML variable YEARDRILL contains the targets for the values of the variable YEAR.
data newgrain; set grainldr; length yeardrill typedrill countrydrill $ 40; if year=1995 then yeardrill="HREF=year95_body.html"; else if year=1996 then yeardrill="HREF=year96_body.html";
The HTML variable COUNTRYDRILL contains the targets for the values of the variable COUNTRY. Because the graphs of COUNTRY are in one le, the targets must include the anchor name.
if country="BRZ" then countrydrill="HREF=country_body.html#country"; else if country="CHN" then
626
Example Part A
Chapter 27
countrydrill="HREF=country_body.html#country1"; else if country="IND" then countrydrill="HREF=country_body.html#country2"; else if country="INS" then countrydrill="HREF=country_body.html#country3"; else if country="USA" then countrydrill="HREF=country_body.html#country4";
The HTML variable TYPEDRILL contains the names of the les that are the targets for the values of the variable TYPE.
if type="Corn" then typedrill="HREF=type1_body.html"; else if type="Rice" then typedrill="HREF=type2_body.html"; else if type="Wheat" then typedrill="HREF=type3_body.html"; run;
= = = = =
Dene legend characteristics for all legends. OFFSET= moves the legend down.
legend1 label=none shape=bar(4,4) position=(bottom center) offset=(-3);
Assign the GOPTIONS for ODS HTML destination. DEVICE= generates the SAS/GRAPH output as GIF les.
goptions device=gif;
Example Part A
627
Open the ODS HTML destination for the ODS graphics output. BODY= names the le for storing the HTML output. CONTENTS= names the HTML le that contains the table of contents to the HTML procedure output. The contents le links to each of the body les written to the HTML destination. FRAME= names the HTML le that integrates the contents and body les. PATH= species the ODSOUT leref as the HTML destination for all the HTML and GIF les. NOGTITLE suppress the graph titles from the SAS/GRAPH output and displays them through the HTML page.
ods html body="grain_body.html" frame="grain_frame.html" contents="grain_contents.html" path=odsout nogtitle;
Suppress the label and values for the midpoint axis. The midpoint values 1995 and 1996 do not appear below each bar.
axis1 label=none value=none;
Modify the response axis. ANGLE=90 prints the axis label vertically.
axis2 label=(angle=90 "Metric Tons (millions)") minor=(n=1) order=(0 to 500 by 100) offset=(0,0);
Suppress the label and order the values for the group axis. Because the values of COUNTRY are formatted, ORDER= must specify their formatted value.
axis3 label=none order=("China" "United States" "India" "Indonesia" "Brazil") split=" ";
Dene titles and footnote. The footnote uses the catalog entry name to identify the graph.
title1 "Corn, Rice, and Wheat Production"; title2 "Leading Producers for 1995 and 1996"; footnote1 j=l "click on bars or legend values" j=r "GRAINALL ";
Generate the vertical bar chart that summarizes all grain production for all countries for both years. DISCRETE creates a separate bar for each unique value of YEAR. GROUP= groups the bars by country. To create a legend for midpoint values, SUBGROUP= is assigned the chart variable. GSPACE= controls the space between the groups of bars.
proc gchart data=newgrain; format country $country.; vbar3d year / discrete sumvar=megtons
628
Example Part B
Chapter 27
HTML= species COUNTRYDRILL as the variable that contains the targets for the bars. HTML_LEGEND= species YEARDRILL as the variable that contains the targets for the legend values. Specifying HTML variables causes SAS/GRAPH to add an image map to the HTML body le. NAME= species the name of the catalog entry. Because the PATH= destination is a le storage location and not a specic le name, the catalog entry name GRAINALL is automatically assigned to the GIF le. DES= species the description that is stored in the graphics catalog and used in the Table of Contents.
html=countrydrill html_legend=yeardrill name="grainall" des="Overview of leading grain producers"; run; quit;
Example Part B
VBAR3D options: AUTOREF HTML= HTML_LEGEND= SUBGROUP= SPACE= NAME= ODS HTML options: BODY= In the second part, the PROC GCHART step continues, using RUN-group processing and WHERE statements to produce two graphs of grain production for each year, one of which is shown in Figure 27.8 on page 622. Each bar represents a country and is subgrouped by grain type. As before, both the bars and the legend values are links to other graphs. The bars link to targets stored in COUNTRYDRILL and the legend values link to targets in TYPEDRILL. These two graphs not only contain links, they are the link targets for the legend values in Figure 27.7 on page 621. Before each graph is generated, the ODS HTML statement opens a new body le in which to store the output. Because each of these graphs is stored in a separate le, the HREF attributes that are stored in the variable YEARDRILL point only to the le. The name of the le is specied by the BODY= option in the ODS HTML statement. This example shows the HREF attribute that points to the graph of 1995 and is stored in the variable YEARDRILL:
HREF=year95_body.html
Example Part B
629
Subset the data for 1995 and generate the vertical bar chart for 1995. The AUTOREF option draws a reference line on the backplane for every major tick mark value. The SUBGROUP= option creates a separate bar segment for each department. The SPACE= option controls the space between the bars. The HTML= option names the variable that contains the targets for the bars. The HTML_LEGEND= option names the variable that contains the targets for the legend values. The GIF les use the catalog entry name specied by the NAME= option.
proc gchart data=newgrain; format country $country.; where year=1995; vbar3d country / sumvar=megtons subgroup=type autoref html=countrydrill html_legend=typedrill legend=legend1 space=3 coutline=black maxis=axis3 raxis=axis2 name="year95" des="Production Breakdown for 1995"; run; quit;
Open a new body le for the graph of 1996 production. Assigning a new body le closes YEAR95_BODY.HTML.
ods html body="year96_body.html" path=odsout;
Subset the data for 1996 and generate the vertical bar chart for 1996.
proc gchart data=newgrain; format country $country.; where year=1996; vbar3d country / sumvar=megtons subgroup=type autoref
630
Example Part C
Chapter 27
html=countrydrill html_legend=typedrill legend=legend1 space=3 coutline=black maxis=axis3 raxis=axis2 name="year96" des="Production Breakdown for 1996"; run; quit;
Sort the data set for the graphs of production by country. The data must be sorted in order of the BY variable before running PROC GCHART with BY-group processing.
proc sort data=newgrain out=country; by country; run;
Example Part C
VBAR3D options: DES= GAXIS= GROUP= HTML= NAME= OUTSIDE= PATTERNID= RAXIS= SHAPE= ODS HTML options: BODY= ANCHOR= The third part produces the ve graphs that show the breakdowns by country. These graphs are generated with BY-group processing and are all stored in one body le. When the le is displayed in the browser, all the graphs appear in one frame that can be scrolled. Because the graphs are stored in one le, the links to them must explicitly point to the location of each graph in the le, not just to the le. This location is dened by an anchor. ODS HTML assigns anchor names by default, but you can specify anchor names with the ANCHOR= option. When the procedure uses BY-group processing to generate multiple pieces of output, ODS automatically increments the anchor name to produce a unique name for each graph. This example assigns the base name {mono country} to the ANCHOR= variable value. The graphs created by this part are referenced by the COUNTRYDRILL variable. With BY-group processing the catalog entry name also increments automatically. The NAME= option species COUNTRY as the base name for the graphics output. Because you cannot specify a different description for each graph, the DES= option species a generic description for the HTML Table of Contents.
Example Part C
631
Sort the data set for the graphs of production by country. The data must be sorted in order of the BY variable before running PROC GCHART with BY-group processing.
proc sort data=newgrain out=country; by country; run;
Open a new body le and specify the base anchor name for the graphs of individual countries. Assigning a new body le closes YEAR96_BODY.HTML. Because all the graphs generated by the BY-group processing are stored in one le, each one is automatically assigned an anchor name. The ANCHOR= option species a base name for these anchors.
ods html body="country_body.html" anchor="country" gfootnote path=odsout ;
Redene AXIS2 to change the range of values and suppress all axis elements. Setting all the label and tick mark options to NONE and assigning a line style of 0 removes the response axis. NOPLANE removes the 3-D axis plane. Specifying ORDER= makes all the graphs use the same range of values.
axis2 order=(0 to 250 by 50) label=none value=none style=0 major=none minor=none noplane;
Suppress the default BY line and dene a title that includes the BY-value. #BYVAL inserts the value of the BY variable COUNTRY into the title of each report.
options nobyline; title1 "Breakdown for #byval(country)"; footnote1 j=l "click on bars"; footnote2 j=c "(Millions of Metric Tons)";
632
Example Part D
Chapter 27
Generate the vertical bar chart of production for each country. The PATTERNID= option assigns patterns by group value. The GROUP= option groups the bars by country. The SHAPE= option assigns the bar shape. The OUTSIDE= option displays the SUM statistic above the bars. The HTML= option species TYPEDRILL as the variable that contains the targets for the bars. The RAXIS= option assigns the AXIS statement that removes all axis elements. The GAXIS= option assigns the AXIS statement that removes the label. The MAXIS= option assigns the AXIS statement to the midpoint axis. The NAME= option species the name of the catalog entry. The graphics catalog entry name increments so the GIF les are named sequentially from COUNTRY to COUNTRY4. The DES= option species a general description that appears in the table of contents for all ve graphs.
proc gchart data=country; format country $country.; by country; vbar3d year / discrete sumvar=megtons patternid=group group=type shape=hexagon outside=sum html=typedrill width=9 gspace=3 space=0 raxis=axis2 gaxis=axis4 maxis=axis4 name="country" des="Grain and Year Breakdown"; run; quit;
Sort the data set for the graphs of leading producers of each grain type.
proc sort data=grainldr out=type; by type; run;
Example Part D
VBAR3D options: INSIDE= NOZERO ODS HTML options: BODY= NEWFILE=TABLE Like Part C, this part uses BY-group processing to generate three graphs that show the three leading producers for each type of grain. The program subsets the data and suppresses midpoints with no observations. Instead of storing all of the output in one body le, it stores each graph in a separate le using the ODS HTML option NEWFILE=TABLE. When NEWFILE=TABLE is used with BY-group processing, each new piece of output automatically generates a new body le and simply increments the name of the le that is specied by the BODY= option. Because each graph is stored in
Example Part D
633
a separate le, the links to these graphs reference only the le name and do not require an anchor name. The graphs created by this part are referenced by the TYPEDRILL variable.
Sort the data set for the graphs of leading producers of each grain type.
proc sort data=grainldr out=type; by type; run;
Open a new body le. Assigning a new body le closes COUNTRY_BODY.HTML. NEWFILE=TABLE opens a new body le for each piece of output generated by the procedure. Each new le increments the name specied by the BODY= option using the number within the body le name as the starting number.
ods html body="type1_body.html" newfile=table path=odsout;
Modify the group axis. Because the SPLIT= option assigns a blank as the split character, the value United States prints on two lines.
axis5 label=none split=" ";
Dene title and footnote. #BYVAL inserts the value of the BY variable TYPE into the title of each report.
title1 "Top Three Producers of #byval(type)"; title2 "(In Millions of Metric Tons)"; footnote j=r "TYPE ";
Generate the vertical bar chart of leading producers for each grain type. BY-group processing generates a separate graph for each value TYPE. Each new graph generates a new body le. NOZERO suppresses the midpoints that do not have any observations. The SHAPE= option assigns the bar shape. The INSIDE= option displays the SUM statistic inside the bars.
proc gchart data=type (where=(megtons gt 31)); format country $country.; by type; vbar3d year / discrete sumvar=megtons group=country nozero shape=cylinder noframe patternid=group inside=sum width=8 maxis=axis4
634
Example Part D
Chapter 27
Close the ODS HTML destination, and open the ODS Listing destination. You must close the HTML destination before you can view the output with a browser.
ods html close; ods listing;
635
CHAPTER
28
Troubleshooting Web Output
Troubleshooting Web Output 635 Checking Browser Permissions 638 Using HTML Character Entities 638 Connecting to Web Servers that Require Authentication 639 Removing CLASSPATH Environment Variables 639 Setting the SAS_ALT_DISPLAY Variable for X Window Systems on UNIX 639 Correcting Text Fonts 640 Resolving Differences Between Graphs Generated with Different Technologies 640
Web Troubleshooting
Cause Incorrect URL. Network access denied. Remedy Check the URL in the browser. Check operating environment permissions for the HTML le. Check rewall access permissions for Internet clients.
Check the requirements. See What does your audience need to view the presentation? on page 451.
636
Chapter 28
Symptom
Cause ActiveX control may not have been installed or may be out of date.
Remedy Install the ActiveX control manually (see Manually Installing the SAS/GRAPH ActiveX Control on page 457). Consider updating the presentation to prompt users to install the control (see Conguring an Existing ActiveX Presentation to Prompt Users to Install the SAS/GRAPH ActiveX Control on page 458). Switch to the required version of the Internet Explorer Web browser. Check to see if authentication is needed, and then authenticate. See Connecting to Web Servers that Require Authentication on page 639. Ensure that the type of the HTML le is correctly specied. Ensure that the DOCTYPE and MIME tags are correctly formatted.
User attempting to run the ActiveX control in a browser other than Internet Explorer. User has not been authenticated for that browser and that Web page.
Browser permissions too restrictive. Browser displays blank page. Browser cannot access the referenced image le.
Check browser permissions. See Checking Browser Permissions on page 638. If not running an applet or control, check the image le at the location specied in the HTML le. For Java, ensure that the HTML le is correctly referencing the Java plug-in and SAS Java archive. See Specifying the Location of Control and Applet Files (CODEBASE= and ARCHIVE= Options) on page 488. Check browser permissions for running Java scripts. See Checking Browser Permissions on page 638.
4
Symptom Cause
637
Remedy In the UNIX operating environment, remove any CLASSPATH environment variables. See Removing CLASSPATH Environment Variables on page 639. Open the browsers Java Console and trace the source of the error.
Browser displays popup message Error: Not enough virtual memory to produce plot. Graph is not rendering as specied by the ODS graph style.
Generate a new graph using a smaller data set or a simpler graph. If using PROC GMAP, consider using PROC GREDUCE. Ensure that the attribute is enabled for your ODS destination. For example, the URL attribute is not enabled for the PS destination. Refer to the table of style attributes for the STYLE statement of the TEMPLATE procedure in SAS Output Delivery System: Users Guide. Specify the minimum options needed for your graph, for example:goptions reset=all device=activex;
A style attribute may be overridden by a global option, global statement option, procedure option, or statement option. In ActiveX, the user gets the message There is a pending reboot for this machine...
1 Virus-scanning software
may be interfering with the installation of the control.
638
Chapter 28
Cause A graphics option or global statement may be unsupported or partially supported for that applet or control. See also Resolving Differences Between Graphs Generated with Different Technologies on page 640. A default value in the applet or control is overriding a default option value.
Remedy Refer to the descriptions for the options you are using and to Appendix 1, Summary of ActiveX and Java Support, on page 1593 for information on whether a statement or option is supported. Specify a value for the option rather than relying on the default. See Resolving Differences Between Graphs Generated with Different Technologies on page 640. This change was made intentionally to maintain the integrity of plots drawn with the AREAS= option. Convert the image to 24-bit monochrome. Select the Refresh button in the Web browser to restore the original graph. Make any changes needed through the Data Options dialog before subsetting the graph.
In ActiveX, black-and-white image is not displayed Graph loses attributes after graph type is changed in the Web browser. Changes made through the Data Options dialog cause the graph to revert to its original view.
ActiveX does not enable 8-bit grayscales images. Some attribute loss is inherent in graph type changes. The graph discards subsetting information if you make changes through the Data Options dialog.
639
program. A character entity is a standardized string of characters that represents a special character. The browser recognizes the string and replaces it with the special character when it is formatting the display. One common character entity is > . This entity represents the greater-than symbol (<). Lists of standard character entities are provided in HTML reference books and in HTML references on the Worldwide Web. For presentations that run in the Constellation and Treeview applets, the macros DS2CONST and DS2TREE enable the ENCODE argument, which you can use to automatically replace or not replace angle brackets (< and >) in TITLE and FOOTNOTE statements.
If an X server is not available on the server machine, an alternative is to use the X virtual frame buffer (Xvfb) as supplied by the operating system vendor. Refer to your vendor-supplied documentation for information on the use of Xvfb.
640
Chapter 28
641
P A R T
3
643
642
643
CHAPTER
29
Using Annotate Data Sets
Overview 643 Enhancing Existing Graphs 644 Creating Custom Graphs 644 Creating Annotate Graphics 645 About the Annotate Data Set 645 Structure of An Annotate Data Set 645 Annotate Variables 647 Annotate Functions 649 About Annotate Graphics 651 Graphics Elements 651 Coordinates 652 Coordinate Systems 652 Ranges for Cells 654 Internal Coordinates 654 Attribute Variables 655 Creating an Annotate Data Set 656 Using the DATA Step 656 Using Annotate Macros in the DATA Step 657 Effect of Missing Values 657 Producing Graphics Output from Annotate Data Sets 657 Including Annotate Graphics with Procedure Output 657 Producing Only Annotate Graphics Output 658 Using the Annotate Variables for Web Output 658 Annotate Processing Details 658 Order in Which Graphics Elements Are Drawn 658 Controlling the Processing with the WHEN Variable 658 Using BY-Group Processing with the Annotate Facility 659 Using the LIFO Stack 659 Debugging 660 Examples 660 Labeling Cities on a Map 661 Labeling Subgroups in a Vertical Bar Chart 663 Drawing a Circle of Stars 665
Overview
The Annotate facility enables you to generate a special data set of graphics commands from which you can produce graphics output. This data set is referred to as an Annotate data set. You can use it to generate custom graphics or to enhance graphics
644
Chapter 29
output from many SAS/GRAPH procedures, including GCHART, GCONTOUR, GMAP, GPLOT, GSLIDE, and G3D.
3 label bars on horizontal and vertical bar charts 3 label points on a plot 3 create a legend for a three-dimensional graph.
Figure 29.1 on page 644 shows GMAP procedure output annotated with stars and labels at selected cities.
Figure 29.1
The program that creates this output is in Labeling Cities on a Map on page 661.
645
Figure 29.2
The program that creates this output is in Drawing a Circle of Stars on page 665.
646
Chapter 29
Output 29.1
OBS 1 2 3 4 5
Note: A blank denotes a missing value for a character variable. A . denotes a missing value for a numeric variable. 4 Each observation in this data set contains complete instructions for drawing a graphic or moving to a position to draw a graphic. The value of the FUNCTION variable determines what the observation does. Other variables control how the function is performed. This list describes each observation in the TRIANGLE and the task it performs: 1 Create a label. This instruction draws a green label at position 20,85 (in X,Y coordinates). The value of the FUNCTION variable (LABEL) tells the program what to do. The values of the coordinate variables X and Y combined with the values of the coordinate system variables HSYS, XSYS, and YSYS tell where to do it. The values of the attribute variables STYLE, COLOR, TEXT, POSITION, and SIZE tell how to do it. These variables specify the font (SWISSB), the color and text of the label, the position of the label in relation to X and Y (centered on the point), and the size of the text. 2 Go to the starting point for the triangle. The value of the FUNCTION variable (MOVE) tells the program to go to the point specied by X and Y. This is the only instruction in the observation. Notice that the values of the variables specied for the rst observation persist but are not used because they have no effect on the MOVE function. 3 Draw the rst line of the triangle. The value of the FUNCTION variable (DRAW) tells the program to draw a line from the current point (the one specied by MOVE in the second observation to the new point specied by X and Y. The value of the COLOR variable changes to red.
4 Draw the second line of the triangle. 5 Draw the third line of the triangle.
Figure 29.3 on page 647 shows the green title and the red triangle produced by the TRIANGLE data set and displayed with the GANNOChapter 33, The GANNO Procedure, on page 913 procedure. Notes on the gure in black contain the X and Y coordinates of the graphics elements.
Annotate Variables
647
Figure 29.3
Annotate Variables
Annotate variables have predened names. In each observation, the Annotate facility looks only for variables with those names. Other variables can be present, but they are ignored. Conceptually, there are three types of variables: an action variable positioning variables attribute variables tells what to do. The only action variable is FUNCTION, which species what graphics element to draw (graphics primitive) or what action to take (programming function). tell where to do it. The positioning variables specify the point at which to draw the graphics element. tell how to do it. The attribute variables specify the characteristics of the graphics element (for example, color, size, line style, text font).
There is also an HTML variable, which provides linking information when you want to use the annotate data set to generate a drill-down graph that can be viewed in a Web browser. Table 29.1 on page 647 lists all Annotate variables, grouped by task, and briey describes each one. See Annotate Variables on page 702 for a complete description of each variable.
Table 29.1 Summary of Annotate Variables
Variable FUNCTION GROUP Description species a drawing or programming action; Table 29.2 on page 650 describes these actions. uses the value of the GCHART GROUP= option in place of X or Y
Task Group Variable that denes an action Positioning variables that determine coordinate values
MIDPOINT
648
Annotate Variables
Chapter 29
Task Group
Variable SUBGROUP X Y Z XC YC
Description uses the value of the GCHART SUBGROUP= option in place of X or Y species a numeric horizontal coordinate species a numeric vertical coordinate species a numeric third dimensional coordinate; used with G3D procedure only species a horizontal character coordinate; only used with data coordinate systems 1, 2, 7, 8 species a vertical character coordinate; only used with data coordinate systems 1, 2, 7, 8 contain the X and Y coordinates of the last nontext function
XLAST, YLAST
contain the X and Y coordinates of the last text function species type of units for the SIZE variable
XSYS YSYS ZSYS Attribute variables ANGLE CBORDER CBOX COLOR IMGPATH LINE POSITION ROTATE SIZE
species coordinate system for X or XC coordinates species coordinate system for Y or YC coordinates species coordinate system for Z coordinate (G3D procedure only) angle of text label or starting angle of a pie slice colored border around text or symbol colored box behind text or symbol color of a graphics primitive path to an image le to be displayed. line type to use in drawing or special control over pies and bars placement and alignment for text strings angle at which to place individual characters in a text string or the delta angle (sweep) of a pie slice size of an aspect of a graphics primitive; depends on FUNCTION variable (for TEXT, height of characters; for PIE, pie slice radius; for DRAW, line thickness; and so on) font or pattern for a graphics element, depends on the FUNCTION variable text to use in a label, symbol, or comment
STYLE TEXT
Annotate Functions
649
Task Group
Variable WHEN
Description whether a graphics element is drawn before or after procedure graphics output species link information for a drill-down graph
Web variable
HTML
See Figure 29.4 on page 649 for a table that shows you which Annotate functions are used with which Annotate variables.
Figure 29.4 Annotate Variables used with Annotate Functions
POLYGONT DRAW2TXT COMMENT CNTL2TXT TXT2CNTL x x x
FRAME
IMAGE
LABEL
POINT
DRAW
PIEXY
MOVE
Variables ANGLE CBORDER CBOX COLOR FUNCTION GROUP HSYS HTML IMGPATH LINE MIDPOINT POSITION ROTATE SIZE STYLE (fonts) STYLE (images) STYLE (patterns) SUBGROUP TEXT WHEN X XC XSYS Y YC YSYS Z ZSYS XLAST YLAST XLSTT YLSTT
x x x
x x x x x x x
x x x x x x x x x
x x x x
x x
x x x
x x x
x x x x
x x
x x
Annotate Functions
The FUNCTION variable accepts a set of predened values (functions) that perform both graphics tasks and programming tasks.
SWAP
PUSH
POLY
POP
BAR
PIE
650
Annotate Functions
Chapter 29
The graphics functions draw the graphics elements that are illustrated in Graphics Elements on page 651. The programming functions control the internal coordinates, manipulate the LIFO stack, and help you debug an Annotate data set. These programming functions are discussed in Internal Coordinates on page 654, Using the LIFO Stack on page 659, and Debugging on page 660. Table 29.2 on page 650 summarizes the tasks that are performed by the Annotate functions. See Annotate Functions on page 671 for a complete description of the FUNCTION variable and its values.
Table 29.2 Summary of Graphics Tasks Performed by Annotate Functions
If you want to... begin to draw a polygon (starting point) and, optionally, specify a ll color and pattern continue drawing a polygon (additional vertex) and, optionally, specify an outline color of the polygon draw an arrow from the current (X,Y) position (see MOVE and TXT2CNTL) draw a line from the current (X,Y) position (see MOVE and TXT2CNTL) draw a point draw a rectangle from the current (X,Y) position (see MOVE and TXT2CNTL); optionally, ll with a pattern draw a symbol draw line from (XLAST, YLAST) coordinates to (XLSTT, YLSTT) coordinates draw pie slice, circle, or arc draw text move to the specied point (X,Y) put a frame around the area dened by XSYS and YSYS, optionally, ll with a pattern
SYMBOL DRAW2TXT PIE LABEL MOVE FRAME COMMENT CNTL2TXT TXT2CNTL SWAP PIEXY POP PUSH
Programming tasks
insert a comment in the data set (no action); documentation aid copy (XLAST, YLAST) coordinates to (XLSTT, YLSTT) coordinates copy (XLSTT, YLSTT) coordinates to (XLAST, YLAST) coordinates exchange LSTT and LAST coordinates get coordinates of a point on a pie slice outline get values for LAST and LSTT coordinates from LIFO stack put current values of LAST and LSTT coordinates onto LIFO stack
Graphics Elements
651
Task Group
If you want to... set pie radius and coordinates for center; does not draw a pie turn on trace of previous values and LIFO stack
See Figure 29.4 on page 649 for a table that shows you which Annotate functions work with which Annotate variables.
Graphics Elements
In an Annotate data set, the FUNCTION variable determines the graphics element that is drawn. The particular graphics elements that you can draw are shown in Figure 29.5 on page 651 along with the value of the FUNCTION variable or Annotate macro that draws them.
Figure 29.5
You can control the position of graphics elements in the following ways: 3 explicitly, using coordinates that you supply. 3 dependently, based on the location of features in the SAS/GRAPH output. For example, when you use the GCHART procedure, you can label the parts of a subgrouped vertical bar chart by using the SUBGROUP variable in your Annotate
652
Coordinates
Chapter 29
data set. The Annotate facility enables you to label subgroups without having to specify the actual coordinates of the subgroup bar.
3 dependently, based on values that are supplied from other data sets. For example,
you can label the ending point of a plot line in the GPLOT procedure by extracting the value of the last point in the sorted input data set.
Coordinates
Coordinates specify where to put graphics elements. These variables can contain coordinate values: 3 X, Y, and sometimes Z are used for numeric coordinates. 3 XC and YC are used for character coordinates. 3 GROUP, MIDPOINT, and SUBGROUP can be used when you annotate output from procedures such as GCHART. Use these variables to specify coordinates for horizontal or vertical bar charts. Coordinates are interpreted in terms of a coordinate system in order to identify a precise location in the graphics output.
Coordinate Systems
A coordinate system determines how coordinates are interpreted. You specify a coordinate system to use for each dimension, using the XSYS, YSYS, and ZSYS variables (for X, Y, and Z, respectively). Use ZSYS to annotate graphics output only from the G3D procedure. You also specify a coordinate system for the SIZE variable using the HSYS variable. HSYS takes the same kinds of values as XSYS, YSYS, and ZSYS. The SIZE variable species the size of a graphics element, such as the width of lines (for example, FRAME), the radius of pie slices (for example, PIE, PIECNTR, and PIEXY), or the height of text (for example, LABEL and SYMBOL). These are the important components of the Annotate coordinate systems: 3 Area: Each coordinate system refers to one of three drawing areas: data area, procedure output area, and graphics output area. Coordinates are measured from a different origin for each area; they also have different limits. Figure 29.6 on page 653 shows the areas on the graphics output and the coordinate systems that use them.
Coordinate Systems
653
Figure 29.6
3 Units: The units for a coordinate system are based on one of the following: 3 data values (for data coordinate systems). The range of values depends on
the range of data expressed along the axes of the graph. 3 cells (for coordinate systems for the procedure output area or graphics output area). The range of values depends on the type of area. See Ranges for Cells on page 654. 3 percentages of the total area available, that is, percent of the data area, or percent of the procedure output area, or percent of the graphics output area.
Type of Coordinates Area Absolute data data graphics output area graphics output area procedure output area procedure output area Relative data
Range 0-100% of axis minimum to maximum of axis 0-100% of graphics output area 0 to limit of graphics output area 0-100% of procedure output area 0 to limit of procedure output area 0-100% of axis
654
Internal Coordinates
Chapter 29
Type of Coordinates Area data graphics output area graphics output area procedure output area procedure output area N/A Text font point size
Range minimum to maximum of axis 0-100% of graphics output area 0 to limit of graphics output area 0100% of procedure output area 0 to limit of procedure output area 0 to limit of graphics output area
*Coordinate systems 1, 2, 7, and 8 are not valid with block, pie or star charts in the GCHART procedure or surface, prism or block maps with the GMAP procedure. Additionally, coordinate systems 2 and 8 are not valid with radar charts in the GRADAR procedure. **Coordinate system D is used only for text functions such as LABEL. For functions that do not create text, a warning appears in the log and the 4 coordinate system is used.
Internal Coordinates
The Annotate facility maintains two pairs of internal coordinates that are stored in internal variables: 3 coordinates of the last graphics element drawn or the coordinates from the last move are stored in the variables XLAST and YLAST 3 coordinates of the last text drawn are stored in the variables XLSTT and YLSTT. Many functions use these internal coordinates as a starting point, relying on the coordinates that are specied with the function as an ending point. For example, in the BAR function, the (XLAST, YLAST) coordinate pair is used for the lower left corner; the position dened by the X and Y variables is used for the upper-right corner. (For
Attribute Variables
655
details, see BAR Function on page 673.) These internal variables can also provide default coordinates if X, XC, Y, or YC contains a missing value. The internal coordinates are automatically updated by some of the Annotate functions. The text functions, LABEL and SYMBOL, update the (XLSTT,YLSTT) variables. The BAR, DRAW, MOVE, PIE, and POINT functions update the (XLAST,YLAST) variables. You cannot explicitly assign a value to XLAST, YLAST, XLSTT, or YLSTT because they are internal variables. For example, you cannot make this assignment:
xlast=50;
However, you can use several functions to directly manipulate the values of the internal coordinates. The functions are shown in Figure 29.7 on page 655.
Figure 29.7
CNTL2TXT XLAST,YLAST copy values TXT2CNTL XLAST,YLAST swap values SWAP XLAST,YLAST draw line DRAW2TXT XLAST,YLAST XLSTT,YLSTT XLSTT,YLSTT XLSTT,YLSTT XLSTT,YLSTT
Attribute Variables
Attribute variables control the appearance of the graphics elements. Each function uses only a subset of these variables. See Table 29.1 on page 647 for a list of attribute variables. What an attribute variable controls often depends on the graphics element to which it applies. For example, the SIZE variable controls the width of a line when it is used with FUNCTION=DRAW, but it controls the text height when it is used with FUNCTION=LABEL. For a complete description of the attribute variables and the aspect of the graphics elements that they control, see Annotate Variables on page 702.
656
Chapter 29
INF Notice that a RETAIN statement sets the values of the HSYS, XSYS, and YSYS variables. RETAIN statements are useful when you want to select the values for variables that are required for many functions and the value is the same for all of them. The SIZE, LINE, and COLOR variables are included with only the rst DRAW function. Using this method to create the data set, the values set in the rst DRAW function carry over to subsequent DRAW functions. The PROC GANNO takes as input the annotate data set triangle created by the previous DATA step and creates the output shown in Figure 29.3 on page 647.
657
3 annotate output from a SAS/GRAPH procedure by assigning the Annotate data set
to the PROC statement or the action statement, or both.
3 display only the Annotate graphics by assigning the Annotate data set to either
the GANNO or GSLIDE procedure.
658
Chapter 29
3 The GSLIDE procedure can also produce graphics output consisting only of
Annotate graphics. In addition, you can enhance the graphics output with TITLE, NOTE, and FOOTNOTE statements. See Chapter 51, The GSLIDE Procedure, on page 1509 for details.
Overlay behavior is device-dependent. Most terminals, cameras, and some printers demonstrate overlay behavior because the process of drawing updates pixels as each graphics element is drawn. Plotters do not overlay the graphics elements internally before plotting; they draw graphics elements on top of each other on the paper. The area where graphics elements overlap shows one color bleeding through the color that overlays it. To ensure that one graphics element overlays another, use the WHEN variable. 4
659
3 Annotate graphics drawn before procedure output (the default, WHEN=B). 3 Annotate graphics drawn after procedure output (WHEN=A).
Within each set, graphics elements are drawn in the order that they appear in the Annotate data set and overlay each other as appropriate (on devices that demonstrate overlay behavior). For details, see the description of the WHEN variable on WHEN Variable on page 727.
3 Both the input data set for the procedure and the Annotate data set must contain
the same BY variable.
3 The BY variable must be dened as the same type (character or numeric) and
length in both data sets. 3 If a label or format is associated with a BY variable in one data set, the same label or format has to be associated with it in the other data set. 3 Both data sets must be sorted by the BY variable. 3 The ANNOTATE= option must be specied in an action statement in the procedure. If you specify the ANNOTATE= option in the PROC statement, the Annotate graphics are used for all graphs that are generated by the procedure rather than for unique values of the BY variable. See BY Statement on page 214 for details.
660
Debugging
Chapter 29
Figure 29.8
PUSH LIFO stack values from 4th PUSH values from 3rd PUSH values from 2nd PUSH values from 1st PUSH XLAST YLAST XLSTT XLAST YLAST XLSTT
POP
YLSTT
YLSTT
Debugging
You can print your Annotate data set with the PRINT procedure. This is an easy way to examine the Annotation that you have specied or to debug your program. For example, a listing such as the one in Output 29.1 provides complete information about the value that you specify for each variable in every observation. For more complex problems, the DEBUG function enables you to display the values of Annotate variables and internal coordinates before and after a function is submitted. The values are written to the SAS log. If there is an error in your Annotate data set, one or more diagnostic messages are printed in the SAS log: 3 If an error is found in preprocessing, this message appears:
NOTE: ERROR DETECTED IN ANNOTATE= libref.dataset
where message is the text of the error message. 3 If the error limit of 20 errors is reached at any point during processing of the data set, a termination message similar to this one appears:
ERROR LIMIT REACHED IN ANNOTATE PROCESS 20 TOTAL ERRORS
Examples
The following examples show how to annotate graphics that are created with SAS/ GRAPH procedures and how to build custom graphics: 3 Labeling Cities on a Map on page 661 3 Labeling Subgroups in a Vertical Bar Chart on page 663 3 Drawing a Circle of Stars on page 665 Other examples that use Annotate data sets are as follows:
661
3 3 3 3
1 2 2 4
on on on on
GANCITY
This example labels a map of the continental United States with the location and names of three cities. The GMAP procedure draws a map of the U.S. and an Annotate data set adds the stars and labels.
662
Chapter 29
The DATA step that creates the Annotate data set gets the x and y coordinates of the cities to be labeled from the MAPS.USCITY data set. Because MAPS.USCITY stores projected coordinates in the X and Y variables, the DATA step does not need to reassign the variable values. Also because X and Y contain data values (the map data set coordinates), the XSYS and YSYS variables specify coordinate system 2, absolute data values. However, the HSYS variable that controls text height uses coordinate system 3, percent of the graphics output area. See Example 4 on page 1405 for an example of labeling a map using map coordinates in units of latitude and longitude. See Chapter 43, The GMAP Procedure, on page 1229 for more information on using map data sets.
Set the graphics environment.
goptions reset=all border;
Subset the U.S. map data set by omitting Alaska, Hawaii, and Puerto Rico.
data lower48; set maps.us; if state ne stfips("AK"); if state ne stfips("HI"); if state ne stfips("PR"); run;
Create the Annotate data set, CITYSTAR. CITYSTAR contains the commands that draw a star and a label at each of the three cities. Setting WHEN to A draws the annotation after the map.
data citystar; length function style color $ 8 position $ 1 text $ 20; retain xsys ysys "2" hsys "3" when "a";
Include the values of selected variables from MAPS.USCITY. X and Y contain projected coordinates; CITY contains names; STATE contains FIPS codes. Because there are several Atlantas, a STATE value is necessary.
set maps.uscity(keep=x y city state); if (city="Atlanta" and state=13) or city="Chicago" or city="Seattle";
Create the observation that draws the star. The text string V is the character code for the star gure in the MARKER font assigned by the STYLE variable.
function="symbol"; style="marker"; text="V"; color="red"; size=5; output;
663
Create the observation that labels the city. TEXT is assigned the value of CITY. The default font is used. SIZE uses the units assigned by HSYS so text height is 5 percent of the height of the graphics output area. POSITION 8 places the label directly below the city location.
function="label"; style=""; text=city; color="green"; size=5; position="8"; output; run;
Dene patterns for the map areas. MEMPTY colors only the state borders.
pattern value=mempty color=blue repeat=49;
Generate the map and assign the annotate data set to the CHORO statement.
proc gmap data=lower48 map=lower48; id state; choro state / annotate=citystar discrete nolegend; run; quit;
664
Chapter 29
Figure 29.10
This example shows how to label subgroups in a vertical bar chart that is generated by the GCHART procedure. Each bar represents total orders for a city and is subgrouped by the type of order. The Annotate facility labels each subgroup with the number of orders for that category. The coordinates that position the subgroup labels are derived from the values of the GCHART procedure variables CITY (the chart (or midpoint) variable) and TYPE (the subgroup variable). These variables are assigned to the corresponding Annotate variable. See Chapter 36, The GCHART Procedure, on page 989 for more information on creating bar charts.
Set the graphics environment.
goptions reset=all border;
665
Create the Annotate data set, BARLABEL. The MIDPOINT variable uses the values of the chart variable CITY to provide the X coordinate for the subgroup labels. The SUBGROUP variable uses the values of the variable TYPE to provide the Y coordinate that vertically positions the labels in the bar. Because no function is specied, the data set uses the default function, LABEL. The POSITION value E places the labels just below the top of each subgroup bar.
data barlabel; length color style $ 8; retain color "white" when "a" style "arial" xsys ysys "2" position "E" size 4 hsys "3"; set sold; midpoint=city; subgroup=type; text=left(put(units,5.)); run;
Dene axis characteristics. AXIS1 suppresses the vertical axis. AXIS2 drops the midpoint axis label.
axis1 label=none major=none minor=none style=0 value=none; axis2 label=none;
Generate a vertical bar chart and assign the Annotate data set to the VBAR statement.
proc gchart data=sold; vbar city / type=sum sumvar=units subgroup=type width=17 raxis=axis1 maxis=axis2 annotate=barlabel; run; quit;
666
Chapter 29
FRAME LABEL MOVE PIECNTR PIEXY SYMBOL Annotate variables: COLOR HSYS, XSYS, YSYS LINE STYLE TEXT X and Y XLAST and YLAST XLSTT and YLSTT Sample library member: GANCIRCL
Figure 29.11
This example shows how to use an Annotate data set to draw a ag that is composed of a rectangle and four stars. The stars are positioned by placing them on an imaginary circle. The program uses the PIECNTR and PIEXY functions to nd the points on the circle and the CNTL2TXT programming function to transfer coordinate values. It also processes Annotate assignment statements in a DO loop. The GANNO procedure displays the Annotate graphics.
667
Create the Annotate data set, FLAG. XSYS, YSYS, and HSYS specify coordinate system 3, absolute size of the graphics output area.
data flag; length function style color $ 8 text $ 30; retain xsys ysys hsys "3";
Draw a frame. The FRAME function uses the default color BLACK to draw a frame around the graphics output area specied by the XSYS and YSYS variables.
function="frame"; output;
Draw the title. The LABEL function draws the text specied in the TEXT variable. X and Y explicitly position the title on the graphics output area.
function="label"; x=50; y=90; text="Flag of Micronesia"; style=""; size=6; output;
Draw the background. MOVE species the lower left corner of the rectangle that forms the ag. BAR draws the rectangle using the values of X and Y for the upper right corner. The LINE value of 3 lls the gure with the specied color.
function="move"; x=20; y=30; output; function="bar"; x=80; y=80; color="blue"; line=3; style="solid"; output;
Draw the circle of stars. The DO loop repeats the processing instructions dened by the nested assignment statements, placing a star every 90 degrees around the circle. To increase the number of stars, reduce the size of the angle between them and adjust the ending angle.
do star_ang=0 to 270 by 90;
The PIECNTR function is set to the center of the rectangle. PIEXY calculates a point on the arc based on the value of STAR_ANG and updates the internal coordinates XLAST and YLAST.
function="piecntr"; x=50; y=55; size=15; output; function="piexy"; size=1; angle=star_ang; output;
668
Chapter 29
The programming function CNTL2TXT copies the values of XLAST and YLAST to the text-handling coordinates XLSTT and YLSTT. Assigning missing values to X and Y forces the SYMBOL function to use the values of XLSTT and YLSTT to position the star. The text string V is the character code for the star gure in the MARKER font assigned by the STYLE variable.
function="cntl2txt"; output; function="symbol"; style="marker"; text="V"; angle=0; color="white"; size=10; x=.; y=.; output; end; run;
Use the GANNO procedure to process the Annotate data set and generate the graphics output.
proc ganno annotate=flag; run; quit;
669
CHAPTER
30
Annotate Dictionary
Annotate Dictionary Overview 671 Annotate Functions 671 ARROW Function 671 BAR Function 673 CNTL2TXT Function 675 COMMENT Function 677 DEBUG Function 678 DRAW Function 678 DRAW2TXT Function 679 FRAME Function 681 IMAGE Function 684 LABEL Function 685 MOVE Function 687 PIE Function 688 PIECNTR Function 691 PIEXY Function 692 POINT Function 693 POLY Function 694 POLYCONT Function 696 POP Function 699 PUSH Function 699 SWAP Function 699 SYMBOL Function 700 TXT2CNTL Function 702 Annotate Variables 702 ANGLE Variable 702 CBORDER Variable 703 CBOX Variable 704 COLOR Variable 705 FUNCTION Variable 706 GROUP Variable 707 HSYS Variable 709 HTML Variable 711 IMGPATH Variable 712 LINE Variable 712 MIDPOINT Variable 714 POSITION Variable 716 ROTATE Variable 719 SIZE Variable 720 STYLE Variable (Fonts) 721 STYLE Variable (Images) 722
670
Contents
Chapter 30
STYLE Variable (Arrows) 722 STYLE Variable (Patterns) 723 SUBGROUP Variable 724 TEXT Variable 726 WHEN Variable 727 WIDTH Variable 728 X Variable 728 XC Variable 729 XSYS Variable 731 Y Variable 734 YC Variable 735 YSYS Variable 736 Z Variable 738 ZSYS Variable 738 Annotate Internal Coordinates 740 XLAST, YLAST Variables 740 XLSTT, YLSTT Variables 740 Annotate Macros 741 %ANNOMAC Macro 741 %ARROW Macro 741 %BAR, %BAR2 Macros 742 %CENTROID Macro 743 %CIRCLE Macro 744 %CNTL2TXT Macro 744 %COMMENT Macro 745 %DCLANNO Macro 745 %DRAW Macro 746 %DRAW2TXT Macro 746 %FRAME Macro 747 %LABEL Macro 748 %LINE Macro 749 %MAPLABEL Macro 749 %MOVE Macro 750 %PIEXY Macro 751 %POLY, %POLY2 Macro 751 %POLYCONT Macro 752 %POP Macro 753 %PUSH Macro 753 %RECT Macro 754 %SCALE Macro 755 %SCALET Macro 756 %SEQUENCE Macro 758 %SLICE Macro 758 %SWAP Macro 759 %SYSTEM Macro 759 %TXT2CNTL Macro 760 Using Annotate Macros 760 Macro Structure 760 Making the Macros Available 761 Annotate Macro Task Summary 761 Annotate Error Messages 762
Annotate Dictionary
ARROW Function
671
Annotate Functions
In an Annotate data set, the value of the FUNCTION variable species what action the observation performs. Annotate functions act in conjunction with Annotate variables that determine where and how to perform the action. Many of these variables are function-dependent, that is, what they do depends on the function they are used with. For example, with the LABEL function the STYLE variable species a font; with the BAR function, STYLE species a pattern. This section describes all of the values of the FUNCTION variable. For each function it
3 describes the functions action. 3 notes whether the function updates the internal coordinate variables XLAST,
YLAST and XLSTT, YLSTT.
3 describes how other Annotate variables behave with the function. For a complete
description of each variable, see Annotate Variables on page 702. For a summary of drawing and programming tasks performed by the FUNCTION variable, see Table 29.2 on page 650. The variables that are available for use with each function are listed in Figure 29.4 on page 649.
ARROW Function
Draws an arrow in the graphics output from the (XLAST, YLAST) coordinates to the (X,Y) coordinates specied in the function.
Updates: XLAST, YLAST Tip:
For best results, specify a graphics device driver in the GOPTIONS statement.
672
ARROW Function
Chapter 30
Syntax
FUNCTION=ARROW;
Associated Variables
ANGLE= angle-value species the angle for the tip of the arrowhead. You can specify any number for the angle. If the angle that you specify is not between 0 and 180, the absolute value of mod(angle-value,180) is used. For example, the values -45, 45, and 225 all produce the same result. Default: 30 COLOR=color species the color of the arrow that is being drawn. Color can be any SAS/GRAPH color name. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. LINE=length species the length of the sides of the arrowhead. The units for LINE are always a percentage of the graphics area, regardless of the value for HSYS. Default: 1 SIZE=line-thickness species the thickness of the line that is being drawn. The units depend on the value of the HSYS variable. For example, if HSYS=3, the SIZE variable is in units of percent of the graphics output area. If HSYS=4, the SIZE variable is in units of cells of the graphics output area. As the thickness of the line increases, it may be impossible to center around a given coordinate. For example, if you specify a thickness of value 2 and HSYS=4, the rst line is drawn at the (X, Y) coordinates. The second is drawn slightly above the rst. The exact amount varies by device, but it is always one pixel in width. A thickness of value 3 produces one line above, one line at, and one line below the (X, Y) coordinate position. See Figure 30.7 on page 679 for examples of line thicknesses.
Figure 30.1
STYLE= CLOSED | FILLED | OPEN species the type of arrowhead. Specify one of the following values:
Annotate Dictionary
BAR Function
673
CLOSED the arrowhead is shaped like an empty triangle. FILLED the arrowhead is shaped like a lled triangle. OPEN the arrowhead is shaped like a V. Default: OPEN WHEN=B | A species when to draw the line in relation to other procedure output. See WHEN Variable on page 727. X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the endpoint of a line drawn from (XLAST, YLAST) to (X,Y). XSYS=coordinate-system species the coordinate system for the X or XC variable. The XC variable can be used only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. The YC variable can be used only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable (PROC G3D only). See ZSYS Variable on page 738 for an explanation of coordinate-system.
BAR Function
Draws a rectangle whose lower-left corner is dened by the internal variables (XLAST, YLAST) and whose upper-right corner is dened by the specied X, Y variable pair. You can dene the color of the ll, the ll pattern, and the edge lines to be drawn. BOX Updates: XLAST, YLAST
Alias:
Syntax
FUNCTION=BAR;
Associated Variables
COLOR=color
674
BAR Function
Chapter 30
species the color of either the interior of the bar or the outline of the bar. Color can be any SAS/GRAPH color name. The part of the bar affected depends on the value of the STYLE variable. If STYLE species a pattern or ll, the COLOR variable determines the color of the interior. If STYLE species an empty pattern, the COLOR variable determines the color of the outline of the bar. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HTML=link-string species the text that denes the link for drill-down. LINE=0...3 species the direction in which to adjust the outline of the bar. Use LINE values 1 and 2 to offset a particular bar from an axis or adjoining area. The following gure illustrates LINE values.
Figure 30.2
Default: 1
SIZE=thickness species a line thickness for the rectangle STYLE=ll-pattern species the pattern that lls the bar. Fill-pattern can be the following bar and block patterns: SOLID S EMPTY E style<density> a solid ll. an empty ll. a shaded pattern: style can be R | X | L density can be 1...5
Annotate Dictionary
CNTL2TXT Function
675
WHEN=B | A species when to draw the bar in relation to other procedure output. See WHEN Variable on page 727. X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate dene the upper-right corner of a bar (rectangle) whose lower-left corner is (XLAST,YLAST). Use the Z variable only when you are annotating output from the G3D procedure. Figure 30.3 on page 675 illustrates the use of these coordinates. XSYS=coordinate-system species the coordinate system for the X or XC variable. The XC variable can be used only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for Y or YC variable. The YC variable can only be used with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
Figure 30.3 on page 675 shows how the XLAST, YLAST, and X, Y variables dene the diagonal corners of the bar. With character data, the XC and YC variables are used in place of the X and Y variables. The values of the XLAST and YLAST variables are usually initialized with a MOVE function or another function that updates the XLAST and YLAST pair. When the XC variable is used, set XSYS=2. When the YC variable is used, set YSYS=2.
Figure 30.3
CNTL2TXT Function
Copies the values of the internal coordinates stored in the variable pairs (XLAST, YLAST) to (XLSTT, YLSTT).
676
CNTL2TXT Function
Chapter 30
Updates:
XLSTT, YLSTT
Syntax
FUNCTION=CNTL2TXT;
Details
You can use CNTL2TXT to calculate the position of labels on a graph. For example, the following DATA step uses CNTL2TXT to position a pie slice label in the center of the arc and just beyond the arc itself, as shown in Figure 30.6 on page 677. First, use the PIE function to draw the pie slice:
data pielabel; retain xsys ysys "3"; length function style $ 8; function="pie"; size=20; x=30; y=30; style="empty"; rotate=45; output;
Then use the PIEXY function to calculate a point outside of the arc as shown in Figure 30.4 on page 676.
/* find a point that is half of the arc (rotate*.5) */ /* and is 4 units beyond the radius (size=1.1) */ function="piexy"; angle=rotate*.5; size=1.1; output;
Figure 30.4
At this point, the XLAST and YLAST variables contain the coordinates of the point that is calculated by PIEXY. However, (XLAST, YLAST) cannot be used directly by text functions. Use CNTL2TXT to copy the coordinates in (XLAST, YLAST) to the XLSTT and YLSTT variables, which text functions can use. Figure 30.5 on page 676 shows the results.
function="cntl2txt"; output;
Figure 30.5
Annotate Dictionary
COMMENT Function
677
Now you can use the LABEL function to write the label as shown in Figure 30.6 on page 677. Specify missing values for the X and Y variables to force LABEL to use the XLSTT and YLSTT variables instead of the X and Y variables.
/* write the label "Slice 1" and position it to */ /* the right of the point stored in XLSTT and YLSTT */ function="label"; text="Slice 1"; angle=0; rotate=0; position="6"; style="swissb"; size=4; x=.; y=.; output; run; /* draw the Annotate graphics */ proc ganno anno=pielabel; run; quit;
Figure 30.6
COMMENT Function
Inserts comments within the Annotate data set. The observations generated by the COMMENT function are ignored when the data set is processed.
Syntax
FUNCTION=COMMENT;
Associated Variables
TEXT=text-string species the comment to write to the data set.
678
DEBUG Function
Chapter 30
DEBUG Function
Writes the values of internal coordinates and Annotate variables to the SAS log before and after processing the next command (unless it is DEBUG) in the Annotate DATA step.
Syntax
FUNCTION=DEBUG;
DRAW Function
Draws a line in the graphics output from the (XLAST, YLAST) coordinates to the (X, Y) coordinates specied in the function.
Updates:
XLAST, YLAST
Syntax
FUNCTION=DRAW;
Associated Variables
COLOR=color species the color of the line that is being drawn. Color can be any SAS/GRAPH color name. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. LINE=1...46 species the line type of the line that is being drawn. See Specifying Line Types on page 275 for an illustration of the line types. SIZE=line-thickness species the thickness of the line that is being drawn. The units depend on the value of the HSYS variable. For example, if HSYS=3, the SIZE variable is in units of percent of the graphics output area. If HSYS=4, the SIZE variable is in units of cells of the graphics output area. As the thickness of the line increases, it may be impossible to center around a given coordinate. For example, if you specify a thickness of value 2 and HSYS=4,
Annotate Dictionary
DRAW2TXT Function
679
the rst line is drawn at the (X, Y) coordinates. The second is drawn slightly above the rst. The exact amount varies by device, but it is always one pixel in width. A thickness of value 3 produces one line above, one line at, and one line below the (X, Y) coordinate position. See Figure 30.7 on page 679 for examples of line thicknesses.
Figure 30.7
WHEN=B | A species when to draw the line in relation to other procedure output. See WHEN Variable on page 727. X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the endpoint of a line drawn from (XLAST, YLAST) to (X,Y). XSYS=coordinate-system species the coordinate system for the X or XC variable. The XC variable can be used only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. The YC variable can be used only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable (PROC G3D only). See ZSYS Variable on page 738 for an explanation of coordinate-system.
DRAW2TXT Function
Draws a line from (XLAST, YLAST) to (XLSTT, YLSTT) without updating any of those variables.
Syntax
FUNCTION=DRAW2TXT;
Associated Variables
COLOR=color species the line color. Color can be any SAS/GRAPH color name. HSYS=coordinate-system
680
DRAW2TXT Function
Chapter 30
species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system.
Annotate Dictionary
FRAME Function
681
LINE=1...46 species the line type of the line that is being drawn. See Specifying Line Types on page 275 for an illustration of the line types. SIZE=line-thickness species the thickness of the line that is being drawn. See DRAW Function on page 678 for details. WHEN=B | A species when to draw the line in relation to generation of the procedure output. See WHEN Variable on page 727.
Details
DRAW2TXT is useful for underlining text. DRAW2TXT does not update the (XLAST, YLAST) or (XLSTT, YLSTT) coordinates; neither can it interrupt a POLYCONT sequence.
FRAME Function
Draws a border around the portion of the display area dened by the XSYS and YSYS variables. Optionally species a background color for the framed area.
Syntax
FUNCTION=FRAME; Note: The FRAME function is not supported by Java.
Associated Variables
COLOR=color species the frame color and, if the STYLE variable is specied, lls the interior of the frame. Color can be any SAS/GRAPH color name. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. Note: The HSYS variable is not supported by ActiveX. HTML=link-string species the text that denes the link for drill-down. LINE=1...46 species the line type with which to draw the frame. See Specifying Line Types on page 275 for an illustration of the line types. SIZE=line-thickness species the thickness of the line with which to draw the frame. See DRAW Function on page 678 for details. Note: The SIZE variable is not supported by ActiveX.
682
FRAME Function
Chapter 30
STYLE=ll-pattern species the pattern that lls the area that is bounded by the frame. Fill-pattern can be the following bar and block patterns: SOLID S EMPTY E style<density> a solid ll. an empty ll. a shaded pattern: style can be R | X | L
density can be 1...5 See also the discussion of ll patterns for bars and blocks in VALUE= on page 240. WHEN=B | A species when to draw the frame in relation to other procedure output. See WHEN Variable on page 727 XSYS=coordinate-system YSYS=coordinate-system dene the area to be enclosed by the frame. For example, if XSYS=1 and YSYS=1, the frame encloses the axis area as shown in Figure 30.8 on page 682. See XSYS Variable on page 731 and the YSYS variable on YSYS Variable on page 736 for an explanation of coordinate-system.
Figure 30.8
If XSYS=3 and YSYS=3, the frame encloses the entire graphics output area, as shown in Figure 30.9 on page 683.
Annotate Dictionary
FRAME Function
683
Figure 30.9
graphics output area and frame when XSYX = '3' and YSYS = '3'
The values for XSYS and YSYS do not have to be the same. If XSYS=3 and YSYS=5, the frame encloses the entire width of the graphics output area; however, vertically, the frame only encloses the procedure output area as shown in Figure 30.10 on page 683.
Figure 30.10
TITLE 1
TITLE 2
FOOTNOTE
See XSYS Variable on page 731 and YSYS Variable on page 736 for an explanation of these variables and the areas that they affect.
Details
Use FRAME to simulate the CBACK= graphics option on devices (such as plotters) that do not support that option. For devices that do support the CBACK= graphics option, FRAME works in addition to that option. FRAME does not alter the (XLAST, YLAST) coordinates. See CBACK on page 337 for more information on CBACK=.
684
IMAGE Function
Chapter 30
IMAGE Function
Displays an image in the graphics output from the current (X,Y) coordinates to the (X, Y) coordinates that are associated with the IMGPATH variable.
Updates:
XLAST, YLAST
Syntax
FUNCTION=IMAGE;
Associated Variables
HTML=link-string species the text that denes the link for drill-down. IMGPATH= external-le species the image le to be displayed in the graphics output. The syntax of external le specications varies across operating environments. Note: Copying and pasting the image works only if an absolute path is specied instead of a relative path, or if the le into which the image is being pasted is opened from the directory to which the image is relative. 4 STYLE = TILE | FIT; species how the image is to be applied to ll the specied area of the graphics output. The default value of TILE replicates the image to ll the area. The FIT value stretches a single instance of the image to ll the area. X=horizontal-coordinate; species the horizontal coordinate that determines the size of the image displayed in the graphics output. Y=vertical-coordinate; species the vertical coordinate that determines the size of the image displayed in the graphics output. Z=depth-coordinate; species the depth coordinate for 3D output. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
The following example shows how the IMAGE function adds a single stretched instance of an image to the graphics output, beginning at the current coordinates and ending at the specied coordinates:
x=10; y=5; function="move"; output; x=35; y=15; imgpath="/images/gifs/picture.gif"; style="fit"; function="image"; output;
Annotate Dictionary
LABEL Function
685
For a list of the le types that you use, see Image File Types Supported by SAS/ GRAPH on page 179.
LABEL Function
Places text in the graphics output. Associated variables can control the color, size, font, base angle, and rotation of the characters displayed.
Updates: XLSTT, YLSTT
Syntax
FUNCTION=LABEL;
Associated Variables
ANGLE=0...360 species the baseline angle of the character string with respect to the horizontal. The pivot point is at (X, Y), and the rotation is in a counterclockwise direction. CBORDER=color | CTEXT draws a colored border around the text. Color can be any SAS/GRAPH color name. CBOX=color | CBACK draws a solid, colored box behind the text. Color can be any SAS/GRAPH color name. COLOR=color species the color of the text. Color can be any SAS/GRAPH color name. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. HTML=link-string species the text that denes the link for drill-down. POSITION=text-position | 0 controls the text string placement and alignment. Text-position can be one of the characters 1 through 9, A through F, <, +, or >. Invalid or missing values default to POSITION=5. POSITION should always be a character variable of length 1. For details, see POSITION Variable on page 716. ROTATE=rotation-angle species the rotation angle of each character in the string. It is equivalent to the ROTATE= option in the FOOTNOTE, NOTE, and TITLE statements. SIZE=height
686
LABEL Function
Chapter 30
species the height of the text string. The SIZE variable units are based on the value of the HSYS variable. STYLE=font-specication | NONE species the font with which to draw the text that is specied by the TEXT variable. See STYLE Variable (Fonts) on page 721 for a description of the various font specications. TEXT=text-string species the text to be written. Text-string can be up to 200 characters. Dene the TEXT variable with sufcient length to contain all of the characters in your text string. If you need longer strings, use separate observations and POSITION=0 to continue the text.
Annotate Dictionary
MOVE Function
687
WHEN=B | A species when to draw the text strings in relation to other procedure output. See WHEN Variable on page 727 X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the start point of the text string. The Z variable can be used only with the G3D procedure. Optionally, you can modify the placement of the text string with the POSITION variable. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
MOVE Function
Moves the drawing pointer to a specic location without drawing a line.
Updates: XLAST, YLAST
Syntax
FUNCTION=MOVE;
Associated Variables
GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. WHEN=B | A species when to perform the move in relation to other procedure output. See also WHEN Variable on page 727. X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate
688
PIE Function
Chapter 30
YC=character-type-vertical-coordinate specify the coordinates to which the pen is to be moved. The Z variable can only be used with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
Use MOVE to prepare for a DRAW command, a BAR command, or programming functions.
PIE Function
Draws pie slices in the graphics output.
Updates:
Syntax
FUNCTION=PIE;
Associated Variables
ANGLE=starting-angle species the starting angle of the slice arc. The default is 0.00 (horizontal) if the ANGLE variable is not specied for the rst slice. After the rst slice, the default is the ending angle of the slice arc just drawn if ANGLE=. (missing). Therefore, you can specify consecutive pie slices more easily by omitting the start and end calculations that are otherwise required. If you want the next slice to start at an angle that is different from the ending angle of the previous slice, you must specify a value for the ANGLE variable. COLOR=color species the color of the pie slice, if a pattern is specied in the STYLE variable. If you specify STYLE=EMPTY, the COLOR variable also species the outline color of the pie slices. Color can be any SAS/GRAPH color name.
Annotate Dictionary
PIE Function
689
GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. HTML=link-string species the text that denes the link for drill-down. LINE=0...3 species which slice line (or lines) to draw. See Figure 30.11 on page 689 for line values and their actions. LINE=0 draws only the outside of the arc and enables you to draw a circle.
ROTATE=rotation-angle species the angle of rotation or the delta angle of the slice arc. The default is 0.00. For example, if you specify these statements, the slice arc that is drawn begins at 90 degrees (vertical) and ends at 135 degrees (90+45):
function="pie"; angle=90; rotate=45; output;
The ANGLE variable is internally updated to the end value, 135 degrees. The value is modied only internally. If a second PIE is used and the ANGLE variable contains a missing value, the start angle is assumed to be the previous end, or 135 degrees. The arc continues from that point. If you specify the previous statements and then specify these statements, the slice begins at 135 degrees (the end angle from the previous slice) and extends another 45 degrees to the end point, 180 degrees.
function="pie"; angle=.; rotate=45; output;
This action repeats for every missing angle in the sequence. SIZE=radius species the radius of the circle being drawn. The SIZE variable uses units that are determined by the HSYS variable.
690
PIE Function
Chapter 30
STYLE=ll-pattern species the value of the pattern that lls the pie slices. Fill-pattern can be the following pie patterns: PSOLID PS PEMPTY PE a solid ll. an empty ll. a shaded pattern:
Pdensity<style<angle>>
density can be 1...5 style can be X | N angle can be 0...360 For example, if STYLE=P5N15, a pie slice with a ll of parallel lines is produced. The ll uses the heaviest density to draw the lines, and the parallel lines are drawn at a 15-degree angle from perpendicular to the radius of the pie slice. See also the discussion of ll patterns for pie and star charts in VALUE= on page 243. WIDTH=line-thickness species the thickness of the outline around the pie slice. See WIDTH Variable on page 728. WHEN=B | A species when to draw the pie slice in relation to other procedure output. See WHEN Variable on page 727. X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate dene the center of the slice. The pivot point for all slices is the point referenced by X, Y, and Z (with PROC G3D only). The rst PIE command that is issued sets the center at the (X,Y) value. If subsequent values for X and Y are missing, the coordinates of the center point are used. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
See Also
CNTL2TXT Function on page 675
Annotate Dictionary
PIECNTR Function
691
PIECNTR Function
Sets new center and radius values for later use by the PIEXY function but does not draw an arc.
Updates: XLAST, YLAST
Syntax
FUNCTION=PIECNTR;
Associated Variables
GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system. SIZE=radius species the new radius of the pie slice. The new radius is used by a subsequent PIEXY function. The HSYS variable determines the SIZE variable units. WHEN=B | A species when to draw the pie slice in relation to other procedure output. See WHEN Variable on page 727 X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate dene the center and radius of the slice. All slices are referenced from that center. Use the Z variable only with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
692
PIEXY Function
Chapter 30
PIEXY Function
Calculates a point on the outline of the slice arc.
Updates:
XLAST, YLAST
Syntax
FUNCTION=PIEXY;
Associated Variables
ANGLE=rotation-angle species the angle of rotation when moving around the perimeter of a pie. The ANGLE variable determines the angle at which the point is located relative to 0 (the three oclock position). The default is 0.00. SIZE=radius-multiplier determines the distance from the center of the slice to the point that is being calculated. The points distance is the current value of the SIZE variable multiplied by the radius (that is, the SIZE variable) of the previously drawn slice. To position a graphics element inside the pie slice, set the SIZE variable to less than 1; to position it outside of the pie slice, set the SIZE variable to greater than 1. For example, if you specify these statements, the point calculated is 1.1 times the radius (where the radius is taken from the SIZE variable that is used with the previous FUNCTION=PIE or FUNCTION=PIECNTR observation).
function="piexy"; size=1.1; output;
WHEN=B | A species when to update the internal coordinate pair (XLAST, YLAST) in relation to other procedure output. See WHEN Variable on page 727.
Details
PIEXY does not draw anything but places the calculated coordinates of the point in the internal coordinate pair (XLAST, YLAST). Then you can use XLAST and YLAST with other functions to perform other graphics actions, such as labeling pie slices. If you need to use the calculated position for a text function, use the SWAP or CNTL2TXT to put (XLAST, YLAST) into (XLSTT, YLSTT). PIEXY assumes that a pie slice has been drawn or that FUNCTION=PIECNTR has been used. Erroneous results can occur if a slice has not been drawn and PIEXY is invoked. Figure 30.12 on page 693 shows a pie slice that is drawn with the PIE function. Figure 30.13 on page 693 shows a point beyond the arc that was calculated using the PIEXY function.
Annotate Dictionary
POINT Function
693
Figure 30.12
Figure 30.13
See Also
CNTL2TXT Function on page 675
POINT Function
Places a single point at the (X, Y) coordinates in the color you specify. The point is one visible pixel in size.
Updates: XLAST, YLAST
Syntax
FUNCTION=POINT;
Associated Variables
COLOR=color species the color of the point to be drawn. Color can be any SAS/GRAPH color name. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates when used with HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. WHEN=B | A species when to draw the point in relation to other procedure output. See WHEN Variable on page 727 X=horizontal-coordinate
694
POLY Function
Chapter 30
Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the coordinates of the point that is to be drawn. Use the Z variable only with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
POLY Function
Species the beginning point of a polygon. Associated variables can dene the ll pattern and color, as well as the line type that outlines the polygon.
Syntax
FUNCTION=POLY;
Annotate Dictionary
POLY Function
695
Associated Variables
COLOR=color species the color of the interior of the polygon, if a pattern is specied for the STYLE variable. The outline color is specied with the POLYCONT function. Color can be any SAS/GRAPH color name. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with data coordinate systems 1, 2, 7, and 8. HTML=link-string species the text that denes the link for drill-down. LINE=1...46 species the line type that outlines the polygon. See Specifying Line Types on page 275 for an illustration of the line types. SIZE=thickness species a line thickness for the polygon STYLE=ll-pattern species the value of the pattern that lls the polygon. Fill-pattern can be the following map patterns: MSOLID MS MEMPTY ME a solid pattern an empty pattern
Mdensity<style<angle>> a shaded pattern: density can be 1...5 style can be X | N angle can be 0...360. For example, if STYLE=MSOLID for the POLY function, the ll area that is drawn by the POLYCONT sequence uses a solid ll. If STYLE=M5N15, the ll area uses a shaded ll of parallel lines. The ll-pattern value M5N15 species that the lines use the heaviest density, are parallel, and are drawn at a 15-degree angle from the horizontal. See also the discussion of ll patterns for maps in VALUE= on page 242. WHEN=B | A species when to begin the polygon in relation to other procedure output. See WHEN Variable on page 727 X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the initial point of the polygon that is being created. Use the Z variable only with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system.
696
POLYCONT Function
Chapter 30
YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
Use POLY with POLYCONT to dene and ll areas in the graphics output. POLY and POLYCONT do not update the (XLAST, YLAST) coordinates.
See Also
POLYCONT Function on page 696
POLYCONT Function
Continues drawing a polygon begun with the POLY function. POLYCONT species each successive point in the polygon denition.
Syntax
FUNCTION=POLYCONT;
Associated Variables
COLOR=color species the polygon outline color. Color can be any SAS/GRAPH color name. You can specify an outline color only with the rst POLYCONT command in the sequence; all subsequent POLYCONT commands ignore the COLOR variable. If you do not specify a color, the POLYCONT function uses the interior color that was specied with the POLY function. GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. WHEN=B | A species when to draw the polygon in relation to other procedure output. See WHEN Variable on page 727
Annotate Dictionary
POLYCONT Function
697
X=horizontal-coordinate Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify a point on the outline of the polygon that is being created. Use the Z variable only with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X and XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y and YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system. ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
The polygon denition is terminated by a new POLY command or by any of these functions: BAR DRAW DRAW2TXT FRAME LABEL MOVE PIE PIECNTR PIEXY POINT SYMBOL Use POLY and POLYCONT together to draw a polygon. The (X, Y) observation from the POLY function and the last (X, Y) observation from POLYCONT are assumed to connect. Thus, you are not required to respecify the rst point. For example, these statements draw a pentagon like the one in Figure 30.14 on page 698:
data house; retain xsys ysys "3"; length function $ 8; /* start at the lower left corner */ function="poly"; x=35; y=25; output; /* move to the lower right corner */ function="polycont"; x=65; y=25; output; /* move to the upper right corner */ function="polycont"; x=65; y=65; output;
698
POLYCONT Function
Chapter 30
/* move to the center top*/ function="polycont"; x=50; y=80; output; /* move to the upper left corner and complete the figure */ function="polycont"; x=35; y=65; output; run; proc ganno anno=house; run; quit;
Figure 30.14
(50,80)
Obs. 5 Obs. 4
POLYCONT
POLYCONT
(35,65)
(65,65)
Obs. 3
POLYCONT
Obs. 1
POLY
(35,25)
Obs. 2
(65,25)
POLYCONT
Missing values for the X and Y variables that are specied with POLYCONT are interpreted differently from the way that they are interpreted with the other functions. Other functions use the missing values to request a default value. POLYCONT interprets a missing value as a discontinuity (that is, a hole) in the polygon. If you are not using the data coordinate system and you specify an X or Y value of 999 in a POLYCONT observation, the default of (XLAST, YLAST) is used. Missing values indicate holes and are handled identically in the Annotate facility and the GMAP procedure. See Displaying Map Areas and Response Data on page 1240 for more information on handling missing values.
Annotate Dictionary
SWAP Function
699
POP Function
Removes the (XLAST, YLAST) and (XLSTT, YLSTT) values from the LIFO stack and updates the internal coordinate pairs with the retrieved values.
Updates: (XLAST, YLAST) and (XLSTT, YLSTT)
Syntax
FUNCTION=POP;
Details
Use POP when you want to access the values of (XLAST, YLAST) and (XLSTT, YLSTT) that you most recently stored with the PUSH function. See the PUSH function for a description of the LIFO stack.
PUSH Function
Adds current (XLAST, YLAST) and (XLSTT, YLSTT) values to the LIFO stack.
Syntax
FUNCTION=PUSH;
Details
The LIFO (last-in-rst-out) stack is a storage area where you can keep internal coordinate values for later use by utility functions without recalculating those values. LIFO stacks manage the stored data so that the last data stored in the stack is the rst data removed from the stack. Use the stack to save the current values of (XLAST, YLAST) and (XLSTT, YLSTT) and use them with functions later in the DATA step. You store and retrieve these values from the stack with the PUSH and POP functions. The PUSH function copies the current values of XLAST, YLAST, XLSTT, and YLSTT onto the stack. The POP function copies values from the stack into XLAST, YLAST. XLSTT, and YLSTT.
SWAP Function
Exchanges values of (XLAST, YLAST) with (XLSTT, YLSTT) and vice versa.
Updates: (XLAST, YLAST) and (XLSTT, YLSTT)
700
SYMBOL Function
Chapter 30
Syntax
FUNCTION=SWAP;
Details
Use SWAP when you want to use both the (XLAST, YLAST) and (XLSTT, YLSTT) coordinates for text and nontext functions, respectively.
SYMBOL Function
Places symbols in the graphics output. Associated variables can specify the color, font, and height of the symbols displayed.
Updates:
XLSTT, YLSTT
Syntax
FUNCTION=SYMBOL;
Associated Variables
CBORDER=color | CTEXT draws a colored border around the text. Color can be any SAS/GRAPH color name. CBOX=color | CBACK draws a solid, colored box behind the text. Color can be any SAS/GRAPH color name. COLOR=color species the symbol color. Color can be any SAS/GRAPH color name. The COLOR variable behaves in the same way as the COLOR= option in the SYMBOL statement. See COLOR= on page 253 for details GROUP=group-value MIDPOINT=midpoint-value SUBGROUP=subgroup-value specify coordinates for HBAR and VBAR charts from the GCHART procedure. Use these variables only with the data coordinate systems 1, 2, 7, and 8. HSYS=coordinate-system species the coordinate system for the SIZE variable. See HSYS Variable on page 709 for an explanation of coordinate-system.
Annotate Dictionary
SYMBOL Function
701
HTML=link-string species the text that denes the link for drill-down. SIZE=height species the height of the symbol that is being drawn, using units determined by the HSYS variable. The SIZE variable is equivalent to the HEIGHT= option in the SYMBOL statement. See HEIGHT= on page 254 for details. STYLE=font-specication | NONE; species the font that is used to draw the symbol that is specied by the TEXT variable. See STYLE Variable (Fonts) on page 721 for a description of the various font specications. When the STYLE variable is used with the SYMBOL function, it behaves the same as the FONT= option in the SYMBOL statement. By default, no font is specied and the symbol that is specied by the TEXT variable is taken from the special symbol table. If you use STYLE to specify a symbol font, such as Marker, the string that is assigned by the TEXT variable is the character code for a symbol. If you use STYLE to specify a text font, such as Swiss, the string assigned by the TEXT variable is displayed as text. See FONT= on page 254 for details. TEXT=special-symbol | text-string; species the symbol to be displayed. Special-symbol can be up to eight characters long. Values for special-symbol are those described in the VALUE= option of the SYMBOL statement and are illustrated in VALUE= on page 267. For ActiveX, the following values are supported: plus, X, star, square, diamond, triangle, dot, circle, ", #, $, %, =. If a symbol is not supported, a plus sign (+) is drawn instead. For Java, the following values are supported: plus, X, star, square, diamond, triangle, dot (draws a circle), circle, *, +, >. If a symbol is not supported, a plus sign (+) is drawn instead. If you also specify a text font with the STYLE variable, you can specify a text string that is displayed as the symbol. The maximum length for text-string is 200 characters. When the TEXT variable is used with the SYMBOL function, it behaves the same as the VALUE= option in the SYMBOL statement. See VALUE= on page 267 for details. WHEN=B | A species when to draw the symbols in relation to other procedure output. See WHEN Variable on page 727 Y=vertical-coordinate Z=depth-coordinate (PROC G3D only) XC=character-type-horizontal-coordinate YC=character-type-vertical-coordinate specify the point at which the symbol is placed. Use the Z variable only with the G3D procedure. XSYS=coordinate-system species the coordinate system for the X or XC variable. Use the XC variable only with XSYS=2. See XSYS Variable on page 731 for an explanation of coordinate-system. YSYS=coordinate-system species the coordinate system for the Y or YC variable. Use the YC variable only with YSYS=2. See YSYS Variable on page 736 for an explanation of coordinate-system.
702
TXT2CNTL Function
Chapter 30
ZSYS=coordinate-system species the coordinate system for the Z variable. See ZSYS Variable on page 738 for an explanation of coordinate-system.
Details
SYMBOL is similar to the LABEL function with these exceptions:
3 SYMBOL draws symbols. If you do not specify a font, SYMBOL can use the
symbols found in Figure 14.21 on page 270.
3 The text cannot be rotated or angled. 3 The text string cannot be longer than eight characters. 3 The text string is always centered with respect to x and y.
TXT2CNTL Function
Copies the values (XLSTT, YLSTT) to (XLAST, YLAST), replacing previous values of (XLAST, YLAST).
Syntax
FUNCTION=TXT2CNTL;
Details
TXT2CNTL allows nontext functions to use the ending position of a text string as a starting or ending point.
Annotate Variables
When an Annotate data set is processed, the Annotate facility looks at the values of specic variables in order to draw graphics. This section describes all of the Annotate variables in alphabetical order. Not all variables are used with all functions. Refer to the description of the individual functions in Annotate Functions on page 671 for more information about how each variable is used with each function. For a summary of Annotate variables and their uses, see Table 29.1 on page 647.
ANGLE Variable
Species the angle at which the graphics output is drawn.
Type:
Default:
Annotate Dictionary
CBORDER Variable
703
Syntax
ANGLE= angle-value;
Functions
The ANGLE variable is function dependent.
If function is... ARROW then the ANGLE variable species... the angle of the tip of the arrowhead. You can specify any number value. If the angle that you specify is not between 0 and 180, the absolute value of mod(angle-value,180) is used. For example, the values -45, 45, and 225 all produce the same result. The default value is 30. the baseline angle of the character string with respect to the horizontal. With the LABEL function, the pivot point is at (X,Y) and the direction of rotation is counterclockwise. The valid values are from 0 to 360. The default value is 0. the starting angle of the slice arc, measured counterclockwise. The valid values are from 360 to 360. The default for the rst PIE function is ANGLE=0 (horizontal, or 3:00 postion), or is the ending point of the arc of the previous slice. Specify a value for the ANGLE variable if you want the next slice to start at an angle that is different from the edge of the previous slice, or if you want the rst slice to start at an angle other than horizontal. the angle that works with the SIZE variable to establish the new XLAST, YLAST point relative to the last pie element established with the PIE or PIECNTR functions. The angle is measured counterclockwise starting at the 3:00 position. The default value is 0.
LABEL
PIE
PIEXY
CBORDER Variable
Draws a colored border around text or symbols.
Type: character Length:
Syntax
CBORDER=color | CTEXT;
color
species the color that lls the box. The color value can be any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for more information about specifying colors. Specifying a null value for the color value (CBOX= )cancels the CBOX variable.
704
CBOX Variable
Chapter 30
CTEXT
draws the border in the same color as the text or symbol. The text color is determined by (1) the COLOR variable or (2) the CTEXT=graphics option or (3) the rst color in the color list.
Functions
You can use the CBORDER variable with these functions: LABEL SYMBOL
Details
Once you have specied CBORDER, it remains in effect for all subsequent observations that use the LABEL or SYMBOL function and draws a border around all text or symbols. To turn off the border for subsequent text or symbols, specify CBORDER= . To ll the area dened by CBORDER, use the CBOX variable in conjunction with CBORDER.
CBOX Variable
Draws a solid box behind the text or symbol and lls the box with the specied color. character 8 for color codes and up to 64 for color names See also: CBORDER
Type: Length:
Syntax
CBOX=color | CBACK;
color
species the color that lls the box. Color is any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for more information about specifying colors. Specifying a null value for color (CBOX= )cancels the CBOX variable.
CBACK
lls the box with the same color as the background color of the graph. The background color is either (1) the color specied by the CBACK= graphics option or (2) the default background color for the device.
Functions
You can use the CBOX variable with these functions: LABEL SYMBOL
Annotate Dictionary
COLOR Variable
705
Details
Once you have specied CBOX, it remains in effect for all subsequent observations that use the LABEL or SYMBOL function. The color of the text or symbol within the box is controlled by the COLOR variable. By default, the solid box has no border. To add a colored border to the box, use the CBORDER variable in conjunction with CBOX.
COLOR Variable
Species the color used by the function.
Type: character Length: Default: 1 rst color in color list of the COLORS= graphics option 2 rst color in devices default color list.
Syntax
COLOR=color;
color
species any SAS/GRAPH color name. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for more information about specifying colors.
Functions
The COLOR variable is function dependent.
If function is... BAR then the COLOR variable species... the color that outlines and, optionally, lls the bar if a pattern is specied in the STYLE (patterns)STYLE Variable (Patterns) on page 723 variable. If no pattern is specied, the color value is applied only to the outline of the bar. the color of the arrow. the color of the line. the color of the outline of the frame. If a ll pattern is specied, color also determines the color of the inside of the frame. the color of the text. the color for the pie slice if a pattern is specied with the STYLE (patterns)STYLE Variable (Patterns) on page 723 variable. If no pattern is specied, color determines the color of the outline of the pie slice. the color of the point. the ll color for the interior of the polygon if a pattern is specied with the STYLE variable. If the STYLE variable is missing or EMPTY, color is ignored. Use the POLYCONT function to specify the outline color.
POINT POLY
706
FUNCTION Variable
Chapter 30
then the COLOR variable species... the color that outlines the polygon when used with the rst POLYCONT function. COLOR is ignored for subsequent POLYCONT functions in the POLYCONT sequence. the color that draws the symbol.
SYMBOL
FUNCTION Variable
Species a graphics command or programming function for the Annotate facility to perform. character Length: 8 Default: LABEL
Type:
Syntax
FUNCTION=function-name;
function-name
species the name of an Annotate function. The function-name value can be any of the following. BAR CNTL2TXT, DRAW2TXT COMMENT DEBUG DRAW FRAME IMAGE draws and, optionally, lls a rectangle. copies (XLAST, YLAST) to (XLSTT, YLSTT), overwriting the previous values of (XLSTT, YLSTT). places comments in your data set. The observation is ignored when the data set is processed. writes the values of all Annotate variables to the SAS log before and after the next observation. draws a line in the graphics output. draws a border around the area dened by XSYS and YSYS and species a background color for the framed area . displays an image in the graphics output from the current (X,Y) coordinates to the coordinates that are associated with the IMGPATH variable. draws text and is the default for the FUNCTION variable. moves to the specied point (does not draw a line). draws a pie slice, arc, or circle that can be lled. sets new center and radius values. The PIEXY function can use this information in a later observation. returns the coordinates of a point on a pie slice. Other functions can use this information in a later observation.
Annotate Dictionary
GROUP Variable
707
POINT POLY
draws a point. begins drawing a polygon (rst vertex). Use the POLYCONT function in successive observations to supply the remaining vertices. continues drawing a polygon. gets values from the LIFO stack and changes the current value of (XLAST, YLAST) and (XLSTT, YLSTT) to those values. puts the current values for (XLAST, YLAST) and (XLSTT, YLSTT) in the LIFO stack. exchanges the values of (XLAST, YLAST) and (XLSTT, YLSTT). draws a symbol. See Figure 14.21 on page 270 for a list of the symbols.
copies the values (XLSTT, YLSTT) to (XLAST, YLAST), overwriting the previous values of (XLAST, YLAST). All other variables in the observation that contain the function act as parameters for the action. For a detailed description of each function and the Annotate variables that can be used in conjunction with it, see Annotate Functions on page 671.
GROUP Variable
Positions graphics elements on the bars of a vertical or horizontal bar chart drawn using the GROUP= option in the GCHART procedure.
Type: Numeric or character; must match the type of the GROUP= variable used in the GCHART procedure. Length: Should match the length of GROUP= variable in the GCHART procedure. Default: none Restriction: Used only with vertical or horizontal bar charts produced by the GCHART procedure.
Syntax
GROUP=group-value;
group-value
references value(s) of the variable that is identied by the GROUP= option in the GCHART procedure either as a variable name or as an explicit data value. Group-value can be one of the following: group-variable group-datavalue the name of a group variable. a specic numeric data value.
group-dataa specic character data value. value To annotate all the bars in a horizontal or vertical bar chart, specify a variable name. To annotate a bar chart for a specic value of the GROUP variable, specify a specic value.
708
GROUP Variable
Chapter 30
Functions
You can use the GROUP variable only with the data coordinate systems 1, 2, 7, and 8, and with these functions: BAR DRAW LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
Using the GROUP variable is similar to using the X and Y variables with data system coordinates to position graphics elements in a vertical or horizontal bar chart. Figure 30.15 on page 709 shows how the GROUP variable works with the SUBGROUP and MIDPOINT variables to label the bars of a vertical bar chart.
Annotate Dictionary
HSYS Variable
709
Figure 30.15
The label showing the number of units that were sold in Dallas in the year 1997 is positioned by the values that are assigned to these Annotate variables:
3 GROUP=YEAR (where YEAR is a variable in the GCHART data set) 3 MIDPOINT=CITY (where CITY is a variable in the GCHART data set) 3 SUBGROUP=ITEM (where ITEM is a variable in the GCHART data set).
HSYS Variable
Denes the coordinate system and area of the output used by the SIZE variable to display the Annotate graphics. Additionally, you can use the HSYS variable with Java or ActiveX to control the markersize and linesize for the BAR, DRAW, DRAW2TXT, POLY, and SYMBOL functions.
Type: Length:
character
1 Default: 4
Syntax
HSYS=coordinate-system;
710
HSYS Variable
Chapter 30
coordinate-system
species a value that represents a coordinate system. Values can be 1 through 9 and A through C as shown in the following table:
Absolute Systems 1 2 3 4 5 6 D Relative Systems 7 8 9 A B C
Coordinate System Units percentage of data area data values percentage of graphics output area cell in graphics output area percentage of procedure output area cell in procedure output area point size (text only)
These values are also used by the XSYS and YSYS variables. See Coordinate Systems on page 652 for a description of the areas and coordinate systems.
Functions
You can use HSYS with these functions, all of which also use the SIZE variable: DRAW DRAW2TXT FRAME LABEL PIE PIECNTR SYMBOL
Details
The coordinate system that you specify with the HSYS variable affects how the function interprets the value of the SIZE variable. For example, if you use HSYS=3 and SIZE=10 with the DRAW function, the thickness of the line is 10 percent of the graphics output area. If you use HSYS=1 and SIZE=10 with DRAW, the thickness of the line is 10 percent of the data area. For text only, HSYS=D species that text sizes are in points. For example, if you use HSYS=D and SIZE=10 for the LABEL function, the label text uses a 10 point font. If you use HSYS=D with a function that does not create text, a warning appears in the log and the HSYS=4 coordinate system is used.
Annotate Dictionary
HTML Variable
711
HTML Variable
Denes a link in the HTML le created for a drill-down graph. This link is associated with an area of the graph and contains valid HTML syntax that can point to a report or another graph that you want to display when the user drills down on the area.
Type: character Length: Default:
no limit none
Syntax
HTML=link-string;
link-string
species the text that denes the link for drill-down. For more information about drill-down graphs and how to specify the link string, see Adding Links with the HTML= and HTML_LEGEND= Options on page 603. For using the HTML variable for data tips, see Adding Custom Data Tips with the HTML= Option on page 600.
Functions
You can use the HTML variable with these functions: BAR FRAME IMAGE LABEL PIE POLY SYMBOL
Details
Use a LENGTH statement to set the length of the HTML variable to the longest string you need for the link string. Be sure to set the HTML value to a null if you continue writing observations to the annotate data set after you are done assigning links. For example, the following code denes link information for two squares, but then sets the HTML variable to null when drawing a frame; otherwise the background area within the frame will use the link information from the last dened HTML value and become a hot zone in the graph.
data squares; length function style color $ 8 html text $ 15; xsys="3"; ysys="3"; /* draw a green square */ color="green"; function="move"; x=10; y=65; output;
712
IMGPATH Variable
Chapter 30
function="bar"; x=30; y=95; style="solid"; html="href=green.gif"; output; /* draw a red square */ color="red"; function="move"; x=60; y=65; output; function="bar"; x=80; y=95; html="href=red.gif"; output; /* draw a blue frame */ function="frame"; color="blue"; style="empty"; /* set null link for background area in frame */ html=""; output; run;
IMGPATH Variable
Species an image to be displayed from the current (X,Y) coordinates to the (X,Y) coordinates that are associated with this variable. character Length: 255
Type:
Syntax
IMGPATH = external-le;
external-le
species the full path or full le name of an external image le. The format of the external le specication varies between operating environments. Note: Copying and pasting the image works only if an absolute path is specied instead of a relative path, or if the le into which the image is being pasted is opened from the directory to which the image is relative. 4
Details
The IMGPATH variable can be used only with the IMAGE Function on page 684. The manner in which the specied image is to be displayed is determined by the STYLE Variable (Images) on page 722. For a list of the le types that you use, see Image File Types Supported by SAS/ GRAPH on page 179.
LINE Variable
Controls the drawing of a line by determining either the type of line to draw or the relative position of the line.
Annotate Dictionary
LINE Variable
713
Syntax
LINE=line-type;
Functions
The behavior and syntax of the LINE variable is function-dependent. ARROW In the ARROW function, the valid values are positive numbers greater than 1. The value of the LINE variable species the length of the sides of the arrowhead. The units for the LINE variable are always a percentage of the graphics area, regardless of the HSYS= value. BAR In the BAR function, valid values for the LINE variable can be 0, 1, 2, or 3. These values determine how the outline of the bar is to be drawn, as shown in the following gure.A value of 0 draws the outline all the way around the bar. A value of 1 draws the outline only on the vertical sides of the bar. A value of 2 draws the outline only on the horizontal sides of the bar. A value of 3 draws no outline.
DRAW, DRAW2TXT, FRAME, POLY Valid values are whole numbers from 0 to 46. A value of 0 species that the line not be drawn. A value of 1 species a solid line. The remaining values specify different segmented lines, as illustrated in Figure 14.22 on page 276. PIE Valid values are 0, 1, 2, or 3. The value species which lines of a pie slice are to be drawn for the current arc, as shown in Figure 30.17 on page 714.
714
MIDPOINT Variable
Chapter 30
MIDPOINT Variable
Positions graphics elements on the bars of a vertical or horizontal bar chart drawn by the GCHART procedure.
Type: Numeric or character; must match the type of the midpoint variable in the GCHART procedure. Length: Default:
Should match the length of the midpoint variable in the GCHART procedure. none Used only with vertical or horizontal bar charts produced by the GCHART
Restriction:
procedure.
Syntax
MIDPOINT=midpoint-value;
midpoint-value
references midpoint data value(s) in the GCHART procedure either as a variable name or as an explicit data value. Midpoint-value can have one of the following forms: midpointvariable midpoint-datavalue the name of a midpoint variable. a specic numeric data value.
midpoint-dataa specic character data value. value Generally, specify a variable name if you want to annotate all of the bars in a horizontal or vertical bar chart. To annotate a bar chart for a specic value of the MIDPOINT variable, specify a specic value.
Annotate Dictionary
MIDPOINT Variable
715
Functions
You can use the MIDPOINT variable only with the data coordinate systems 1, 2, 7, and 8, and with these functions: BAR DRAW LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
Using the MIDPOINT variable is similar to using the X and Y variables to position graphics elements in a vertical or horizontal bar chart when using data system coordinates. For example, suppose you produce a vertical bar chart in which the chart variable CITY produces a bar for each city in a data set. The height of each bar is determined by the value of the SUMVAR= variable, UNITS. You can label these bars by assigning the chart variable CITY to the Annotate MIDPOINT variable. The MIDPOINT variable provides the x coordinate for the label. By default, Annotate assigns the statistic variable, in this case the SUMVAR= variable, UNITS, to the Annotate Y variable, which provides the y coordinate for the label. Figure 30.18 on page 715 shows how the values of the MIDPOINT and Y variables position the label that shows the number of units sold in Atlanta. The value, which is calculated and printed by the LABEL function, is 56.
Figure 30.18
YUNITS100
MIDPOINT=Atlanta Y=56
56
MIDPOINT=Chicago Y=UNITS/2
MIDPOINT
Atlanta
Chicago
Los Angeles
City
716
POSITION Variable
Chapter 30
The labels in this gure are positioned by the values that are assigned to these Annotate variables: 3 MIDPOINT=CITY (where CITY is the chart variable); the MIDPOINT variable provides the horizontal coordinate in the vertical bar chart. 3 Y=UNITS (where UNITS is the SUMVAR= variable); the Y variable provides the vertical coordinate. By specifying Y=units/2, you can vertically center the label in the bar. Note: In a horizontal bar chart, the MIDPOINT variable controls the y coordinate and the statistic variable controls the x coordinate. 4 CAUTION:
Be careful when using MIDPOINT and X and Y variables in the same data set. Using the MIDPOINT and X variables in an Annotate data set that is used to annotate a VBAR chart or the MIDPOINT and Y variables in the same data set used to annotate an HBAR chart can cause unexpected results. When annotating a VBAR chart, the Annotate facility uses the MIDPOINT variable as the horizontal coordinate if it exists in the Annotate data set and ignores the X variable. Consequently, you should use the MIDPOINT variable as the horizontal coordinate for all observations in an Annotate data set if you use it for one. A similar behavior occurs if you use both the MIDPOINT and Y variables in an Annotate data set that is used to annotate HBAR charts. The MIDPOINT variable is always used, regardless of whether it has a missing value, and the Annotate facility ignores the Y variable. In this case, as well, use the MIDPOINT variable for the vertical coordinate for all observations in an Annotate data set if you use it for one. 4
POSITION Variable
Controls placement and alignment of a text string specied by the LABEL function. character Length: 1 Default: 5
Type:
Syntax
POSITION=text-position | 0;
text-position
species the placement of the text string in relation to the position that is dened by the X and Y variables. Text-position can be one of the characters 1 through 9, A through F, <, +, or >. These characters represent the positions that are described in the following table:
Position One cell above Centered One cell below Right Aligned 1 4|< 7 Centered 2 5|+ 8 Left Aligned 3 6|> 9
Annotate Dictionary
POSITION Variable
717
Right Aligned A D
Centered B E
Left Aligned C F
species a pause in the string in order to change an attribute, such as the color of the text.
Details
Stacking text strings
To stack text strings, specify a different position value of each string. Figure 30.19 on page 717 shows two ways to stack text.
Figure 30.19
POSITION='B' POSITION='E'
The <, +, and > positions perform the same function as 4, 5, and 6, respectively, but are recommended only for labels that are numbers. The <, +, and > positions are especially useful when you are labeling a horizontal bar chart. You can use <, +, or > if the numbers in your font are signicantly smaller than the text and you are having trouble centering labels. If the numbers in your font are the same height or close to the same height as the text, you can use positions 4, 5, and 6 to center the labels. Note: You cannot stack <, +, and > positions as you can 4, 5, and 6 positions.
718
POSITION Variable
Chapter 30
Figure 30.20
POSITION = '1'
POSITION = '2'
POSITION = '3'
Centered Centered
POSITION = '7'
POSITION = '8'
POSITION = '9'
POSITION = 'A'
POSITION = 'B'
POSITION = 'C'
POSITION = 'D'
POSITION = 'E'
POSITION = 'F'
0 is a special value to use when you want to pause and then continue a text string. With this value you can change colors, fonts, and so on in the middle of a line, while retaining the exact position of the text at
Annotate Dictionary
ROTATE Variable
719
the pause. When POSITION=0, the combined text string is left-justied beginning at the point that is dened by the X and Y variables. However, you must dene missing values for X for the continuation string. The following Annotate data set changes the font in the middle of the string. The result is shown in Figure 30.21 on page 719.
data anno; length style $ 8 text $ 12; xsys="3"; ysys="3"; hsys="3"; x=5; y=50; style="swissb"; size=10; text="This is the"; position="0"; output; x=.; style="swissbi"; text=" ITALIC font"; output; run;
Figure 30.21
ROTATE Variable
Species the angle at which to rotate the graphics element.
Type: numeric Default: 0.00
Syntax
ROTATE=rotation-angle;
Functions
The ROTATE variable is function dependent.
If function is... PIE LABEL then the variable... species the sweep of the generated arc that begins at the angle that is specied by the ANGLE variable that is used with the PIE function. rotates the individual text characters with respect to the baseline.
720
SIZE Variable
Chapter 30
SIZE Variable
Determines the size of the graphics element with which it is used.
Type: Length: Default:
Interaction:
For the LABEL function, the value of the HTEXT= goption is used as the default. However, the value of the GUNIT= goption affects the default value that is used by the SIZE= variable.
Syntax
SIZE=size-factor;
Functions
The SIZE variable is function dependent.
If function is... ARROW DRAW, DRAW2TXT, FRAME, POLY, or POLYCONT LABEL PIE or PIECNTR PIEXY SYMBOL then the variable... determines the thickness of the arrow being drawn. determines the thickness of the line being drawn.
species the height of the text. determines the radius of the pie. sets the radius multiplier. selects the height of the symbol.
Details
The SIZE variable uses the coordinate system that is specied by the HSYS Variable on page 709, which species the type of coordinate system used to generate the graph. As the thickness of the line increases, it may be impossible to center around a given coordinate. For example, if you specify a thickness of value 2 and HSYS=4, the rst line is drawn at the (X, Y) coordinates. The second is drawn slightly above the rst. The exact amount varies by device, but it is always one pixel in width. A thickness of value 3 produces one line above, one line at, and one line below the (X, Y) coordinate position. The SIZE variable is equivalent to the HEIGHT= option in the SYMBOL statement. See HEIGHT= on page 254 for details. See Figure 30.7 on page 679 for examples of line thicknesses.
Annotate Dictionary
721
Figure 30.22
1
Syntax
STYLE=font-specication | NONE;
font-specication
species a font. You can specify a GRSEG catalog entry that is supplied by SAS (for example, CENTB) or a system font that is available in your operating environment. A device-resident font can be specied by using either of these forms: 3 HWxxxnn 3 font-name Note: If you specify a sytem font whose name is longer than eight characters, then you must enclose the name of the font in double quotes. 4
NONE
species the default device-resident font. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for more information about specifying fonts. If the value of the STYLE variable is missing, SAS/GRAPH software searches for a font specication in this order: 1 the font specied by the FTEXT= graphics option 2 the device-resident font, if the device supports one
3 the SIMULATE font.
Details
When the STYLE variable is used with the SYMBOL function, it behaves the same as the FONT= option in the SYMBOL statement. By default, no font is specied and the symbol that is specied by the TEXT variable is taken from the special symbol table. If you use STYLE to specify a symbol font, such as Marker, the string that is assigned by the TEXT variable is the character code for a symbol. If you use STYLE to specify a text font, such as Swiss, the string assigned by the TEXT variable is displayed as text. See the FONT= option of the SYMBOL statement for details.
722
Chapter 30
Note: Java does not support the STYLE variable. However, you can use special symbols from the MARKER font by using the SYMBOL function. 4
Syntax
STYLE=TILE | FIT;
TILE
Details
This version of the STYLE variable can be used only with the IMAGE Function on page 684.
Syntax
STYLE=CLOSED | FILLED | OPEN;
CLOSED
Annotate Dictionary
723
8 Default: EMPTY | PEMPTY | MEMPTY Not supported by: Java (partial), ActiveX (partial)
Length:
Syntax
STYLE=ll-pattern;
ll-pattern
species a pattern to use with the graphics element. The value for ll-pattern is function-dependent: Function Valid Fill Pattern Values BAR,FRAME SOLID | S EMPTY | E style<density> Fill with a solid color. No ll. style R for right-slanted ll lines, L for left-slanted ll lines, or X for crossing ll lines Whole numbers 1 through 5 specify increasing thickness for the ll lines.
density
Note: Java and ActiveX support only SOLID and EMPTY. EMPTY is the default if any other value is used. 4 An illustration of these pattern styles is provided in the denition of the VALUE= option of the PATTERN statement. PIE PSOLID | PS PEMPTY | PE Solid ll. No ll, the default. Whole numbers 1 through 5 specify increasing thickness for the ll lines. N, the default, optionally species parallel ll lines; X optionally species crossed ll lines. Optionally species the angle of the ll lines. Values range from 0 to 360. The angle is measured counterclockwise from the horizontal. The default is 0, which draws horizontal lines.
angle
Note: Java and ActiveX support only PSOLID and PEMPTY and default to PEMPTY if any other value is used. 4
724
SUBGROUP Variable
Chapter 30
An illustration of these pattern styles is provided in the denition of the VALUE= option of the PATTERN statement. POLY MSOLID | MS MEMPTY | ME Fill with a solid color. No ll, the default. Whole numbers 1 through 5 specify increasing thickness for the ll lines. N, the default, optionally species parallel ll lines; X optionally species crossed ll lines. Optionally species the angle of the ll lines. Values range from 0 to 360. The angle is measured counterclockwise from the vertical. The default is 0, which draws vertical lines.
angle
Note: Java or ActiveX support only MSOLID and MEMPTY and default to MEMPTY is any other value is used. 4 An illustration of these pattern styles is provided in the denition of the VALUE= option of the PATTERN statement.
SUBGROUP Variable
Positions graphics elements within subgrouped bars of a vertical or horizontal bar chart produced by the GCHART procedure.
Type: Numeric or character; must match the type of the SUBGROUP variable used in the GCHART procedure. Length: Should match the length of the SUBGROUP= variable in the GCHART procedure. Default: none Restriction: The bar charts must have been produced using the SUBGROUP= option.
Syntax
SUBGROUP=subgroup-value;
subgroup-value
references value(s) of the SUBGROUP= variable in the GCHART procedure either as a variable name or as an explicit data value. Subgroup-value can have one of the following forms: subgroupvariable subgroup-datavalue subgroup-datavalue the name of a subgroup variable. a specic numeric data value. a specic character data value.
Annotate Dictionary
SUBGROUP Variable
725
Generally, specify a variable name if you want to annotate all of the bars in a horizontal or vertical bar chart. To annotate a bar chart for a specic value of the SUBGROUP variable, specify a specic value.
Functions
You can use the SUBGROUP variable only with the data coordinate system 1, 2, 7, or 8, and with these functions: BAR DRAW LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
Using the SUBGROUP variable is similar to using the X and Y variables with data system coordinates to position the graphics elements in subgroup segments in vertical and horizontal bar charts.For example, in a vertical bar chart that produces a bar for each city in a data set, you can easily label the subgroups in each bar by setting subgroup-variable to the GCHART variable by which the bar is being subgrouped. This variable provides the y coordinate of the label (so dont specify a competing value for y, but instead specify y=. or y=y). The MIDPOINT variable works well with the SUBGROUP variable to provide the x coordinate. In this example, if you set the MIDPOINT variable to the GCHART variable that contains the names of the cities, the MIDPOINT variable provides your x coordinate. Rather than providing the X and Y variables, you would use the SUBGROUP and MIDPOINT variables. Figure 30.23 on page 726 shows how the SUBGROUP variable works with the MIDPOINT variable to label the bars of a vertical bar chart.
726
TEXT Variable
Chapter 30
Figure 30.23
Units 100
....................... ....................... ....................... ....................... 25 ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... ....................... .......................
MIDPOINT SUBGROUP
Atlanta typewriters
Chicago
City
The label showing the number of printers sold in Atlanta is positioned by the values that are assigned to these Annotate variables:
3 MIDPOINT=CITY (where CITY is a variable in the GCHART data set) 3 SUBGROUP=ITEM (where ITEM is a variable in the GCHART data set).
TEXT Variable
Species the text or symbol to be placed on the graphics output.
Type: Length: Default:
Syntax
TEXT=text-string | special-symbol;
text-string
species the text that is used as a label (LABEL or COMMENT function) or symbol (SYMBOL function). The maximum length for text-string is 200 characters.
special-symbol
species the name of a symbol from the special symbol table that is illustrated in Figure 14.21 on page 270. The maximum length for special-symbol is eight characters.
Functions
You can use the TEXT variable with these functions:
Annotate Dictionary
WHEN Variable
727
Details
Dene the TEXT variable with sufcient length to contain all of the characters in your text string. If you need longer strings, use separate observations and POSITION=0 to continue the text. Use a LENGTH statement to set the length of the TEXT variable if the length of a text string is longer than one character.
WHEN Variable
Species when the function is performed in relation to generating other graphics output for the procedure or in relation to generating other Annotate graphics.
Type: character
1 Default: B
Length:
Syntax
WHEN=B | A ;
B|A
species whether to draw the annotation before (B) or after (A) the graph. These values are not case sensitive. A missing value is equivalent to specifying B. Note: The frame of some plot types is drawn before annotations where WHEN="B". If you use the Annotate facility to draw a background and you want your graph frame to be visible, then you can use the BAR function to draw a frame. The following annotate statements draw a white graph frame:
xsys="3"; ysys="3"; when="b"; function="move"; x=0; y=0; output; function="bar"; style="solid"; color="white"; x=100; y=100; output;
Functions
You can use the WHEN variable with these functions: BAR DRAW DRAW2TXT FRAME LABEL
728
WIDTH Variable
Chapter 30
Details
Normally, observations in an Annotate data set are processed sequentially. If you use the WHEN variable, all those observations with a WHEN value of B are processed rst, the procedure output is then processed (if one is to be produced), and nally the observations with a WHEN value of A are processed.
WIDTH Variable
Determines the thickness of a line. numeric Length: 8 Default: 1
Type:
Syntax
WIDTH=line-thickness;
Details
The WIDTH variable can be used only with the PIE function. The WIDTH variable always species a width in pixels. The coordinate system that you specify with the HSYS variable does not affect the WIDTH variable. Note: The WIDTH variable is not supported by Java when your graph contains a depth axis (for example, graphs that are created by the SCATTER statement of the G3D procedure). 4 Note: For ActiveX output, the maximum line thickness is ten pixels. If you specify a greater value, then the value is reduced to 10. 4
X Variable
Identies the x coordinate of where a graphics element is to be drawn.
Annotate Dictionary
XC Variable
729
Syntax
X=horizontal-coordinate;
Functions
You can use the X variable with these functions: ARROW BAR DRAW IMAGE LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL Note: The X or XC variable is required unless either the MIDPOINT, GROUP, or SUBGROUP variable provides the horizontal coordinate. 4
Details
Specify a corresponding vertical coordinate when using the X variable. This vertical coordinate can be specied with the Y, YC, MIDPOINT, or SUBGROUP variables, depending on the type of graph that you are annotating. The X variable uses the units that are specied in the XSYS variable. If you use XSYS=2 and the data axis is typed as character, use the XC variable instead of the X variable. If the value of the X variable is missing for a function that requires it, the value of the XLAST variable is used with nontext functions and the value of the XLSTT variable is used with text functions.
XC Variable
Identies the x coordinate of a graphics element when the coordinate value is character.
Type: character Length:
730
XC Variable
Chapter 30
the value of XLAST or XLSTT Restrictions: Used only with output from the GCHART and GPLOT procedures. Ignored if the axes are numeric.
Default:
Syntax
XC=character-type-horizontal-coordinate;
Functions
You can use the XC variable with these functions: BAR DRAW LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
The XC variable is the character equivalent of the X variable. Use XC when the axis values are character. You must also specify a value of 2 (absolute data values) for the XSYS variable. (See also XSYS Variable on page 731.) If you use a value other than 2 for the XSYS variable, the graphics output is not displayed properly. Figure 30.24 on page 731 illustrates the XC variable.
Annotate Dictionary
XSYS Variable
731
Figure 30.24
YC G F E D C B A (XC = A) (A,A)
(YC = A) XC A B C D E F G
Note: The X or XC variable is required unless either the MIDPOINT, GROUP, or SUBGROUP variable provides the horizontal coordinate. 4 CAUTION:
Do not use the X and XC variables in the same data set. Using both X and XC variables in the same data set can cause unpredictable results. 4
XSYS Variable
Denes the coordinate system and area of the output used by the X and XC variables to display the Annotate graphics.
Type: character Length: Default:
1 4
Syntax
XSYS=coordinate-system;
732
XSYS Variable
Chapter 30
coordinate-system
species a value that represents a coordinate system. Values can be 1 through 9 and A through C as shown in the following table:
Absolute Systems 1 2 3 4 5 6 Relative Systems 7 8 9 A B C
Coordinate System Units percentage of data area data values percentage of graphics output area cell in graphics output area percentage of procedure output area cell in procedure output area
These values are also used by the HSYS and YSYS variables. See Coordinate Systems on page 652 for a description of the areas and coordinate systems.
Functions
You can use the XSYS variable with these functions: ARROW BAR DRAW FRAME LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL The behavior of the XSYS variable is function-dependent for the following functions:. BAR, DRAW The coordinate system that you specify with the XSYS variable affects how the function interprets the value of the X or XC variable. If XC is used, XSYS=2 must also be used. The XSYS and YSYS variables dene the area enclosed by the frame. To draw a frame that encloses the axis area, use XSYS=1 and YSYS=1, as shown in the following gure.
FRAME
Annotate Dictionary
XSYS Variable
733
To draw a frame that encloses the entire graphics output area, specify XSYS=3 and YSYS=3, as shown in the following gure.
graphics output area and frame when XSYX = '3' and YSYS = '3'
To limit the size of the frame to the size of the procedure output area, specify a value of 5 for XSYS and YSYS. Note that the values of XSYS and YSYS can differ. You can specify a frame that occupies the entire width of the graphics output area and only the vertical width of the procedure output area by specifying XSYS=3 and YSYS=5, as shown in the following gure.
734
Y Variable
Chapter 30
TITLE 1
TITLE 2
FOOTNOTE
Details
The coordinate system that you specify with the XSYS variable affects how the function interprets the value of the X or XC variable. Note: Not all coordinate systems can be used with all Annotate variables. For any restrictions, see the individual variables in this section. 4
Y Variable
Identies the y coordinate of where a graphics element is to be drawn. numeric Default: value of YLAST or YLSTT
Type:
Syntax
Y=vertical-coordinate;
Annotate Dictionary
YC Variable
735
Functions
You can use the Y variable with these functions: ARROW BAR DRAW IMAGE LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL Note: The Y or YC variable is required unless either the MIDPOINT, GROUP, or SUBGROUP variable provides the vertical coordinate. 4
Details
Specify a corresponding horizontal coordinate when using the Y variable. You can specify the horizontal coordinate with the X, XC, MIDPOINT, or SUBGROUP variable, depending on the type of graph you are annotating. The Y variable uses the units specied in the YSYS variable. If you use YSYS=2 and the axis data is type character, use the YC variable instead of the Y variable. If the value of the Y variable is missing for a function that requires it, the value YLAST is used for nontext functions and the value of YLSTT is used for text functions.
YC Variable
Identies the y coordinate of a graphics element when the coordinate value is character.
Type: character Length: Default:
Should match that of the plot variable in the procedure. YLAST | YLSTT
Restrictions: Used only with output from the GCHART and GPLOT procedures. Ignored if the axes are numeric.
Syntax
YC=character-type-vertical-coordinate;
736
YSYS Variable
Chapter 30
Functions
You can use the YC variable with these functions: BAR DRAW LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
The YC variable is the character equivalent of the Y variable. Use YC when the axis values are character. You must also specify a value of 2 (absolute data values) for the YSYS variable. (See YSYS Variable on page 736.) If you use a value other than 2 for the YSYS variable, the graphics output is not displayed properly. See Figure 30.24 on page 731 for an illustration of the YC variable. Note: The X or XC variable is required unless either the MIDPOINT, GROUP, or SUBGROUP variable provides the horizontal coordinate. 4
CAUTION:
Do not use Y and YC variables in the same data set. Using both Y and YC variables in the same data set can cause unpredictable results. 4
YSYS Variable
Denes the coordinate system and area of the output used by Y and YC to display the Annotate graphics.
Type: Length: Default:
character 1 4
Syntax
YSYS=coordinate-system;
Annotate Dictionary
YSYS Variable
737
coordinate-system
species a value that represents a coordinate system. Values can be 1 through 9 and A through C, as shown in the following table:
Absolute Systems 1 2 3 4 5 6 Relative Systems 7 8 9 A B C
Coordinate System Units percentage of data area data values percentage of graphics output area cell in graphics output area percentage of procedure output area cell in procedure output area
These values are also used by the HSYS and XSYS variables. See Coordinate Systems on page 652 for a description of the areas and coordinate systems.
Functions
The YSYS variable is function-dependent, as dened in the XSYS Variable on page 731 You can use the YSYS variable with these functions: ARROW BAR DRAW FRAME LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
The coordinate system that you specify with the YSYS variable affects how the function interprets the value of the Y or YC variable. Note: Not all coordinate systems can be used with all Annotate variables. For any restrictions, see the individual variables in this section. 4
738
Z Variable
Chapter 30
Z Variable
Identies the z coordinate of where a graphics element is to be drawn.
Type: Length: Default:
numeric 8 none
For Java or ActiveX, you can use the Z variable with GMAP, GCHART, GCONTOUR, GPLOT, and G3D, for example to add annotations above the plane of the map. For other devices, the Z variable is used only with output from the G3D procedure.
Restrictions:
Syntax
Z=depth-coordinate;
Functions
You can use the Z variable with these functions: ARROW BAR DRAW IMAGE LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
The Z variable uses the units that are specied in the ZSYS variable.
ZSYS Variable
Denes the coordinate system and area of the output used by Z variable to display the Annotate graphics.
Type:
character
Annotate Dictionary
ZSYS Variable
739
Length: Default:
1 2
Syntax
ZSYS=coordinate-system;
coordinate-system
species a value that represents a coordinate system. Values can be 1, 2, 7, or 8 as shown in the following table:
Absolute Systems 1 2 Relative Systems 7 8
See Coordinate Systems on page 652 for a description of the areas and coordinate systems.
Functions
You can use the ZSYS variable with these functions: ARROW BAR DRAW IMAGE LABEL MOVE PIE PIECNTR POINT POLY POLYCONT SYMBOL
Details
The coordinate system that you specify with the ZSYS variable affects how the function interprets the value of the Z variable. Note: Not all coordinate systems can be used with all Annotate variables. For any restrictions, see the individual variables in this section. 4
740
Chapter 30
Details
The coordinate values that are stored in the (XLAST, YLAST) variables are automatically updated by these nontext functions: BAR, DRAW, MOVE, PIE, and POINT. These values are then available for use by other nontext functions that follow in the DATA step. (The DRAW2TXT graphics function uses XLAST and YLAST but does not update them.) Because (XLAST, YLAST) are updated internally, you cannot specify values for them. However, their values can be manipulated by these programming functions: CNTL2TXT PIECNTR PIEXY POP PUSH SWAP TXT2CNTL
Details
The coordinate values stored in the (XLSTT, YLSTT) variables are automatically updated by the LABEL and SYMBOL text functions. These values are then available for use by other text functions that follow in the DATA step.
Annotate Dictionary
%ARROW Macro
741
Because (XLSTT, YLSTT) are updated internally, you cannot specify values for them. However, their values can be manipulated by these programming functions: CNTL2TXT DRAW2TXT POP PUSH SWAP TXT2CNTL
Annotate Macros
You can use Annotate macros within a SAS DATA step to simplify the process of creating Annotate observations. With a macro, you specify a function and assign variable values in one step without having to write explicit variable assignment statements. You can mix assignment statements and macro calls in the same DATA step. This section describes all of the Annotate macros including the complete syntax and a description of the parameters. For more information on accessing and using macros, and for a summary of operations performed by the Annotate macros, see Using Annotate Macros on page 760.
%ANNOMAC Macro
Compiles Annotate macros and makes them available for use.
Variables written out: none directly
Syntax
%ANNOMAC;
Details
In a SAS session, you must submit the ANNOMAC macro before you can use the Annotate macros.
%ARROW Macro
Draws an arrow from (X1, Y1) to (X2,Y2).
Variables written out: ANGLE, COLOR, FUNCTION, LINE, SIZE, STYLE, X, Y Internal variables updated:
XLAST, YLAST
742
Chapter 30
Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%ARROW (x1, y1, x2, y2, color, line, size, angle, style);
x1, y1
specify coordinates for the start point of the arrow. Values can be coordinate numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
x2, y2
specify coordinates for the end point of the arrow. Values can be coordinate numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
color
species the color of the line using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species the length of the sides of the arrowhead. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate LINE Variable on page 712 for the ARROW function.
size
species the width of the line. The value can be a number, a numeric constant, or a numeric variable. For valid numeric values, see the Annotate SIZE Variable on page 720 for the ARROW function.
angle
species the angle of the tip of the arrowhead. The value can be a number, a numeric constant, or a numeric variable. For valid numeric values, see the Annotate ANGLE Variable on page 702 for the ARROW function.
style
species the type of arrowhead. You can specify CLOSED, FILLED, or OPEN. For more information about the values, see STYLE Variable (Arrows) on page 722.
Details
The point from which the line is drawn is usually set with the MOVE macro.
Annotate Dictionary
%CENTROID Macro
743
Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%BAR (x1, y1, x2, y2, color, line, style); %BAR2(x1, y1, x2, y2, color, line, style, width);
x1, y1
specify the location of the rst corner of the bar. Values can be numeric coordinates, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
x2, y2
specify the location of second corner of the bar, which is drawn diagonal to the rst corner. Values can be numeric coordinates, numeric constants, or numeric variables.
color
species the outline color and optional ll color using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705.
line
species which of the outlines of the bar are to be drawn. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate LINE Variable on page 712 for the BAR function.
style
species the ll pattern for the bar using a character string without quotation marks. For valid values, see the Annotate STYLE Variable (Patterns) on page 723 for the BAR function.
width
species the width of the outline and optional ll lines. The value can a number, a numeric constant, or a numeric variable. For details and valid values, see the Annotate SIZE Variable on page 720 for the DRAW function.
%CENTROID Macro
Retrieves the centroids of polygons
Variables written out: X, Y, id variables Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%CENTROID (input-data-set, output-data-set, list-of-id-variables);
744
%CIRCLE Macro
Chapter 30
input-data-set
species a map data set. The input map data set must be sorted by the ID variables.
output-data-set
species the variables each of which is to be assigned the centroid coordinates of each observation in the input-data-set. There will be one observation for each unique set of ID values. If you specify more than one ID variable, then separate each variable with a space.
%CIRCLE Macro
Draws an empty circle with the center at (x, y).
Variables written out: ANGLE, FUNCTION, ROTATE, SIZE, STYLE, X, Y Internal variables updated: XLAST, YLAST Prerequisite: You must run the %ANNOMAC macro before using any other annotate
macros. For more information, see Making the Macros Available on page 761.
Syntax
%CIRCLE (x, y, size, color);
x, y
specify coordinates for the center of the circle. Values can be coordinate numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
size
species the radius of the circle. The value can be a number, a numeric constant, or a numeric variable. For details and valid values, see the Annotate SIZE Variable on page 720.
color
species the color of the circle using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
See Also
%SLICE Macro on page 758 to draw a lled circle.
%CNTL2TXT Macro
Copies the values of the internal coordinates (XLAST, YLAST) to the text coordinate (XLSTT, YLSTT).
Annotate Dictionary
%DCLANNO Macro
745
XLSTT, YLSTT
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%CNTL2TXT;
Details
The %CNTL2TXT macro is useful when you are calculating the position of labels on a graph. For an example, see CNTL2TXT Function on page 675.
%COMMENT Macro
Inserts a comment into an Annotate data set.
Variables written out: FUNCTION, TEXT Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%COMMENT (text-string);
text-string
species the text to insert in the Annotate data set. The value can be a character string enclosed in quotation marks or the name of a character variable. For details, see the Annotate TEXT Variable on page 726.
%DCLANNO Macro
Automatically sets the correct length and data type for all Annotate variables except the TEXT variable.
Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%DCLANNO;
746
%DRAW Macro
Chapter 30
%DRAW Macro
Draws a line from (XLAST, YLAST) to the specied coordinate.
Variables written out: COLOR, FUNCTION, LINE, SIZE, X, Y Internal variables updated: XLAST, YLAST Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%DRAW (x, y, color, line, size);
x, y
specify coordinates for the end point of the line. Values can be coordinate numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
color
species the color of the line using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species the line type (continuous or segmented). The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate LINE Variable on page 712 for the DRAW function.
size
species the width of the line. The value can be a number, a numeric constant, or a numeric variable. For valid numeric values, see the Annotate SIZE Variable on page 720 for the DRAW function.
Details
The point from which the line is drawn is usually set with the MOVE macro.
%DRAW2TXT Macro
Draws a line from the coordinate (XLAST, YLAST) to the text coordinate (XLSTT, YLSTT).
Variables written out: COLOR, FUNCTION, LINE, SIZE Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%DRAW2TXT (color, line, size);
Annotate Dictionary
%FRAME Macro
747
color
species the color of the line using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species the line type (continuous or segmented). The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate LINE Variable on page 712 for the DRAW function.
size
species the width of the line. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate SIZE Variable on page 720 for the DRAW function.
%FRAME Macro
Draws a border around the portion of the display area dened by the reference system and optionally lls the area.
Variables written out: COLOR, FUNCTION, LINE, SIZE, STYLE Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%FRAME (color, line, size, style);
color
species the outline color and the optional ll color using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species a line type (continuous or segmented) for the frame outline and ll lines. The value can be a number, a numeric constant, or a numeric variable. For valid numeric values, see the Annotate LINE Variable on page 712 for the DRAW function.
size
species the width of the frame outline and ll lines. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate SIZE Variable on page 720 for the DRAW function.
style
species the ll pattern for the frame using a character string without quotation marks. For valid values, see the Annotate STYLE Variable (Patterns) on page 723 for the FRAME function.
Details
See %SYSTEM Macro on page 759 for information on setting the reference system.
748
%LABEL Macro
Chapter 30
%LABEL Macro
Places a text label at the specied coordinates.
Variables written out: ANGLE, COLOR, FUNCTION, POSITION, ROTATE, SIZE, STYLE,
TEXT, X, Y
Internal variables updated: XLSTT, YLSTT Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%LABEL (x, y, text-string, color, angle, rotate, size, style, position);
x, y
species the location of the text string. Values can be coordinate numbers, numeric constants, or numeric variables. The position of the text string relative to x, y is determined by the position parameter. For details, see the Annotate X Variable on page 728.
text-string
species the text of the label. The value can be a character variable name or a character string enclosed in quotation marks. For details, see the Annotate TEXT Variable on page 726.
color
species the color of the text string using a character string without quotation marks. For details, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
angle
species the angle of the text string with respect to the horizontal. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate ANGLE Variable on page 702 for the LABEL function. The x, y coordinates specify the pivot point, and the position parameter positions the text relative to x, y.
rotate
species the rotation angle of each character in the text string. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate ROTATE Variable on page 719.
size
species the size of the text string. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate SIZE Variable on page 720 for the LABEL function.
style
species the text font, using a character string without quotation marks. For valid values, see the Annotate STYLE Variable (Fonts) on page 721.
position
species the placement and alignment of the text string relative to the x, y coordinates, using a text string without quotation marks. For valid values, see the Annotate POSITION Variable on page 716.
Annotate Dictionary
%MAPLABEL Macro
749
%LINE Macro
Draws a line between two sets of coordinates.
Variables written out: COLOR, FUNCTION, LINE, SIZE, X, Y
XLAST, YLAST Prerequisite: You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Internal variables updated:
Syntax
%LINE (x1, y1, x2, y2, color, line, size);
x1, y1
specify the coordinates of the start of the line. Values can be numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728 variable.
x1, y2
specify the coordinates of the end of the line. Values can be numbers, numeric constants, or numeric variables.
color
species the color of the line using a character string without quotation marks. For valid values, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species the line type, which can be continuous or segmented. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the AnnotateLINE Variable on page 712 for the DRAW function.
size
species the width of the line. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate SIZE Variable on page 720 for the DRAW function.
%MAPLABEL Macro
Creates an output data set that can be used with the ANNO= option for PROC GMAP.
Variables written out: FUNCTION, STYLE, COLOR, SIZE, HSYS Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%MAPLABEL (map-dataset, attr-dataset,output-dataset,label-var,id-list,font=font_name,color=n,size=n,hsys=n);
750
%MOVE Macro
Chapter 30
map-dataset
the name of the map to be annotated. Note: If you specify a feature table in your GMAP procedure step, then you should specify the map data set that corresponds to that feature table. 4
attr-dataset
the name of the dataset containing the text to be shown on each ID value.
output-dataset
the name of the label variable to place on the map (the text for annotate).
id-list
the list of ID vars that you would issue in PROC GMAP to create the map. These values need to be on both the map and the attribute data sets. If you also supply the SEGMENT variable, then every polygon will get a value. Without the SEGMENT variable, only one label per ID set will be shown over the collection of polygons. For instance, Hawaii with SEGMENT gets a label on each island, whereas without SEGMENT, there is only one label centered on the entire set of islands.
font
species a font name for the STYLE Variable (Fonts) on page 721 variable.
color
species a value for the SIZE Variable on page 720 variable. Defaults to 2.
hsys
species a value for the HSYS Variable on page 709 variable. Defaults to 3.
%MOVE Macro
Moves to the (x, y) coordinate.
Variables written out: FUNCTION, X, Y Internal variables updated: XLAST, YLAST Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%MOVE (x, y);
x, y
specify new coordinates for the next annotation. Values can be numeric coordinates, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
Annotate Dictionary
751
%PIEXY Macro
Calculates a point in relation to the latest pie slice.
Variables written out: ANGLE, FUNCTION, SIZE, X, Y Internal variables updated: Prerequisite:
XLAST, YLAST
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%PIEXY (angle, size);
angle
species the angle used to calculate the point, relative to the center of the latest pie slice. The value can be a number, a numeric constant, or a numeric variable. For details, see the Annotate ANGLE Variable on page 702 for the PIEXY function.
size
species the radius multiplier that works with the angle parameter to determine the location of the point. The value can be a number, a numeric constant, or a numeric variable. For details and valid values, see the Annotate SIZE Variable on page 720 for the PIEXY function.
Details
This macro is useful when you want to label a pie chart or a circle. When you use this macro, the Annotate facility expects a slice to have been previously drawn. If a slice has not been drawn or if the PIECNTR Function on page 691 has not been processed, you can get erroneous results.
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%POLY (x, y, color, style, line); %POLY2(x, y, color, style, line, width);
752
%POLYCONT Macro
Chapter 30
x, y
specify the starting point for a new polygon. Values can be numeric coordinates, numeric constants, or numeric variables. For details, see the Annotate or the names of the Annotate variables X Variable on page 728.
color
species the optional polygon ll color using a character string without quotation marks. For valid values, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter. To specify the color of the polygon outline, see the %POLYCONT Macro on page 752.
style
species the ll pattern for the polygon, using a character string without quotation marks. For valid values, see the Annotate STYLE Variable (Patterns) on page 723 for the POLY function.
line
species the polygons line type, which can be continuous or segmented. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate LINE Variable on page 712 for the POLY function.
width
species the width of the polygons outline and optional ll lines. The value can be a number, a numeric constant, or a numeric variable. For details and valid values, see the Annotate SIZE Variable on page 720 for the POLY function.
See Also
POLY Function on page 694
%POLYCONT Macro
Continues drawing the polygon to the next specied coordinates.
Variables written out: COLOR, FUNCTION, X, Y Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%POLYCONT (x, y, color);
x, y
specify the end point of the next line in the polygon. Values can be numeric coordinates, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
color
species the color of the polygon outline using a character string without quotation marks. For valid values, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
Annotate Dictionary
%PUSH Macro
753
Details
The rst invocation of the %POLYCONT macro in the polygon-drawing sequence determines the outline color of that polygon. Subsequent color specications for that polygon in later invocations of the %POLYCONT macro are ignored. The polygon ll color and line type are specied in the initial %POLY, %POLY2 Macro on page 751 or %POLY2 macro.
%POP Macro
Removes the coordinates (XLAST, YLAST) and (XLSTT, YLSTT) from the LIFO system stack and updates the internal coordinate pairs with these retrieved values.
Variables written out: FUNCTION
XLAST, YLAST, XLSTT, YLSTT Prerequisite: You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Internal variables updated:
Syntax
%POP;
Details
Use the %POP macro when you want to access the values of the XLAST, YLAST, XLSTT, and YLSTT variables that you previously stored with the %PUSH macro. For more information, see XLAST, YLAST Variables on page 740, XLSTT, YLSTT Variables on page 740, and %PUSH Macro on page 753.
%PUSH Macro
Enters the coordinates (XLAST, YLAST) and (XLSTT, YLSTT) in a LIFO system stack.
Variables written out: FUNCTION, internal coordinates Internal variables updated: Prerequisite:
XLAST, YLAST, XLSTT, YLSTT You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%PUSH;
Details
The last-in, rst-out (LIFO) stack provides a way to save previously calculated coordinates. It enables you to retain coordinate values for later use by utility functions without recalculating those values. In order to save coordinate values in the stack, you
754
%RECT Macro
Chapter 30
must explicitly push them onto the stack. See Using the LIFO Stack on page 659 for a description of the LIFO stack.
%RECT Macro
Draws a rectangle with diagonal corners at two specied points.
Variables written out: COLOR, FUNCTION, LINE, SIZE, X, Y Internal variables updated: XLAST, YLAST Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%RECT (x1, y1, x2, y2, color, line, size) ;
x1, y1
specify the coordinates of the rst corner of the rectangle. Values can be numeric coordinates, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
x2, y2
specify the coordinates of the second corner of the rectangle, which is drawn diagonal to the rst corner. Values can be numeric coordinates, numeric constants, or numeric variables.
color
species the color of the rectangular line using a character string without quotation marks. For valid values, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
line
species the rectangles line type, which can be continuous or segmented. The value can be a number, a numeric constant, or a numeric variable. For details, see the Annotate LINE Variable on page 712 for the DRAW function.
size
species the width of the line. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the SIZE Variable on page 720 for the DRAW function.
Details
The rectangle is drawn such that the rst corner is diagonal to the second corner. The %RECT macro produces rectangles that do not have ll patterns. Use the %BAR macro to generate lled rectangles. For more information, see %BAR, %BAR2 Macros on page 742.
Annotate Dictionary
%SCALE Macro
755
%SCALE Macro
Scales input coordinates relative to the origin (0, 0) based on the relationship between two ranges of minima and maxima.
Variables written out: X, Y Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SCALE (ptx, pty, x1, y1, x2, y2, vx1, vy1, vx2, vy2);
ptx, pty
species the coordinates to scale. Values can be numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
x1, y1
species the minima of the rst range. Values can be numbers, numeric constants, or numeric variables.
x2, y2
species the maxima of the rst range. Values can be numbers, numeric constants, or numeric variables.
vx1, vy1
species the minima of the second range. Values can be numbers, numeric constants, or numeric variables.
vx2, vy2
species the maxima of the second range. Values can be numbers, numeric constants, or numeric variables.
Details
The %SCALE macro reduces or enlarges Annotate graphics elements that use two-dimensional, numeric coordinates. The %SCALE macro does not affect graphics elements that are drawn with text functions. The difference between the %SCALE and %SCALET macros is that the %SCALE macro always places the origin at (0, 0) and plots the new coordinates with respect to that origin. The %SCALET macro plots the new coordinates with respect to the minima of the second range. For details, see %SCALET Macro on page 756. The following example uses the %SCALE macro to reduce x and y coordinates by 50 percent, as shown in Figure 30.28 on page 756:
%SCALE(x, y, 0, 0, 100, 100, 0, 0, 50, 50);
756
%SCALET Macro
Chapter 30
Figure 30.28
100
(10,80)
(60,80)
%SCALET Macro
Scales input coordinates based on the relationship between two ranges of minima and maxima. The scaled coordinates are plotted relative to the minima of the second range.
Variables written out: X, Y Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SCALET (ptx, pty, x1, y1, x2, y2, vx1, vy1, vx2, vy2);
ptx, pty
species the coordinates to scale. Values can be numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
x1, y1
species the minima of the original range. Values can be numbers, numeric constants, or numeric variables.
Annotate Dictionary
%SCALET Macro
757
x1, y2
species the maxima of the original range. Values can be numbers, numeric constants, or numeric variables.
vx1, vy1
species the minima of the second range using numeric values. Values can be numbers, numeric constants, or numeric variables. These coordinates are also used as the origin against which the scaled point is plotted.
vx2, vy2
species the maxima of the second range. Values can be numbers, numeric constants, or numeric variables.
Details
The %SCALET macro reduces or enlarges Annotate graphics elements that use two-dimensional numeric coordinates. The %SCALET macro does not affect graphics elements that are drawn with text functions. The difference between the %SCALET and %SCALE macros is that the SCALET macro plots the new coordinates with respect to minima of the second range (vx1, vy1). The %SCALE macro plots the new coordinates with respect to the origin (0, 0). The following example uses the %SCALET macro reduces x and y coordinates by 50 percent and plots the new coordinates with respect to (50, 0), as shown in Figure 30.29 on page 757:
%SCALET(x, y, 0, 0, 100, 100, 50, 0, 100, 50);
Figure 30.29 Using the %SCALET Macro to Reduce the Size of a Box
100
(10,80)
(60,80)
(30,40) + (50,0)
translation
50% of (10,20)
(0,0)
50 (50,0)
(vxl,vyl)
100
758
%SEQUENCE Macro
Chapter 30
%SEQUENCE Macro
Species when to draw Annotate graphics elements, relative to the procedures graphics output or relative to the other Annotate graphics drawn.
Variables written out: WHEN Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SEQUENCE (when);
when
Values can be BEFORE or AFTER, as dened for the Annotate WHEN Variable on page 727.
%SLICE Macro
Draws a arc, pie slice, or circle, with available line types, colors, and ll types.
Variables written out: ANGLE, COLOR, FUNCTION, LINE, ROTATE, SIZE, STYLE, X, Y Internal variables updated: XLAST, YLAST Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SLICE (x, y, angle, rotate, size, color, style, line);
x, y
specify the center point of the arc. Values can be numbers, numeric constants, or numeric variables. For details, see the Annotate X Variable on page 728.
angle
species the starting point of the arc. The value can be a number, a numeric constant, or a numeric variable. For details and valid values, see the Annotate ANGLE Variable on page 702 for the PIE function.
rotate
species the sweep of the arc. The value can be a number, a numeric constant, or a numeric variable. For valid values, see the Annotate ROTATE Variable on page 719 for the PIE function.
size
species the radius of the arc. The value can be a number, a numeric constant, or a numeric variable. For details, see the Annotate SIZE Variable on page 720.
Annotate Dictionary
%SYSTEM Macro
759
color
species the color of the arc outline and optional ll using a character string without quotation marks. For valid values, see the Annotate COLOR Variable on page 705. Use an asterisk (*) to specify the previous value of the color parameter.
style
species the ll pattern for the slice or circle, using a character string without quotation marks. For details and valid values, see the Annotate STYLE Variable (Patterns) on page 723 for the PIE function.
line
species which lines of a pie slice are to be drawn. The value can be a number, a numeric constant, or a numeric variable. For valid values and details, see the LINE Variable on page 712 for the PIE function.
%SWAP Macro
Exchanges control between (XLAST, YLAST) and text (XLSTT, YLSTT) coordinates.
Variables written out: FUNCTION Internal variables updated: Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SWAP;
%SYSTEM Macro
Denes the Annotate reference systems and the XSYS, YSYS, and HSYS variables.
Variables written out: HSYS, XSYS, YSYS Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%SYSTEM (xsys, ysys, hsys);
specify values that represent a coordinate system and an area of the output, as dened for the Annotate XSYS Variable on page 731. The default is %SYSTEM (4, 4, 4).
760
%TXT2CNTL Macro
Chapter 30
Details
Note: Not all coordinate systems are valid with all Annotate variables or all SAS/ GRAPH procedures. See Annotate Functions on page 671 for any restrictions that apply to the variable that you want to use. 4 The ZSYS variable cannot be set through this macro. Use an explicit variable assignment instead:
zsys="value"; output;
See Coordinate SystemsCoordinate Systems on page 652 for a description of the areas and coordinate systems.
%TXT2CNTL Macro
Assigns the values of the text (XLSTT, YLSTT) coordinates to the control (XLAST, YLAST) coordinates.
Variables written out: FUNCTION Internal variables updated: XLAST, YLAST Prerequisite:
You must run the %ANNOMAC macro before using any other annotate macros. For more information, see Making the Macros Available on page 761.
Syntax
%TXT2CNTL;
Details
Use the %TXT2CNTL macro when you want nontext functions to use the ending position of a text string as a starting or ending point.
In general, the macro name represents a function and the parameters contain the values for the variables that can be used with the function. All macros except DCLANNO, SYSTEM, and SEQUENCE output an observation. The parameters are either numeric or character. Numeric parameters can be numeric constants or numeric variable names that have been initialized to the appropriate value. Most character parameters must be expressed as literals, that is character strings without quotation marks. Exceptions are the text values that are used with the COMMENT and LABEL macros, which can be expressed as character strings enclosed in quotation marks or as character variable names.
Annotate Dictionary
761
The Annotate facility assigns the parameter values to the corresponding Annotate variables. Therefore, the observations in an Annotate data set that is created with macros that look the same as the ones that you created with assignment statements. For example, the following two statements are equivalent:
%LABEL (10, 15, "Graph", black, 0, 0, centb, 8); function="label"; x=10; y=15; text="Graph"; color="black"; style="centb"; position="8"; output;
3 If the leref is not set automatically, nd out where the Annotate macros are
stored and allocate a leref that points to the data set:
filename fileref "external-file";
3 If the leref is set automatically, compile the Annotate macros and make them
available by simply submitting the ANNOMAC macro:
%annomac;
Note: The ANNOMAC macro must be run before any other Annotate macros are used in a SAS session. You will see a message in the SAS log that indicates that the Annotate macros are now available. The message also shows you how to get help for using the macros. 4
If you want to... assign values of (XLSTT,YLSTT) to (XLAST,YLAST) begin drawing a polygon continue drawing a polygon copy (XLAST,YLAST) to (XLSTT,YLSTT) declare all variables draw an arrow draw a bar
762
Chapter 30
If you want to... draw a circle draw a frame draw a line from (XLAST,YLAST) to (XLSTT,YLSTT) draw a line from previous point draw a line draw a pie slice or arc draw a rectangle draw text exchange the values of (XLAST,YLAST) and (XLSTT,YLSTT) move to a point near a pie slice move to a point without drawing put values into a stack retrieve values from a stack scale and move input scale input set the coordinate system for the observation set when to draw an observation write a comment to the data set
Use this macro... %CIRCLE(x, y, size, color); %FRAME(color, line, size, style); %DRAW2TXT(color, line, size); %DRAW(x, y, color, line, size); %LINE(x1, y1, x2, y2, color, line, size); %SLICE(x, y, angle, rotate, size, color, style, line); %RECT(x 1,y 1,x 2,y 2, color, line, size); %LABEL(x, y, text, color, angle, rotate, size, style, position); %SWAP; %PIEXY(angle, size); %MOVE(x, y); %PUSH; %POP; %SCALET(ptx, pty, x0, y0, x1, y1, x0, vy0, vx1, vy1); %SCALE(ptx, pty, x0, y0, x1, y1, x0, vy0, vx1, vy1); %SYSTEM(xsys, ysys, hsys); %SEQUENCE(when); %COMMENT(text);
where message is the text of the error message. 3 If the error limit of 20 errors is reached at any point during processing of the data set, a termination message similar to this one appears:
ERROR LIMIT REACHED IN ANNOTATE PROCESS 20 TOTAL ERRORS
Some common diagnostic messages are explained here. A CALCULATED COORDINATE LIES OUTSIDE THE VISIBLE AREA
Annotate Dictionary
763
Explanation: The x or y coordinate is outside the display area (dened by HPOS= and VPOS= values). User Action: Check for an invalid or misspecied coordinate system value, or x or y values outside displayed range. A CALCULATED WINDOW COORDINATE LIES OUTSIDE THE WINDOW AREA Explanation: the x or y coordinate is outside of the window area. This message may accompany the message for invalid coordinate system specication. User Action: Check for an invalid or misspecied coordinate system value, or x or y values outside displayed range. A PERCENTAGE VALUE LIES OUTSIDE 0 TO 100 BOUNDARIES Explanation: The x or y value requested is negative or greater than 100 percent. This message is informational. User Action: Check requested value for accuracy. ANNOTATE MIDPOINT DATATYPE DOES NOT MATCH GCHART- INPUT WAS # Explanation: The MIDPOINT variable in the Annotate data set is character, and the GCHART midpoint is numeric or vice versa. User Action: Check for misspelling or wrong variable assignment, or check for quotes in the assignment statement. ANNOTATE GROUP DATATYPE DOES NOT MATCH GCHART- INPUT WAS # Explanation: The GROUP variable in the Annotate data set is character, and the GCHART group is numeric or vice versa. User Action: Check for misspelling or wrong variable assignment, or check for quotes in the assignment statement. ANNOTATE SUBGROUP DATATYPE DOES NOT MATCH GCHART- INPUT WAS # Explanation: The SUBGROUP variable in the Annotate data set is character, and the GCHART subgroup is numeric or vice versa. User Action: Check for misspelling or wrong variable assignment, or check for quotes in the assignment statement. BOTH OLD AND NEW VARIABLE NAMES ENCOUNTERED IN ANNOTATE= DATA SET Explanation: Variables named both MIDPOINT and MIDPNT or SUBGROUP and SUBGRP occur in the Annotate data set. User Action: Determine which variable has the proper values for the Annotate data set and either delete the other variable or rename MIDPNT to MIDPOINT and SUBGRP to SUBGROUP. CALCULATED COORDINATES LIE COMPLETELY OFF THE VISIBLE AREA Explanation: Both the x and y coordinates supplied are outside the visible display area. User Action: Check for improper or inappropriate coordinate system specication or coordinates out of range. CANNOT HAVE MISSING GROUP VALUE IF GROUPS ARE PRESENT Explanation: The GROUP variable in the Annotate data set contains a missing value. User Action: If the GROUP= option is specied in the GCHART procedure, the Annotate GROUP variable cannot contain missing values. Remove the missing value from the request. Check reference system for data-dependent request. CANNOT HAVE SUBGROUP AND X/Y MISSING IN GCHART STREAM Explanation: Data coordinate system was requested and the X, Y and SUBGROUP variables contain missing values. User Action: The X, Y or SUBGROUP variable must have a value if a data coordinate system is requested. Check stream for improper request.
764
Chapter 30
CANNOT OMIT GROUP VARIABLE IF GCHART GROUPS ARE PRESENT Explanation: You used a data coordinate system and specied GROUP= in the GCHART procedure, but the Annotate data set does not contain the GROUP variable. User Action: Supply the GROUP variable in the Annotate data set. CHARACTER VALUE SHOWN IS NOT ON THE HORIZONTAL AXIS Explanation: The specied value of the XC variable is not on the x axis of the graph or chart. The observation is ignored. User Action: Check for misspelling, for uppercase or lowercase conict, or for exclusion in an axis specication. CHARACTER VALUE SHOWN IS NOT ON THE VERTICAL AXIS Explanation: The specied value of the YC variable does not occur on the y axis of the graph or chart. The observation is ignored. User Action: Check for misspelling, for uppercase or lowercase conict, or for exclusion in an axis specication. CONFLICT BETWEEN PROCEDURE AXIS TYPE AND ANNOTATE DATA TYPE Explanation: The axis type is character and the x and y coordinates are numeric or vice versa. User Action: Check values for proper type matching. DATA SYSTEM NOT SUPPORTED FOR THIS STATEMENT Explanation: The data coordinate systems 1, 2, 7, 8 are not permitted for this statement. User Action: Choose a different reference system for this observation. DATA SYSTEM REQUESTED, BUT POINT IS NOT ON GRAPH Explanation: The coordinate specied is not on displayed graph, and data coordinate system placement has been requested. User Action: Check for improper specication of data value or graph axis parameters, or incorrect system specication. If this occurs, you may be able to use percent of the data area to position Annotate graphics. G3D DATA SYSTEM REQUESTED, ALL SYSTEMS NOT DATA DEPENDENT Explanation: Not all requested XSYS, YSYS, and ZSYS variable values are data values. User Action: If one variable in G3D annotation is data-dependent, all variables must be data-dependent. Either specify all points in the data coordinate system or use another reference system value. G3D DATA SYSTEM REQUESTED, VARIABLE CONTAINED MISSING VALUE Explanation: The X, Y, or Z variable contained a missing value. User Action: All values in G3D data placement requests must be specied. Remove the missing value from the request. INTERNAL SYSTEM STACK OVERFLOW- TOO MANY PUSH FUNCTIONS Explanation: The limit of stack positions has been exhausted. The maximum number of stack positions is system-dependent. Each PUSH operation uses one position; each POP frees one position for re-use. User Action: Rewrite the program section to decrease the number of values stored in the stack. INTERNAL SYSTEM STACK UNDERFLOW- TOO MANY POP FUNCTIONS Explanation: The POP function has been issued with no values in the LIFO stack. User Action: Check for unequal numbers of PUSH versus POP functions. They can be unequal, but you cannot have more values moved with the POP function than are stored with the PUSH function. At least one PUSH must occur {it before} a POP can be issued.
Annotate Dictionary
765
LABEL FUNCTION REQUESTED, BUT TEXT VARIABLE NOT ON DATA SET Explanation: A TEXT variable has not been found for the LABEL function. User Action: If FUNCTION=LABEL, the TEXT variable must contain the string to be placed in the display area. Check for misspelling of variable name or specication of the wrong Annotate data set. LINE VALUE SPECIFIED IS NOT WITHIN LIMITS- 0<=L<=3 Explanation: An invalid special line value has been specied. User Action: The LINE value specied was not acceptable for FUNCTION=BAR or the RECT macro. Check function for denition of line values or previous value used in DATA step prior to this observation. LINE VALUE SPECIFIED IS NOT WITHIN LIMITS- 1<=L<=46 Explanation: The LINE value specied is not in the range 1 through 46. User Action: Check for improper specication of data value. Line styles represented by the LINE values can be found in the line-type tableSpecifying Line Types on page 275. MINIMUM VARIABLES NOT METAMBIGUITY PREVENTS SELECTION. Explanation: The combinations of available X, Y, XC, YC, GROUP, MIDPOINT, and SUBGROUP variables do not identify the data-dependent values uniquely. User Action: Check variable requirements and respecify. MINIMUM VARIABLES NOT MET- MUST HAVE X/XC,Y/YC IN DATA SET Explanation: The X, XC, Y, or YC variables have not been found in the Annotate data set. User Action: The X or XC and Y or YC variables must be in the data set. This message represents a minimum validity check of the supplied Annotate data set. POLYCONT ENCOUNTERED BEFORE POLY Explanation: The POLYCONT function was encountered with no POLY function specication. User Action: Probable sequencing error. Check for missing POLY command, improper ordering of polygon points, or interruption of POLY type commands by other valued functions. Also, check the value of WHEN for a mismatch. POLYCONT INTERRUPTED Explanation: A POLYCONT denition has been interrupted and resumed in the Annotate data set. This usually accompanies the error message
POLYCONT ENCOUNTERED BEFORE POLY
User Action: Check data stream for proper order. POSITION VALUE INVALID- MUST BE ONE OF 0123...9ABCDEF Explanation: The value of the POSITION variable is not in range 0 through 9 or A through F or <, +, or > in a LABEL command. User Action: Check desired value in POSITION description and correct. REQUESTED POLYGON CONTAINS TOO MANY VERTICES (OBSERVATIONS) Explanation: The maximum allocation for polygon points is exhausted. The maximum number of vertices is limited by a devices memory. User Action: Dene polygon with fewer points or break polygon into sections. SYSTEM VALUE INVALID- MUST BE ONE OF 0123...9ABC Explanation: The value supplied for the XSYS, YSYS, or HSYS variable is not valid. User Action: Check the desired value and correct the data set. TEXT STRING EXTENDS BEYOND BOUNDARY OF SYSTEM DEFINED Explanation: The text string is too long.
766
Chapter 30
User Action: Check for excessive SIZE value or shorten the string. This error could be caused by HSYS=4 and a small value of the VPOS graphics option. USE THE XC VARIABLE FOR DATA VALUES WHEN TYPE IS CHARACTER Explanation: The X variable is character type in the Annotate data set when it should be numeric. User Action: If character data are being plotted, use the XC variable to specify any data-related points pertaining to character values. If data are not character, omit quotes in X data value assignment. USE THE YC VARIABLE FOR DATA VALUES WHEN TYPE IS CHARACTER Explanation: The Y variable is character type in the Annotate data set when it should be numeric. User Action: If character data are being plotted, use the YC variable to specify any data-related points pertaining to character values. If data are not character, omit quotes in Y data value assignment. VALUE SHOWN IS NOT A VALID FONT OR PATTERN TYPE Explanation: The value of the STYLE variable is not a valid font or pattern. User Action: Check the value supplied for misspelling, truncation, and support in the FUNCTION description. VALUE SHOWN IS NOT A VALID FUNCTION Explanation: The value in the FUNCTION variable is not recognized as an available function. User Action: Check for misspellings or truncation of value. Truncation can be corrected by specifying a length of 8 bytes in the LENGTH statement in the DATA step that generates the data set. VALUE SHOWN IS NOT A VALID SIZE FACTOR Explanation: The SIZE value of the variable is negative or excessive. User Action: Check request or calculation for positive value result. VARIABLE SHOWN HAS IMPROPER LENGTH IN ANNOTATE= DATA SET Explanation: The length is incorrect for variable indicated. Either the length of the character string exceeds the length for the variable specied in a LENGTH statement, or the variable was not specied in a LENGTH statement. User Action: Make sure the variable length is dened in a length statement and that the length specied adequately covers the length of the character strings that are used. VARIABLE SHOWN IS NOT OF THE PROPER DATA TYPE Explanation: The data type does not match required type for variable listed. Either variable type is character where a numeric is required, or numeric where a character is required. User Action: Specify proper type for variable as described in Annotate Variables on page 702.
767
P A R T
4
769 813
768
769
CHAPTER
31
The DATA Step Graphics Interface
Overview 770 DSGI Funtions 771 DSGI Statements 772 Syntax 772 Requirements 772 Applications of the DATA Step Graphics Interface 773 Enhancing Existing Graphs 773 Creating Custom Graphs 773 Using the DATA Step Graphics Interface 774 Summary of Use 774 Producing and Storing DSGI Graphs 774 Structure of DSGI Data Sets 775 SAS/GRAPH Global Statements with DSGI 775 Operating States 775 The Current Window System 776 Debugging DSGI Programs 776 DSGI Graphics Summary 776 DSGI Functions 777 DSGI Routines 780 Creating Simple Graphics with DSGI 783 Setting Attributes for Graphics Elements 784 How Operating States Control the Order of DSGI Statements 785 Functions That Change the Operating State 786 Order of Functions and Routines 787 Bundling Attributes 789 Attributes That Can Be Bundled for Each Graphics Primitive 789 Assigning Attributes to a Bundle 789 Selecting a Bundle 790 Dening Multiple Bundles for a Graphics Primitive 790 How DSGI Selects the Value of an Attribute to Use 791 Disassociating an Attribute from a Bundle 791 Using Viewports and Windows 791 Dening Viewports 792 Clipping around Viewports 793 Dening Windows 793 Activating Transformations 793 Inserting Existing Graphs into DSGI Graphics Output 794 Generating Multiple Graphics Output in One DATA Step 795 Processing DSGI Statements in Loops 796 Examples 797 Vertically Angling Text 797
770
Overview
Chapter 31
Changing the Reading Direction of the Text 800 Using Viewports in DSGI 801 Scaling Graphs by Using Windows 804 Enlarging an Area of a Graph by Using Windows Using GASK Routines in DSGI 809 See Also 811
806
Overview
The DATA Step Graphics Interface (DSGI) enables you to create graphics output within the DATA step or from within a Screen Control Language ( SCL) application. Through DSGI, you can call the graphics routines used by SAS/GRAPH software to generate a custom graph, or to add features to an existing graph. You can use DSGI to write a custom graphics application in conjunction with all the power of the programming statements accessible by the DATA step. DSGI provides many of the same features as the Annotate facility, but it also has many advantages over the Annotate facility.
3 you can use DSGI functions and routines through SCL 3 you can save disk space. DSGI graphics can be generated through the DATA step
without creating an output data set. The graphics output is stored as a catalog entry in the catalog you select, and can be displayed after the DATA step is submitted.
3 DSGI generates graphics faster than the Annotate facility. With the Annotate
facility, you create a data set and then submit a PROC step to display the graphics output. In DSGI, you eliminate the PROC step because the graphics output is generated after the DATA step.
3 DSGI supports viewports and windows, which enable you to specify the
dimensions, position, and scale of the graphics output. You cam include multiple graphs in the same graphics output. Consider using the Annotate facility for enhancing procedure output. and using DSGI for creating custom graphics without using a graphics procedure. DSGI is based on the Graphics Kernel System (GKS) standard, although it does not follow a strict interpretation, nor is it implemented on a particular level of GKS. GKS was used to provide a recognizable interface to the user. Because of its modularity, the standard allows for enhancements to DSGI without the side effect of converting programs between versions of SAS/GRAPH software. The concepts used to create graphics output with DSGI are explained. An overview of the functions and routines used in DSGI are provided. For complete details of each function and routine, see Chapter 32, DATA Step Graphics Interface Dictionary, on page 813.
DSGI Funtions
771
DSGI Funtions
Figure 31.1
772
DSGI Statements
Chapter 31
DSGI Statements
Figure 31.2
Syntax
DSGI uses GASK routines and functions to draw graphics elements. These statements have the following syntax: CALL GASK(operator, arguments); return-code-variable=function-name (operator, arguments); where arguments return-codevariable function-name operator are the additional required variables or values for the routine or function. is an arbitrary name and can be any numeric variable name. It holds the return code upon execution of the function. is the DSGI command you want to execute and must be one of the following: GDRAW, GINIT, GPRINT, GRAPH, GSET, or GTERM. is a character string that names the function you either want to submit or for which you want the current settings. When used with functions, operator can take different values depending on function-name.
Requirements
When using DSGI statements, the following formats for arguments must be used:
773
3 All x and y coordinates are expressed in units of the current window system. (See
The Current Window System on page 776 for details.)
3 The arguments used with DSGI functions can be expressed as either constants or
variables. The arguments used with GASK routines must be variable names since values are returned through them. See Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for a complete explanation of each argument used with DSGI functions and routines.
3 All arguments that are character constants must be enclosed in either single or
double quotation marks.
3 the catalog in which the existing graph is located 3 the name of the existing graph 3 the coordinates of the place in the graphics output where you want to insert the
existing graph
3 a square coordinate system ((0,0) to (100,100)) 3 the statements to draw enhancements to the existing graph.
The coordinates that DSGI uses to position existing graphs, enhancements to that graph, or graphics elements are based on units of percent of the window system currently dened. See Using Viewports and Windows on page 791.
3 3 3 3 3 3 3 3 3
arcs bars ellipses elliptical arcs lines markers pie slices polygons (lled areas) text.
774
Chapter 31
3 DSGI statements to draw graphics elements 3 the coordinates of the graphics elements in the output.
You can also specify the color, pattern, size, style, and position of the graphics elements.
Summary of Use
To create graphics output using DSGI:
1 on a grid that matches the dimensions of the graphics output, sketch the output
initialize DSGI open a graphics segment generate graphics elements close the graphics segment end DSGI.
4 Submit the DATA step with a nal RUN statement to display the output.
Note: The DISPLAY graphics option must be in effect for the graphics output to be displayed. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for more information about the DISPLAY graphics option. 4
Operating States
775
Operating States
The operating state of DSGI determines which functions and routines can be issued at any point in the DATA step. You can submit a function or routine only when the
776
Chapter 31
operating state is appropriate. Reference How Operating States Control the Order of DSGI Statements on page 785 for how functions and routines should be ordered within the operating states. The operating states dened by DSGI are: GKCL GKOP SGOP WSAC WSOP facility closed, the initial state of DSGI. No graphical resources have been allocated. facility open. When DSGI is open, you can check the settings of the attributes. segment open. At this point, graphics output primitives can be generated. workstation active. When the workstation is active, it can receive DSGI statements. workstation open. In this implementation, the graphics catalog, either the default or the one specied through the GSET(CATALOG, . . . )command, is opened or created.
Refer to individual functions and routines in Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for the operating states from which a function or routine can be issued.
DSGI Functions
777
DSGI Functions
DSGI provides functions that 3 initialize and terminate DSGI 3 generate graphics elements 3 control the appearance of graphics elements by setting attributes 3 control the overall appearance of the graphics output 3 perform management operations for the catalog 3 control messages issued by DSGI. Table 31.1 on page 777 summarizes the types of operations available and the functions used to invoke them. Refer to Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for details about each function.
Table 31.1 DATA Step Graphics Interface Functions
Function Description
DSGI Operations
Associated Function
Bundling Attributes (valid values for xxx are FIL, LIN, MAR, and TEX) GSET(ASF, . . .) sets the aspect source ag of an attribute selects the bundle of attributes to use assigns attributes to a bundle
GSET(xxxINDEX, . . . ) GSET(xxxREP, . . . )
Setting Attributes That Affect Graphics Elements color index ll area GSET(COLREF), . . .) GSET(FILCOLOR, . . . ) GSET(FILSTYLE, . . . ) assigns a color name to color index selects the color of the ll area selects the pattern when FILTYPE is HATCH or PATTERN species the type of interior for the ll area species the HTML string to invoke when an affected DSGI graphic element in a web page is clicked selects the color of the line sets the type of line
GSET(FILTYPE, . . . )
GSET(HTML, . . . )
line
GSET(LINCOLOR, . . . ) GSET(LINTYPE, . . . )
778
DSGI Functions
Chapter 31
DSGI Operations
Function Description species the width of the line selects the color of the marker determines the size of the marker sets the type of marker drawn species horizontal and vertical alignment of text selects the color of the text sets the font for the text selects the height of the text determines reading direction of text selects the angle of text
marker
text
GSET(TEXALIGN, . . . )
Setting Attributes That Affect Entire Graph GSET(ASPECT, . . .) GSET(CATALOG, . . . ) GSET(CBACK, . . . ) GSET(DEVICE, . . . ) GSET(HPOS, . . . ) sets the aspect ratio selects the catalog to use selects the background color species the output device sets the number of columns in the graphics output area sets the width of the graphics output area in units of inches sets the number of rows in the graphics output area
GSET(HSIZE, . . . )
GSET(VPOS, . . . )
DSGI Functions
779
DSGI Operations
Function Description sets the height of the graphics output area in units of inches
Managing Catalogs GRAPH(COPY, . . .) copies a graph to another entry within the same catalog deletes a graph inserts a previously created graph into the currently open segment renames a graph
GRAPH(DELETE, . . . ) GRAPH(INSERT, . . . )
GRAPH(RENAME, . . . ) Drawing Graphics Elements arc bar ellipse GDRAW(ARC, . . .) GDRAW(BAR, . . . ) GDRAW(ELLIPSE, . . . )
draws a circular arc draws a rectangle that can be lled draws an oblong circle that can be lled draws an elliptical arc draws a polygon that can be lled draws a single line, a series of connected lines, or a dot draws one or more symbols draws a pie slice that can be lled draws a character string
Initializing DSGI GINIT( ) GRAPH(CLEAR, . . . ) initializes DSGI opens a segment to receive graphics primitives
Handling Messages
780
DSGI Routines
Chapter 31
DSGI Operations
Function Description prints a message in the SAS log prints the description of a DSGI error code turns message logging on or off
GSET(MESSAGE, . . . )
Ending DSGI GRAPH(UPDATE, . . .) closes the currently open segment and, optionally, displays it ends DSGI
Dening Viewports GSET(CLIP, . . .) GSET(VIEWPORT, . . . ) turns clipping on or off sets the coordinates of the viewport and assigns it a transformation number
Defining Windows GSET(WINDOW, . . .) sets the coordinates of the window and assigns it a transformation number
DSGI Routines
DSGI routines return the values set by some of the DSGI functions. Table 31.2 on page 781 summarizes the types of values that the GASK routines can check. Refer to Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for details about each routine.
DSGI Routines
781
Table 31.2
DSGI Operations
Associated Routine
Routine Description
Checking Attribute Bundles (valid values for xxx are FIL, LIN, MAR, and TEX) GASK(ASK, . . .) GASK(xxxINDEX, . . . ) GASK(xxxREP, . . . ) returns the aspect source ag of the attribute returns the index of the active bundle returns the attributes assigned to the bundle
Checking Attribute Settings color index GASK(COLINDEX, . . .) returns the color indices that currently have colors assigned to them returns the color name assigned to the color index returns the color of the ll area returns the index of the pattern when the FILTYPE is HATCH or PATTERN returns the index of the type of interior nds the HTML string that is in effect when one of the following graphic elements is drawn: bar, ellipse, ll, mark, pie, and text. returns the color index of the color of the line returns the index of the type of line returns the width of the line returns the color index of the color of markers returns the size of markers returns the index of the type of marker drawn returns the horizontal and vertical alignment of text returns the color index of the color of text returns the coordinates of text extent rectangle and the text concatenation point of the character string returns the text font
GASK(FILTYPE, . . . ) GASK(HTML, . . . )
line
marker
text
GASK(TEXFONT, . . . )
782
DSGI Routines
Chapter 31
DSGI Operations
Routine Description returns the height of text returns the reading direction of text returns the character up vector in x vector and y vector
Checking Attributes That Affect Entire Graph GASK(ASPECT, . . . ) GASK(CATALOG, . . . ) GASK(CBACK, . . . ) GASK(DEVICE, . . . ) GASK(HPOS, . . . ) GASK(HSIZE, . . . ) GASK(MAXDISP, . . . ) returns the aspect ratio returns the current catalog returns the background color returns the current output device returns the number of columns in the graphics output area returns the width of the graphics output area in units of inches returns the dimensions of maximum display area for the device in meters and pixels returns the number of rows in the graphics output area returns the height of the graphics output area in units of inches
GASK(VPOS, . . . ) GASK(VSIZE, . . . )
Querying Catalogs GASK(GRAPHLIST, . . .) GASK(NUMGRAPH, . . . ) GASK(OPENGRAPH, . . . ) returns the names of graphs in the current catalog returns the number of graphs in the current catalog returns the name of the currently open graph
Checking System Status GASK(STATE, . . .) GASK(WSACTIVE, . . . ) GASK(WSOPEN, . . . ) returns the current operating state returns whether or not the workstation is active returns whether or not the workstation is open
Checking Transformation Definitions GASK(TRANS, . . .) returns the coordinates of the viewport and window associated with the transformation returns the active transformation number
GASK(TRANSNO, . . . )
783
DSGI Operations
Routine Description returns the status of clipping returns the coordinates of the viewport assigned to the transformation number
Checking Window Definitions GASK(WINDOW, . . .) returns the coordinates of the window assigned to the transformation number
Before you can submit graphics primitives, you must submit the GRAPH(CLEAR, . . .) function. GRAPH(CLEAR, . . .) opens a graphic segment, to allow graphics primitives to be submitted.
3 Generate graphics elements.
DSGI can generate arcs, bars, ellipses, elliptical arcs, lines, markers, pie slices, polygons (ll areas), and text. These graphics elements are all produced with the GDRAW function using their associated operator names. GDRAW functions can be submitted only when a graphics segment is open. They must be submitted between the GRAPH(CLEAR, . . .) and GRAPH(UPDATE, . . .) functions. 4 Close the graphics segment. Once the attribute and graphics statements have been entered, you must submit statements to close the graphics segment and output the graph. The GRAPH(UPDATE, . . .) function closes the graphic segment currently open and, can display the graphics output.
5 End DSGI.
The GTERM() function ends DSGI by deactivating and closing the workstation, and closing the graphics sublibrary. It frees any memory allocated by DSGI. Note: You must execute a RUN statement at the end of the DATA step to display the output. Figure 31.3 on page 784 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.
784
Chapter 31
Figure 31.3
. . .
data dsname;
/* Step 3 - generate graphics elements */ rc=gdraw('line' ,2, 30, 50, 70, 50);
. . .
Notice that there are two pairs of functions that work together within a DSGI DATA step (shown by a and b in Figure 31.3 on page 784). The rst pair, GINIT() and GTERM(), begin and end DSGI. Within the rst 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 on page 795 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 on page 785.
785
Table 31.3
Functions GDRAW(ARC, . . . )
Associated Attributes HTML, LINCOLOR, LININDEX, LINREP, LINTYPE, LINWIDTH FILCOLOR, FILINDEX, FILREP, FILSTYLE, FILTYPE, HTML FILCOLOR, FILINDEX, FILREP, FILSTYLE, FILTYPE, HTML HTML, LINCOLOR, LININDEX, LINREP, LINTYPE, LINWIDTH FILCOLOR, FILINDEX, FILREP, FILSTYLE, FILTYPE, HTML HTML, LINCOLOR, LININDEX, LINREP, LINTYPE, LINWIDTH HTML, MARCOLOR, MARINDEX, MARREP, MARSIZE, MARTYPE FILCOLOR, FILINDEX, FILREP, FILSTYLE, FILTYPE, HTML HTML, TEXALIGN, TEXCOLOR, TEXFONT, TEXHEIGHT, TEXINDEX, TEXPATH, TEXREP, TEXUP
Bar
GDRAW(BAR, . . . )
Ellipse
GDRAW(ELLIPSE, . . . )
Elliptical Arc
GDRAW(ELLARC, . . . )
Fill Area
GDRAW(FILL, . . . )
Line
GDRAW(LINE, . . . )
Marker
GDRAW(MARK, . . . )
Pie
GDRAW(PIE, . . . )
Text
GDRAW(TEXT, . . . )
Attribute functions must precede the graphics primitive they control. Once an attribute is set, it controls any associated graphics primitives that follow. If you want to change the setting, you can issue another GSET(attribute, . . . )function with the new setting. If you do not set an attribute before you submit a graphics primitive, DSGI uses the default value for the attribute. Refer to Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for the default values used for each attribute.
786
Chapter 31
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 on page 814 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) */
*/ */ */ */ */ */ */
*/ */ */ */ */
787
/* 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; */
*/ */ */ */ */ */ */
788
Chapter 31
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, "GDSORDER */ */ */ ");
/* 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;
Display 31.1
Bundling Attributes
789
Bundling Attributes
DSGI allows you to bundle attributes. As a result, you can select a group of attribute values rather than having to select each one individually. This feature is useful if you use the same attribute settings over and over within the same DATA step. To use an attribute bundle, you assign the values of the attributes to a bundle index. When you want to use those attributes for a graphics primitive, you select the bundle rather than set each attribute separately.
Graphics Output Primitive GDRAW(ARC, . . . ) GDRAW(BAR, . . . ) GDRAW(ELLARC, . . . ) GDRAW(ELLIPSE, . . . ) GDRAW(FILL, . . . ) GDRAW(LINE, . . . ) GDRAW(MARK, . . . ) GDRAW(PIE, . . . ) GDRAW(TEXT, . . . )
790
Bundling Attributes
Chapter 31
for the bundle is green, the second color in the COLOR= graphics option. The font for the bundle is the ZAPF font. (See COLREP on page 876 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.");
The bundled attributes are used when an associated GDRAW function is executed. If the ASF of an attribute is not set to BUNDLED at the time a GDRAW function is executed, DSGI searches for a value to use in the following order:
1 the current value of the attribute 2 the default value of the attribute.
Selecting a Bundle
Once you have issued the GSET(ASF, . . . )and GSET(xxx REP, . . . )functions, you can issue the GSET(xxx INDEX, . . . )function to select the bundle. The following statement selects the bundle dened in the previous example:
/* invoke the bundle of text attributes */ rc=gset("texindex", 1);
The 1 in this example corresponds to the index number specied in the GSET(TEXREP, . . . )function.
When you activate the second bundle, the graphics primitives for the text that follows uses the third color, blue, and the SWISS font. Note: When using a new bundle, you do not need to reissue the GSET(ASF, . . . ) functions for the bundled attributes. Once the ASF of an attribute has been set, the setting remains in effect until it is changed. 4
791
In subsequent statements, you activate the bundle, select other attributes for the line, and then draw a line:
/* 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);
The color, type, and width associated with the line bundle are used rather than the attributes set just before the GDRAW(LINE, . . . )function was executed. The line that is drawn is green (the second color from the color list of the COLORS= graphics option), ve units wide, and solid (line type 1). During processing, DSGI chooses the value of an attribute using the following logic: 1 Get the index of the active line bundle. 2 Check the ASF of the LINCOLOR attribute. If the ASF is INDIVIDUAL, the value selected with GSET(LINCOLOR, . . .) is used; otherwise, the LINCOLOR associated with the bundle index is used. 3 Check the ASF of the LINTYPE attribute. If the ASF is INDIVIDUAL, the value selected with GSET(LINTYPE, . . .) is used; otherwise, the LINTYPE associated with the bundle index is used. 4 Check the ASF of the LINWIDTH attribute. If the ASF is INDIVIDUAL, the value selected with GSET(LINWIDTH, . . .) is used; otherwise, the LINWIDTH associated with the bundle index is used. 5 Draw the line using the appropriate color, type, and width for the line.
792
Chapter 31
smaller sections of the graphics output area. Windows dene the coordinate system within a viewport and enable you to scale the graph or graphics elements drawn within the viewport. The default viewport is dened as (0,0) to (1,1) with 1 being 100 percent of the graphics output area. If you do not dene a viewport, graphics elements or graphs are drawn using the default. The default window is dened so that a rectangle drawn from window coordinates (0,0) to (100,100) is square and lls the display in one dimension. The actual dimensions of the default window are device dependent. Use the GASK(WINDOW, . . . ) routine to nd the exact dimensions of your default window. You can dene a window without dening a viewport. The coordinate system of the window is used with the default viewport. If you dene a viewport, you can position it anywhere in the graphics output area. You can dene multiple viewports within the graphics output area so that more than one existing graph, part of a graph, or more than one graphics element can be inserted into the graphics output. Transformations activate both a viewport and the associated window. DSGI maintains 21 (0 through 20) transformations. By default, transformation 0 is active. Transformation 0 always uses the entire graphics output area for the viewport, and maps the window coordinates to ll the viewport. The denition of the viewport and window of transformation 0, cannot be changed. By default, the viewports and windows of all the other transformations (1 through 20) are set to the defaults for viewports and windows. If you want to dene a different viewport or window, you must select a transformation number between 1 and 20. You generally follow these steps when dening viewports or windows: 3 Dene the viewport or window. 3 Activate the transformation so that the viewport or window is used for the output. These steps can be submitted in any order; however, if you use a transformation you have not dened, the default viewport and window are used. Once you activate a transformation, the graphics elements drawn by the subsequent DSGI functions are drawn in the viewport and window associated with that transformation.
Dening Viewports
You can dene a viewport with the GSET(VIEWPORT, n, . . . )function, where n is the transformation number of the viewport you are dening. You can also use this function to dene multiple viewports, each containing a portion of the graphics output area. You can then place a separate graph, part of a graph, or graphics elements within each viewport. 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);
Once you dene the viewports, you can insert existing graphs or draw graphics elements in each viewport by activating the transformation of that viewport.
793
Dening Windows
You can dene a window by using the GSET(WINDOW,n, . . . )function, where n is the transformation number of the window you are dening. If you are dening a window for a viewport you have also dened, n must match the transformation number of the viewport. You can scale the x and y axes differently for a window. The following program statements scale the axes for each of the four viewports dened earlier in Dening Viewpoints:
/* 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 on page 804 for an example of using windows to scale graphs. Note: When you dene a window for a viewport, the transformation numbers in the GSET(VIEWPORT, . . . )and GSET(WINDOW, . . . )functions must match in order for DSGI to activate them simultaneously. 4
Activating Transformations
Once you have dened a viewport or window, you must activate the transformation in order for DSGI to use the viewport or window. To activate the transformation, use the GSET(TRANSNO,n, . . . )function where n has the same value as n in GSET(VIEWPORT,n, . . . )or GSET(WINDOW,n, . . . ). The following program statements illustrate how to activate the viewports and windows dened in the previous examples:
/* define the viewports */ . . . /* define the windows */ . . . /* activate the first transformation */
794
Chapter 31
rc=gset("transno", 1); . . /* graphics primitive functions follow */ . /* activate the second transformation */ rc=gset("transno", 2); . . /* graphics primitive functions follow */ . /* activate the third transformation */ rc=gset("transno", 3); . . /* graphics primitive functions follow */ . /* activate the fourth transformation */ rc=gset("transno", 4); . . /* graphics primitive functions follow */ .
When you activate these transformations, your display is logically divided into four subareas as shown in Figure 31.4 on page 794.
Figure 31.4
If you want to return to the default viewport and window, execute the GSET(TRANSNO, 0) function.
795
Note: Unless you are using the WORK library, you must have previously dened the libref in a LIBNAME statement or window when using GSET(CATALOG, . . . ). 4
2 Dene a viewport with the dimensions and position of the place in the graphics
output where you want to insert the existing graph. GSET(VIEWPORT,n, . . . ) denes a viewport and GSET(WINDOW,n, . . . )denes a window.
3 Dene a window as (0,0) to (100,100) so that the inserted graph is not distorted.
The graph must have a square area dened to avoid the distortion. If your device does not have a square graphics output area, the window defaults to the units of the device rather than (0,0) to (100,100) and might distort the graph.
4 Activate the transformation number n, as dened in the viewport function, and
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.
Example Code 31.1 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.
796
Chapter 31
Each time the GRAPH(UPDATE, . . . )function is executed, a graph is displayed. After the GTERM() function is executed, no more graphs are displayed for the DATA step. The GINIT() function must be executed again to produce more graphs. CAUTION:
Be careful using global SAS/GRAPH statements when you are producing multiple output from within the DATA step. 4
If you use global SAS/GRAPH statements when producing multiple output from one DATA step, the last denition of the statements is used for all displays.
The inner loop produces ve graphs for each device. Each graphics output produced by the inner loop consists of a bar. The bar uses a different color for each graph. The outer loop produces all of the graphs for ve different devices. A total of 25 graphs is generated by these loops.
Examples
797
Examples
The following examples show different applications for DSGI and illustrate some of its features such as dening viewports and windows, inserting existing graphs, angling text, using GASK routines, enlarging a segment of a graph, and scaling a graph. These examples use some additional graphics options that cannot be used in other examples in this book. Because the dimensions of the default window vary across devices, the TARGETDEVICE=, HSIZE=, and VSIZE= graphics options are used to make the programs more portable. The COLORS= graphics option provides a standard color list. Refer to Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for a complete description of each of the functions used in the examples.
798
Examples
Chapter 31
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;
Examples
799
Display 31.2
3 The COLORS= graphics option provides a color table to be used with the
GSET(LINCOLOR, . . . )function.
3 The HSIZE= graphics option provides a standard width for the graphics output
area.
3 The VSIZE= graphics option provides a standard height for the graphics output
area.
3 The GINIT() function begins DSGI. 3 The GRAPH(CLEAR) function sets the graphics environment. Because the
function does not specify a name for the catalog entry, DSGI is the default name.
3 The GDRAW(LINE, . . . )function draws a line. It provides the type of line, the
coordinates of the beginning point, and the coordinates of the ending point.
3 The GDRAW(TEXT, . . . )function draws the text. It sets the coordinates of the
starting point of the text string as well as the text string to be written.
800
Examples
Chapter 31
3 The GRAPH(UPDATE, . . . )function closes the graphics segment. 3 The GTERM() function ends DSGI.
Examples
801
Display 31.3
Reading Direction of the Text Changed with the GSET(TEXPATH, ...) Function
Features not explained earlier in Vertically Angling Text are described here: 3 DATA _NULL_ causes the DATA step to be executed, but no data set is created. 3 The GSET(TEXPATH, . . . )function changes the direction in which the text reads.
/* create data set TOTALS */ data totals; length dept $ 7 site $ 8; do year=1996 to 1999; do dept="Parts","Repairs","Tools"; do site="New York","Atlanta","Chicago","Seattle"; sales=ranuni(97531)*10000+2000; output; end; end; end;
802
Examples
Chapter 31
run; /* define the footnote */ footnote1 h=3 j=r "GDSVWPTS "; /* 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="GDSVWPTS"; 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", "GDSVWPTS"); /* display graph and end DSGI */ rc=graph("update"); rc=gterm(); run;
Examples
803
Display 31.4
Display 31.5
Features not explained in previous examples are described here: 3 A graph can be created by another SAS/GRAPH procedure and inserted into DSGI graphics output. In this case, the NAME= option in the PIE statement of the GCHART procedure names the graph, GDSVWPTS, to be inserted into the DSGI graphics output. 3 The GSET(VIEWPORT, . . . )function denes the section of the graphics output area into which GDSVWPTS is inserted. The dimensional ratio of the viewport should match that of the entire graphics output area so that the inserted graph is not distorted. 3 The GSET(WINDOW, . . . )function denes the coordinate system to be used within the viewport. In this example, the coordinates (0,0) to (100,100) are used. These coordinates provide a square area to insert the graph and preserve the aspect ratio of the GCHART graph.
804
Examples
Chapter 31
Examples
805
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 GDSSCALE proc gplot data=earn; plot amount*month / haxis=axis2 vaxis=axis1 name="GDSSCALE"; run; /* define the footnote and titles for /* second graph, scales the output */ footnote1 j=r "GDSSCALE(b) "; title1 "XYZ Corporation Annual Earnings"; title2 h=4 "Fiscal Year 1999"; /* /* /* /* data execute DATA step with DSGI using */ catalog entry created in previous */ plot, but do not create a data set */ (determined by specifying _NULL_) */ _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", "GDSSCALE"); /* display graph and end DSGI */ rc=graph("update"); rc=gterm(); run;
806
Examples
Chapter 31
Display 31.6
Display 31.7
3 The GSET(WINDOW, . . . )function scales the plot with respect to the viewport
that is dened. The x axis is scaled from 15 to 95, and the y axis is scaled from 15 to 75. If no viewport were explicitly dened, the window coordinates would be mapped to the default viewport, the entire graphics output area.
Examples
807
following program statements produce Display 31.8 on page 808 from the rst DATA step, and Display 31.9 on page 809 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 "GDSENLAR(a) "; /* execute DATA step with DSGI */ data plot; /* prepare SAS/GRAPH software */ /* to accept DSGI statements */ rc=ginit(); rc=graph("clear", "GDSENLAR"); /* 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 "GDSENLAR(b) "; /* /* /* data execute DATA step with DSGI */ that zooms in on a section of */ the previous graph */ zoom;
808
Examples
Chapter 31
/* to accept DSGI statements */ rc=ginit(); rc=graph("clear"); /* define and activate a window */ /* that enlarges 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", "GDSENLAR"); /* display graph and end DSGI */ rc=graph("update"); rc=gterm(); run;
Display 31.8
Examples
809
Display 31.9
Features not explained in previous examples are described here: 3 The GSET(WINDOW, . . . )function denes a window into which the graph is inserted. In this example, no viewport is dened, so the window coordinates map to the default viewport, which is the entire graphics output area. The result of using the default viewport is that only the portion of the graph enclosed by the coordinates of the window is displayed. 3 The GRAPH(INSERT, . . . )function inserts a graph that was previously generated with DSGI. The output le to be inserted must be closed.
810
Examples
Chapter 31
/* 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 */ rc=graph("update"); rc=gterm(); run; /* display the contents of ROUTINE */ proc print data=routine; run;
Output 31.1
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 */ 25 rc=graph("update"); 26 rc=gterm(); 27 run; Current FILCOLOR =ORANGE
Output 31.2
See Also
811
3 GASK routines check the current value of an attribute. In this example, the
GASK(COLREP, . . . )function returns the color associated with color index 2.
3 3 3 3
A PUT statement displays the value of the COLOR argument in the log. An OUTPUT statement writes the value of COLOR to the ROUTINE data set. The GRAPH(UPDATE) function closes the graphics segment. The PRINT procedure displays the contents of the ROUTINE data set.
See Also
Specifying the Catalog Name and Entry Name for Your GRSEGs on page 100 for an explanation of graphics catalogs and catalog entries Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for complete information about graphics options TITLE, FOOTNOTE, and NOTE Statements on page 278 for details of using the TITLE and FOOTNOTE statements GOPTIONS Statement on page 219 for details of using the GOPTIONS statement Chapter 29, Using Annotate Data Sets, on page 643 for an explanation of the Annotate facility Chapter 32, DATA Step Graphics Interface Dictionary, on page 813 for complete information on the functions and routines used with DSGI SAS Language Reference: Dictionary for information about additional functions and statements that can be used in the DATA step
812
813
CHAPTER
32
DATA Step Graphics Interface Dictionary
Overview 813 Operating States 814 Utility Functions 814 GASK Routines 816 GDRAW Functions 855 GRAPH Functions 866 GSET Functions 871 Return Codes for DSGI Routines and Functions See Also 909 References 910
908
Overview
This chapter contains detailed descriptions of each command used in the DATA Step Graphics Interface (DSGI). The following commands are associated with DSGI:
1 utility functions
Each routine or function is followed by an alphabetical listing of the operators used with it. For each operator, this chapter provides the statement syntax, other argument denitions, and notes about using the functions and routines, operating states, and return codes. Operating states are summarized in Operating States on page 775. The syntax for all routines and functions contains the argument return-code-variable. This argument must be a numeric variable name and can be a different variable name for each routine. The return-code-variable argument is used to debug DSGI programs. It contains the return code of the routine or function call. If the return code is any value other than 0, the routine or function did not execute properly. Each routine and function has a different set of possible return codes. The return codes are listed in the heading for the routine or function. Refer to Return Codes for DSGI Routines and Functions on page 908 for an explanation of the return codes.
814
Operating States
Chapter 32
Operating States
This list summarizes the operating states in DSGI. For a detailed discussion of operating states, see Operating States on page 775. GKCL GKOP SGOP WSAC WSOP facility closed, initial state of DSGI. facility open. DSGI is open. You can check the settings of attributes. segment open. Graphics output can be generated. workstation active. You can issue DSGI statements. workstation open. The graphics catalog is opened or created.
Utility Functions
Utility functions enable you to initialize a session for DSGI, print error messages, and terminate the session.
GINIT
Initializes DSGI
Operating States: GKCL Return Codes: Resulting Operating State:
Syntax
return-code-variable=GINIT();
Description
The GINIT function performs three functions: it readies the library that contains SAS/GRAPH graphics routines, it opens a workstation, and it activates it. A workstation is a Graphics Kernel Standard (GKS) concept. GKS allows for multiple workstations to be open at the same time; however, for DSGI applications, you always use exactly one workstation. This function moves the operating state from GKCL to WSAC.
See Also
GTERM on page 815
GPRINT
Prints the specied interface error message
GTERM
815
Syntax
return-code-variable=GPRINT(code);
Description
The GPRINT function displays the message that corresponds to the error code entered. You can use this routine if you have disabled automatic error logging but still want to display the message associated with a return code you have received.
Argument Denitions
code numeric constant or numeric variable name; should be the value of a return code received from some previous function.
See Also
MESSAGE on page 893
GTERM
Terminates DSGI
Operating States: WSAC Return Codes: 0, 3 Resulting Operating State: GKCL
Syntax
return-code-variable=GTERM();
Description
The GTERM function performs three functions: it deactivates the workstation, closes the workstation, and closes the library that contains SAS/GRAPH routines. This function should be issued to free memory allocated by DSGI. This function moves the operating state from WSAC to GKCL.
See Also
GINIT on page 814
816
GASK Routines
Chapter 32
GASK Routines
When you use GASK routines, remember the following:
3 All arguments are required. 3 Most arguments are expressed as variable names. You can use any valid SAS
variable name.
3 GASK routines do not change the operating state. 3 PUT statements display a value returned by a routine in the SAS log. 3 OUTPUT statements write a value that is returned by a routine to a data set.
GASK routines enable you to check these current attribute settings: ASF ASPECT CATALOG CBACK CLIP COLINDEX COLREP DEVICE FILCOLOR FILINDEX FILREP FILSTYLE FILTYPE GRAPHLIST HPOS HSIZE HTML LINCOLOR LININDEX LINREP LINTYPE LINWIDTH MARCOLOR MARINDEX
ASF
817
MARREP MARSIZE MARTYPE MAXDISP NUMGRAPH OPENGRAPH PATREP STATE TEXALIGN TEXCOLOR TEXEXTENT TEXFONT TEXHEIGHT TEXINDEX TEXPATH TEXREP TEXUP TRANS TRANSNO VIEWPORT VPOS VSIZE WINDOW WSACTIVE WSOPEN
ASF
Finds whether an aspect source ag is bundled or separate
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(ASF, attribute, status, return-code-variable);
Description
The GASK(ASF, . . . )routine returns the aspect source ag (ASF) of a particular attribute. Possible ASF values are BUNDLED (associated with a bundle index) and
818
ASPECT
Chapter 32
INDIVIDUAL (separate from a bundle index). GASK(ASF, . . . )returns the default value INDIVIDUAL if you have not set the ASF for an attribute.
Argument Denitions
attribute character string enclosed in quotes or character variable name with one of the following values: 3 FILCOLOR 3 FILSTYLE 3 FILTYPE
3 3 3 3 3 3 3 3
status return-codevariable
character variable name; returns either the value BUNDLED or INDIVIDUAL. numeric variable name; returns the return code of the routine call.
See Also
ASF on page 872 FILCOLOR on page 878 FILSTYLE on page 880 FILTYPE on page 882 LINCOLOR on page 885 LINTYPE on page 888 LINWIDTH on page 888 MARCOLOR on page 889 MARSIZE on page 891 MARTYPE on page 892 TEXCOLOR on page 896 TEXFONT on page 897
ASPECT
Finds the aspect ratio
Operating States: All Return Codes:
CATALOG
819
Syntax
CALL GASK(ASPECT, aspect, return-code-variable);
Description
The GASK(ASPECT, . . . )routine returns the current aspect ratio used to draw graphics output. GASK(ASPECT, . . . )searches for the current aspect ratio in the following order: 1 the aspect ratio set with the GSET(ASPECT, . . . )function 2 the ASPECT= graphics option 3 the devices default aspect ratio found in the device entry. For more information on device entries, see Chapter 38, The GDEVICE Procedure, on page 1125.
Argument Denitions
aspect return-codevariable numeric variable name; returns the aspect ratio. numeric variable name; returns the return code of the routine call.
See Also
ASPECT= graphics option (see ASPECT on page 333) ASPECT on page 874
CATALOG
Finds the catalog for the graphs
Operating States: All Return Codes: 0
Syntax
CALL GASK(CATALOG, libref, memname, return-code-variable);
Description
The GASK(CATALOG, . . . )routine returns the libref and the name of the current output catalog. GASK(CATALOG, . . . )returns the default catalog, WORK.GSEG, if no other catalog has been specied with the GSET(CATALOG, . . . )function.
Argument Denitions
libref character variable name; returns the libref of the library in which the current catalog is stored.
820
CBACK
Chapter 32
memname return-codevariable
character variable name; returns the name of the current output catalog. numeric variable name; returns the return code of the routine call.
See Also
CATALOG on page 874 NUMGRAPH on page 839 OPENGRAPH on page 840
CBACK
Finds the background color
Operating States: All Return Codes: 0
Syntax
CALL GASK(CBACK, cback, return-code-variable);
Description
The GASK(CBACK, . . . )routine returns the current background color. GASK(CBACK, . . . )searches for the current background color in the following order: 1 the background color selected with the GSET(CBACK, . . . )function 2 the CBACK= graphics option 3 the default background color for the device found in the device entry. For more information about device entries, see Chapter 38, The GDEVICE Procedure, on page 1125.
Argument Denitions
cback return-codevariable character variable name; returns the background color name. numeric variable name; returns the return code of the routine call.
See Also
CBACK= graphics option (see CBACK on page 337) CBACK on page 875
CLIP
Finds whether clipping is on or off
COLINDEX
821
Syntax
CALL GASK(CLIP, status);
Description
The GASK(CLIP, . . . )routine checks whether clipping outside of viewports is enabled or disabled. One of the two following messages is displayed when this routine is called:
NOTE: Clipping is ON.
or
NOTE: Clipping is OFF.
Argument Denitions
status numeric variable name; returns the current setting, 55 (ON) or 56 (OFF), for clipping.
See Also
CLIP on page 876
COLINDEX
Finds the color indexes that have colors associated with them
Operating States: Return Codes:
SGOP 0, 4, 86, 87
Syntax
CALL GASK(COLINDEX, n, index-array, return-code-variable);
Description
The GASK(COLINDEX, . . . )routine returns the color indexes that currently have colors assigned to them.
Argument Denitions
n numeric constant or numeric variable name; tells how many color indexes you want returned. If n is expressed as a variable, the variable must be initialized. The variable returns the number of colors currently assigned. If n is expressed as a constant, this value is not returned.
822
COLREP
Chapter 32
index-array
list of numeric variables into which the used color index numbers are returned. The list of variable names can be members of an array or OF argument lists (where the arguments are variables). If you are using an array, index-array must have been declared as an array. The dimension of the array is determined by the number of color indexes you want returned. Refer to the discussion of ARRAY in SAS Language Reference: Dictionary for more information about OF argument lists. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
COLREP on page 822 COLREP on page 876
COLREP
Finds the color name associated with a color index
Operating States: SGOP Return Codes:
0, 4, 86, 87
Syntax
CALL GASK(COLREP, color-index, color, return-code-variable);
Description
The GASK(COLREP, . . . )routine returns the predened SAS color name associated with a color index. GASK(COLREP, . . . )searches for the current color assigned to a color index in the following order: 1 the color selected by the GSET(COLREP, . . . )function. 2 the COLORS= graphics option. If color-index is 2, the routine returns the second color from the color list of the COLORS= graphics option. 3 the devices default color list found in the device entry. If color-index is 2, the routine returns the second color from the default color list. See SAS Color Names and RGB Values in the SAS Registry on page 173 for a list of SAS predened color names.
Argument Denitions
color-index color return-codevariable numeric constant; indicates the color index for which you want to check the color. Valid values are 1 to 256, inclusive. character variable name; returns the color name associated with color-index. numeric variable name; returns the return code of the routine call.
FILCOLOR
823
See Also
COLINDEX on page 821 COLREP on page 876
DEVICE
Finds the output graphics device
Operating States: All Return Codes: 0
Syntax
CALL GASK(DEVICE, device, return-code-variable);
Description
The GASK(DEVICE, . . . )routine returns the current device. This routine returns the device set by one of the following methods:
3 3 3 3
the GSET(DEVICE, . . . )function the DEVICE= graphics option the device you entered in the DEVICE prompt window the device you entered in the OPTIONS window.
There is no default value for a device. To use DSGI, you must specify a device. For more information about devices, see Overriding the Default Device on page 72.
Argument Denitions
device return-codevariable character variable name; returns the name of the device driver. numeric variable name; returns the return code of the routine call.
See Also
DEVICE= graphics option (see DEVICE on page 350) See also: Overriding the Default Device on page 72
FILCOLOR
Finds the color index of the color to be used to draw ll areas
Operating States: GKOP, SGOP, WSAC, WSOP
824
FILINDEX
Chapter 32
Return Codes:
0, 8
Syntax
CALL GASK(FILCOLOR, color-index, return-code-variable);
Description
The GASK(FILCOLOR, . . . )routine returns the current ll color. If a GSET(FILCOLOR, . . . )function has not been previously submitted, GASK(FILCOLOR, . . . )returns the default value, 1. The color index returned corresponds to a color specication in the following order:
1 the color assigned to a color name with the GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the device entry.
Argument Denitions
color-index return-codevariable numeric variable name; returns the color index of the ll color currently selected. numeric variable name; returns the return code of the routine call.
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 FILCOLOR on page 878
FILINDEX
Finds the bundle of ll area attributes that is active
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(FILINDEX, index, return-code-variable);
Description
The GASK(FILINDEX, . . . )routine asks which ll bundle is active. If no ll bundles have been previously dened with GSET(FILREP, . . . )or activated with GSET(FILINDEX, . . . ), GASK(FILINDEX, . . . )returns the default value, 1.
FILREP
825
Argument Denitions
index return-codevariable numeric variable name; returns the index of the ll bundle currently selected. numeric variable name; returns the return code of the routine call.
See Also
FILREP on page 825 FILREP on page 879 FILINDEX on page 879
FILREP
Finds the ll area attributes associated with a bundle index
Operating States: GKOP, WSOP, WSAC, SGOP Return Codes: 0, 8, 75, 76
Syntax
CALL GASK (FILREP, index, color-index, interior, style-index, return-code-variable);
Description
The GASK(FILREP, . . . )routine returns the color, type of interior, and ll pattern associated with a specic ll bundle. If the bundle indicated by index has not been previously dened with the GSET(FILREP, . . . )function, DSGI issues the following error message:
ERROR: A representation for the specified fill area index has not been defined on this workstation.
Argument Denitions
index numeric constant or numeric variable name; indicates the ll bundle to check. Valid values are 1 to 20, inclusive. If index is expressed as a variable, the variable must be initialized to a value between 1 and 20. numeric variable name; returns the color index of the ll color associated with the bundle. The color index that is returned corresponds to a color specication in the following order:
1 a color index assigned to a color name with the
color-index
GSET(COLREP, . . . )function
2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the
device entry.
826
FILSTYLE
Chapter 32
interior
character variable name; returns the style of the interior associated with the bundle index:
3 3 3 3
style-index
numeric variable name; returns the index of the ll pattern associated with the bundle. See the FILSTYLE on page 880 for the ll patterns represented by style-index. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
COLORS= graphics option (see COLORS on page 342) FILINDEX on page 824 COLREP on page 876 FILREP on page 879 FILSTYLE on page 880
FILSTYLE
Finds the style of the ll area when FILTYPE is PATTERN or HATCH
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(FILSTYLE, style-index, return-code-variable);
Description
The GASK(FILSTYLE, . . . )routine returns the current ll style of the interior when FILTYPE is PATTERN or HATCH. If no ll style has been previously selected with the GSET(FILSTYLE, . . . )function, GASK(FILSTYLE, . . . )returns the default value, 1.
Argument Denitions
style-index numeric variable name; returns the index of the ll pattern associated with the bundle. See the FILSTYLE on page 880 for the interior styles represented by style-index. numeric variable name; returns the return code of the routine call.
return-codevariable
GRAPHLIST
827
See Also
FILTYPE on page 827 FILSTYLE on page 880 FILTYPE on page 882
FILTYPE
Finds the type of the interior of the ll area
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(FILTYPE, interior, return-code-variable);
Description
The GASK(FILTYPE, . . . )routine returns the current ll type. If no ll type has been previously selected with the GSET(FILTYPE, . . . )function, GASK(FILTYPE, . . . )returns the default value, HOLLOW.
Argument Denitions
interior character variable name; returns the ll type that is active, that is, one of the following values: 3 HATCH 3 HOLLOW 3 PATTERN 3 SOLID. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
FILSTYLE on page 826 FILTYPE on page 827
GRAPHLIST
Finds the names of segments in the current catalog
Operating States: GKOP, SGOP, WSAC, WSOP
828
HPOS
Chapter 32
Return Codes:
0, 8
Syntax
CALL GASK(GRAPHLIST, n, name-array, return-code-variable);
Description
The GASK(GRAPHLIST, . . . )routine lists the rst n names of the graphs that are in the current catalog. If a catalog has not been previously specied with the GRAPH(CATALOG, . . . )function, the routine returns names from the default catalog, WORK.GSEG. The names returned are any of the following: 3 those specied in the GRAPH(CLEAR, . . . )function 3 if the name is omitted from the GRAPH(CLEAR . . . )function, some form of DSGI: for example, DSGI, DSGI1, or DSGI2. 3 the name specied in the NAME= option of a graphics procedure 3 graphs previously created by other graphics procedures and already in the catalog.
Argument Denitions
n numeric variable name; tells the maximum number of graph names you want returned. If you express n as a variable, the variable must be initialized to the maximum number of graph names you want returned. list of character variable names into which the graph names are returned. The list of variable names can be members of an array or OF argument lists (where the arguments are variables). If you are using an array, name-array must be declared as an array. The dimension of the array is determined by the number of color indexes you want returned. See the discussion for ARRAY in SAS Language Reference: Dictionary for more information about OF argument lists. numeric variable names; returns the return code of the routine call.
name-array
return-codevariable
See Also
CLEAR on page 866
HPOS
Finds the number of columns
Operating States: All Return Codes:
Syntax
CALL GASK(HPOS,hpos, return-code-variable);
HSIZE
829
Description
The GASK(HPOS, . . . )routine returns the number of columns currently in the graphics output area. GASK(HPOS, . . . )searches for the current number of columns in the following order: 1 the value selected in the GSET(HPOS, . . . )function 2 the value of the HPOS= graphics option 3 the devices default HPOS value found in the device entry.
Argument Denitions
hpos return-codevariable numeric variable name; returns the number of columns in the graphics output area. numeric variable name; returns the return code of the routine call.
See Also
HSIZE on page 829 HPOS on page 883 HPOS= graphics option (see HPOS on page 385)
HSIZE
Finds the horizontal dimension of the graphics output area
Operating States: All Return Codes: 0
Syntax
CALL GASK(HSIZE, hsize, return-code-variable);
Description
The GASK(HSIZE, . . . )routine returns the current horizontal dimension, in inches, of the graphics output area. GASK(HSIZE, . . . )searches for the current horizontal dimension in the following order:
1 the value selected in the GSET(HSIZE, . . . )function 2 the value of the HSIZE= graphics option 3 the devices default HSIZE found in the device entry.
Argument Denitions
hsize return-codevariable numeric variable name; the size of the graphics output area in the x dimension (in inches). numeric variable name; returns the return code of the routine call.
830
HTML
Chapter 32
See Also
HPOS on page 828 HSIZE on page 883 HSIZE= graphics option (see HSIZE on page 386)
HTML
Finds the HTML string that is in effect when one of the following graphic elements is drawn: bar, ellipse, ll, mark, pie, and text.
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(HTML, string, return-code-variable);
Description
The GASK(HTML, . . . )routine returns the current HTML string. If a GSET(HTML, . . . )function has not been previously submitted, GASK(HTML, . . . )returns the default value, null.
Argument Denitions
string return-codevariable the HTML string invoked when an affected DSGI graphic element in a web page is clicked. numeric variable name; returns the return code of the routine call.
See Also
BAR on page 857 ELLIPSE on page 859 FILL on page 860 MARK on page 863 PIE on page 864 TEXT on page 865 HTML on page 884
LINCOLOR
Finds the current setting of the color to be used to draw lines
LININDEX
831
Syntax
CALL GASK(LINCOLOR, color-index, return-code-variable);
Description
The GASK(LINCOLOR, . . . )routine returns the current line color. If a GSET(LINCOLOR, . . . )function has not been previously submitted, GASK(LINCOLOR, . . . )returns the default value, 1. The color index returned corresponds to a color specication in the following order: 1 the color specied in a GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
Argument Denitions
color-index return-codevariable numeric variable name; returns the color index of the current line color. numeric variable name; returns the return code of the routine call.
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 LINCOLOR on page 885
LININDEX
Finds the index of the bundle of line attributes
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(LININDEX, index, return-code-variable);
Description
The GASK(LININDEX, . . . )routine returns the current line bundle. If no line bundles have been previously dened with GSET(LINREP, . . . )or activated with GSET(LININDEX, . . . ), GASK(LININDEX, . . . )returns the default value, 1.
832
LINREP
Chapter 32
Argument Denitions
index return-codevariable numeric variable name; returns the index of the current line bundle. numeric variable name; returns the return code of the routine call.
See Also
LINREP on page 832 LININDEX on page 886 LINREP on page 887
LINREP
Finds the bundle of line attributes associated with an index
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8, 60, 61
Syntax
CALL GASK (LINREP, index, color-index, width, type, return-code-variable);
Description
The GASK(LINREP, . . . )routine returns the color, width, and line type associated with a specic line bundle. If the bundle indicated by index has not been previously dened with the GSET(LINREP, . . . )function, DSGI issues the following error message:
ERROR: A representation for the specified line type index has not been defined on this workstation.
Argument Denitions
index numeric constant or numeric variable name; indicates the ll bundle to check. Valid values are 1 to 20, inclusive. If index is expressed as a variable, the variable must be initialized to a value between 1 and 20. numeric variable name; returns the color index of the ll color associated with the bundle. The color index returned corresponds to a color specication in the following order:
1 a color index assigned with the GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
color-index
width
numeric variable name; returns the line width (in pixels) associated with the bundle.
LINWIDTH
833
type
numeric variable name; returns the index of the line type associated with the bundle. Refer to Figure 14.22 on page 276 for representations of the line types. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 LININDEX on page 831 COLREP on page 876 LINREP on page 887
LINTYPE
Finds the line type
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(LINTYPE, type, return-code-variable);
Description
The GASK(LINTYPE, . . . )routine returns the current line type. If no line type was previously selected with the GSET(LINTYPE, . . . )function, GASK(LINTYPE, . . . )returns the default value, 1.
Argument Denitions
type numeric variable name; returns the index of the line type currently selected. Refer to Figure 14.22 on page 276 for representations of the line types. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
LINTYPE on page 888
LINWIDTH
Finds the line thickness
834
MARCOLOR
Chapter 32
0, 8
Syntax
CALL GASK(LINWIDTH, width, return-code-variable);
Description
The GASK(LINWIDTH, . . . )routine returns the current line width. If a line width has not been previously selected with the GSET(LINWIDTH, . . . )function, GASK(LINWIDTH, . . . )returns the default value, 1.
Argument Denitions
width return-codevariable numeric variable name; returns the current line width (in units of pixels). numeric variable name; returns the return code of the routine call.
See Also
LINWIDTH on page 888
MARCOLOR
Finds the color index of the color to be used to draw markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(MARCOLOR, color-index, return-code-variable);
Description
The GASKMARCOLOR, . . . )routine returns the current marker color. If a GSET(MARCOLOR, . . . )function has not been previously submitted, GASK(MARCOLOR, . . . )returns the default value, 1. The color index returned corresponds to a color specication in the following order: 1 the color selected in a GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
Argument Denitions
color-index numeric variable name; returns the color index of the current marker color.
MARREP
835
return-codevariable
numeric variable name; returns the return code of the routine call.
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 MARCOLOR on page 889
MARINDEX
Finds the index of the bundle of marker attributes currently selected
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(MARINDEX, index, return-code-variable);
Description
The GASK(MARINDEX, . . . )routine returns the current marker bundle. If no marker bundles have been previously dened with GSET(MARREP, . . . )or activated with GSET(MARINDEX, . . . ), GASK(MARINDEX, . . . )returns the default value, 1.
Argument Denitions
index return-codevariable numeric variable name; returns the index of the marker bundle currently selected. numeric variable name; returns the return code of the routine call.
See Also
MARREP on page 835 MARINDEX on page 890 MARREP on page 890
MARREP
Finds the bundle of marker attributes associated with an index
836
MARREP
Chapter 32
0, 8, 64, 65
Syntax
CALL GASK(MARREP, index, color-index, size, type, return-code-variable);
Description
The GASK(MARREP . . . )routine returns the color, size, and type of marker associated with a specic marker bundle. If the bundle indicated by index has not been previously dened with the GSET(MARREP, . . . )function, DSGI issues the following error message:
ERROR: A representation for the specified marker index has not been defined on this workstation.
Argument Denitions
index numeric constant or numeric variable name; indicates the index of the ll bundle to check. Valid values are 1 to 20, inclusive. If index is expressed as a variable, the variable must be initialized to a value between 1 and 20. numeric variable name; returns the color index of the ll color associated with the bundle. The color index returned corresponds to a color specication in the following order:
1 a color index assigned with the GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
color-index
size type
numeric variable name; returns the marker size in units of the current window system. numeric variable name; the index of the marker type associated with the bundle. See the MARTYPE on page 892 for an explanation of the marker indexes. numeric variable name; returns the return code of the routine call.
return-codevariable
MARTYPE
837
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 MARINDEX on page 890 MARREP on page 890 MARTYPE on page 892
MARSIZE
Finds the size of markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(MARSIZE, size, return-code-variable);
Description
The GASK(MARSIZE, . . . )routine returns the current marker size. If no marker size has been previously selected with the GSET(MARSIZE, . . . )function, GASKMARSIZE, . . . )returns the default value, 1.
Argument Denitions
size return-codevariable numeric variable name; returns the marker size in units of the current window system. numeric variable name; returns the return code of the routine call.
See Also
MARSIZE on page 891
MARTYPE
Finds the kind of markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
838
MAXDISP
Chapter 32
Syntax
CALL GASK(MARTYPE, type, return-code-variable);
Description
The GASK(MARTYPE, . . . )routine returns the current marker type. If no marker type has been previously selected with the GSET(MARTYPE, . . . )function, GASK(MARTYPE, . . . )returns the default value, 1.
Argument Denitions
type numeric variable name; returns the index of the marker type currently selected. See the function MARTYPE on page 892 for an explanation of the indexes for markers. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
MARTYPE on page 892
MAXDISP
Finds the maximum display area size
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK (MAXDISP, units, x-dim, y-dim, x-pixels, y-pixels, return-code-variable);
Description
The GASK(MAXDISP, . . . )routine returns the dimensions of the maximum display area for the device. This routine is useful when you need to know the maximum display area in order to determine the aspect ratio or to scale a graph. There is a difference between the maximum display size returned when the operating state is not SGOP and when it is SGOP. The full addressable display area is returned when the operating state is not SGOP. The display area, minus room for titles and footnotes, is returned when the operating state is SGOP.
Argument Denitions
units x-dim numeric variable name; returns a 1 to show that x-dim and y-dim are in meters. numeric variable name; returns the dimension, in meters, in the x direction.
NUMGRAPH
839
numeric variable name; returns the dimension, in meters, in the y direction. numeric variable name; returns the number of pixels in the x direction. numeric variable name; returns the number of pixels in the y direction. numeric variable name; returns the return code of the routine call.
See Also
HSIZE on page 829 VSIZE on page 852 HSIZE on page 883 VSIZE on page 906
NUMGRAPH
Finds the number of graphs in the current catalog
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(NUMGRAPH, n, return-code-variable);
Description
The GASK(NUMGRAPH, . . . )routine returns how many graphs are in the current catalog. The catalog checked is the catalog selected in the GSET(CATALOG, . . . )function, if specied; otherwise, it is the default catalog, WORK.GSEG.
Argument Denitions
n return-codevariable numeric variable name; returns the number of graphs in the current catalog. numeric variable name; returns the return code of the routine call.
See Also
CATALOG on page 819 CATALOG on page 874
840
OPENGRAPH
Chapter 32
OPENGRAPH
Finds the name of the segment currently open
Operating States: SGOP Return Codes:
0, 4
Syntax
CALL GASK(OPENGRAPH, name, return-code-variable);
Description
The GASK(OPENGRAPH, . . . )routine returns the name of the graph that is currently open. The name returned is one of the following:
3 the name specied in the GRAPH(CLEAR, . . . )function 3 if the name is omitted from the GRAPH(CLEAR, . . . )function, some form of
DSGI: for example, DSGI, DSGI1, and DSGI2.
Argument Denitions
name return-codevariable character variable name; returns the name of the graph that is currently open. numeric variable name; returns the return code of the routine call.
See Also
CLEAR on page 866
PATREP
Finds the pattern name assigned to a style index
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8. 79
Syntax
CALL GASK(PATREP, index, pattern-name, hatch-name, return-code-variable);
Description
The GASK(PATREP, . . . )routine returns the pattern name assigned to a style index.
STATE
841
Argument Denitions
index pattern-name hatch-name return-codevariable numeric variable name; returns the index of the pattern currently selected. character variable name; returns the name of the pattern at the specied index. character variable name; returns the name of the hatch at the specied index. numeric variable name; returns the return code of the routine call.
See Also
PATREP on page 894
STATE
Finds the current operating state of DSGI
Operating States: All Return Codes: 0
Syntax
CALL GASK(STATE, status);
Description
The GASK(STATE, . . . )routine returns the current operating state of DSGI.
Argument Denitions
status character variable name; returns one of the following values:
3 3 3 3 3
See Also
WSACTIVE on page 854 WSOPEN on page 855
842
TEXALIGN
Chapter 32
TEXALIGN
Finds the horizontal and vertical alignment of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(TEXALIGN, halign, valign, return-code-variable);
Description
The GASK(TEXALIGN, . . . )routine returns the current horizontal and vertical text alignment. If no values have been previously selected with the GSET(TEXALIGN, . . . )function, GASK(TEXALIGN, . . . )returns the default value NORMAL for both halign and valign.
Argument Denitions
halign character variable name; indicates the horizontal alignment set by the GSET(TEXALIGN, . . . )function; returns one of the following values: 3 CENTER 3 LEFT 3 NORMAL 3 RIGHT. character variable name; indicates the vertical alignment set by the GSET(TEXALIGN, . . . )function; returns one of the following values: 3 BASE 3 BOTTOM 3 HALF 3 NORMAL 3 TOP. numeric variable name; returns the return code of the routine call.
valign
return-codevariable
See Also
TEXPATH on page 846 TEXUP on page 848 TEXALIGN on page 894
TEXCOLOR
Finds the color index of the color currently selected to draw text strings
TEXEXTENT
843
Syntax
CALL GASK(TEXCOLOR, color-index, return-code-variable);
Description
The GASK(TEXCOLOR, . . . )routine returns the current text color. If a GSET(TEXCOLOR, . . . )function has not been previously submitted, GASK(TEXCOLOR, . . . )returns the default value, 1. The color index returned corresponds to a color specication in the following order: 1 the color specied in a GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
Argument Denitions
color-index return-codevariable numeric variable name; returns the color index of the color used to draw text. numeric variable name; returns the return code of the routine call.
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 TEXCOLOR on page 896
TEXEXTENT
Finds the text extent rectangle and concatenation point for a specied text string
Operating States: SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK (TEXEXTENT, x, y, string, x-end, y-end, x1, x2, x3, x4, y1, y2, y3, y4, return-code-variable);
Description
The GASK(TEXEXTENT, . . . )routine returns the text extent rectangle and text concatenation point for a specied text string. All text extent coordinates returned are
844
TEXFONT
Chapter 32
in units of the current window system. If no text string is specied for string, GASK(TEXEXTENT, . . . )does not return values for the other arguments. The text attributes and bundles affect the values returned by this query. See Figure 32.1 on page 844 for a diagram of the text extent rectangle (in the gure, x,y is always the place where the text string starts).
Figure 32.1
Argument Denitions
x numeric variable name; x coordinates are in units based on the current window system; returns x coordinate after justication. The variable used to specify x must be initialized. numeric variable name; y coordinates are in units based on the current window system; returns y coordinate after justication. The variable used to specify y must be initialized. character string enclosed in single quotation marks or a character variable name; a set of characters for which the text extent rectangle and text concatenation point are calculated. numeric variable name; returns the x coordinate of the point at which the next text string can be concatenated. numeric variable name; returns the y coordinate of the point at which the next text string can be concatenated. numeric variable names; return the text extent rectangles of the text strings as shown in Figure 32.1 on page 844. numeric variable name; returns the return code of the routine call.
string
x-end y-end x1, x2, x3, x4, y1, y2, y3, y4 return-codevariable
See Also
WINDOW on page 853 TEXT on page 865
TEXFONT
Finds the font used to draw text strings
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
TEXHEIGHT
845
Syntax
CALL GASK(TEXFONT, font, return-code-variable);
Description
The GASK(TEXFONT . . . )routine returns the current text font. GASK(TEXFONT, . . . )searches for the current font in the following order:
1 the value selected in the GSET(TEXFONT, . . . )function, if specied 2 the value of the FTEXT= graphics option, if specied 3 the devices default device-resident font if the device supports a device-resident font 4 the SIMULATE font.
Argument Denitions
font return-codevariable character variable name; returns the font name. numeric variable name; returns the return code of the routine call.
See Also
FTEXT= graphics options in (see FTEXT on page 365) TEXFONT on page 897
TEXHEIGHT
Finds the character height of the text strings
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8
Syntax
CALL GASK(TEXHEIGHT, height, return-code-variable);
Description
The GASK(TEXHEIGHT, . . . )routine returns the current text height. GASK(TEXHEIGHT, . . . )searches for the current text height in the following order:
1 the value selected in the GSET(TEXHEIGHT, . . . )function, if specied 2 the value of the HTEXT= graphics option, if specied 3 the default text height, 1.
Argument Denitions
height numeric variable name; returns the character height in units of the current window system.
846
TEXINDEX
Chapter 32
return-codevariable
numeric variable name; returns the return code of the routine call.
See Also
TEXHEIGHT on page 898 HTEXT= graphics options (see HTEXT on page 387)
TEXINDEX
Finds the index of the bundle of text attributes currently selected
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(TEXINDEX, index, return-code-variable);
Description
The GASK(TEXINDEX, . . . )routine returns the current text bundle. If no text bundles have been previously dened with GSET(TEXREP, . . . )or activated with GSET(TEXINDEX, . . . ), GASK(TEXINDEX, . . . )returns the default value, 1.
Argument Denitions
index return-codevariable numeric variable name; returns the text bundle index. numeric variable name; returns the return code of the routine call.
See Also
TEXREP on page 847 TEXREP on page 900 TEXINDEX on page 898
TEXPATH
Finds the direction of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
TEXREP
847
Syntax
CALL GASK(TEXPATH, path, return-code-variable);
Description
The GASK(TEXPATH, . . . )routine returns the current text path (reading direction). If TEXPATH has not been previously selected with the GSET(TEXPATH, . . . )function, GASK(TEXPATH, . . . )returns the default value, RIGHT. See the TEXPATH on page 899 for an illustration of text paths.
Argument Denitions
path character variable name; returns one of the following values: 3 DOWN 3 LEFT 3 RIGHT 3 UP. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
TEXALIGN on page 842 TEXUP on page 848 TEXPATH on page 899
TEXREP
Finds the attribute settings associated with a text bundle
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 68, 69
Syntax
CALL GASK(TEXREP, index, color-index, font, return-code-variable);
Description
The GASK(TEXREP, . . . )routine returns the color and font associated with a specic text bundle. If the bundle indicated by index has not been previously dened with the GSET(TEXREP, . . . )function, DSGI issues the following error message:
ERROR: A representation for the specified text index has not been defined on this workstation.
Argument Denitions
index numeric constant or numeric variable name; indicates the ll bundle to check. Valid values are 1 to 20, inclusive. If index is expressed as
848
TEXUP
Chapter 32
a variable, the variable must be initialized to a value between 1 and 20. color-index numeric variable name; returns the color index of the ll color associated with the bundle. The color index that is returned corresponds to a color specication in the following order:
1 a color index assigned with the GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
font return-codevariable
character variable name; returns the text font associated with the bundle. numeric variable name; returns the return code of the routine call.
See Also
COLORS= graphics option (see COLORS on page 342) COLREP on page 822 COLREP on page 876 TEXREP on page 900
TEXUP
Finds the orientation (angle) of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(TEXUP, up-x, up-y, return-code-variable);
Description
The GASK(TEXUP, . . . )routine returns the character up vector values. If TEXUP has not been previously selected with the GSET(TEXUP, . . . )function, GASK(TEXUP, . . . )returns the default values for x and y, 0 and 1. See the TEXUP on page 901 for an explanation of the vector values.
Argument Denitions
up-x up-y return-codevariable numeric variable name; returns the x component of the vector. numeric variable name; returns the y component of the vector. numeric variable name; returns the return code of the routine call.
TRANS
849
See Also
TEXALIGN on page 842 TEXPATH on page 846 TEXUP on page 901
TRANS
Finds the viewport and window coordinates associated with a transformation number
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 50
Syntax
CALL GASK (TRANS, n, vllx, vlly, vurx, vury, wllx, wlly, wurx, wury, return-code-variable);
Description
The GASK(TRANS, . . . )routine returns the viewport and window coordinates associated with a particular transformation number. GASK(TRANS, . . . )returns the default coordinates for viewports and windows if other coordinates have not been dened for the transformation specied.
Argument Denitions
n numeric constant or numeric variable name; indicates the number of the transformation to check. Valid values are 0 to 20, inclusive. If n is expressed as a variable, the variable must be initialized to a value between 0 and 20. numeric variable name; returns the x coordinate of the lower-left viewport corner. numeric variable name; returns the y coordinate of the lower-left viewport corner. numeric variable name; returns the x coordinate of the upper-right viewport corner. numeric variable name; returns the y coordinate of the upper-right viewport corner. numeric variable name; returns the x coordinate of the lower-left window corner. numeric variable name; returns the y coordinate of the lower-left window corner. numeric variable name; returns the x coordinate of the upper-right window corner.
850
TRANSNO
Chapter 32
wury return-codevariable
numeric variable name; returns the y coordinate of the upper-right window corner. numeric variable name; returns the return code of the routine call.
See Also
TRANSNO on page 850 VIEWPORT on page 851 WINDOW on page 853 TRANSNO on page 904 VIEWPORT on page 904 WINDOW on page 907
TRANSNO
Finds the number of the transformation to be used
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8
Syntax
CALL GASK(TRANSNO, n, return-code-variable);
Description
The GASK(TRANSNO, . . . )routine returns the current transformation. If a transformation has not been previously selected with the GSET(TRANSNO, . . . )function, GASK(TRANSNO, . . . )returns the number of the default transformation, 0.
Argument Denitions
n return-codevariable numeric variable name; returns the number of the current transformation. numeric variable name; returns the return code of the routine call.
See Also
TRANS on page 849 VIEWPORT on page 851 WINDOW on page 853 VIEWPORT on page 904 WINDOW on page 907
VIEWPORT
851
VIEWPORT
Finds coordinates of the viewport associated with a transformation number
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 50
Syntax
CALL GASK(VIEWPORT, n, llx, lly, urx, ury, return-code-variable);
Description
The GASK(VIEWPORT, . . . )routine returns the coordinates of the viewport associated with the specied transformation. If a viewport has not been dened with the GSET(VIEWPORT, . . . )function for the specied transformation, n, GASK(VIEWPORT, . . . )returns the default coordinates for the viewport, (0,0) and (1,1).
Argument Denitions
n numeric constant or numeric variable name; indicates the transformation number assigned to the viewport to check. Valid values are 0 to 20, inclusive. If n is expressed as a variable, the variable must be initialized to a value between 0 and 20. numeric variable name; returns the x coordinate of the lower-left corner. numeric variable name; returns the y coordinate of the lower-left corner. numeric variable name; returns the x coordinate of the upper-right corner. numeric variable name; returns the y coordinate of the upper-right corner. numeric variable name; returns the return code of the routine call.
See Also
TRANS on page 849 TRANSNO on page 850 WINDOW on page 853 TRANSNO on page 904 VIEWPORT on page 904 WINDOW on page 907
852
VPOS
Chapter 32
VPOS
Finds the number of rows
Operating States: All Return Codes:
Syntax
CALL GASK(VPOS, vpos, return-code-variable);
Description
The GASK(VPOS, . . . )routine returns the current number of rows in the graphics output area. GASK(VPOS, . . . )searches for the current number of rows in the following order:
1 the value selected in the GSET(VPOS, . . . )function 2 the value of the VPOS= graphics option 3 the devices default VPOS value found in the device entry.
Argument Denitions
vpos return-codevariable numeric variable name; returns the number of rows in the graphics output area. numeric variable name; returns the return code of the routine call.
See Also
HPOS on page 828 VSIZE on page 852 VPOS on page 905 VPOS= graphics option (see VPOS on page 432)
VSIZE
Finds the vertical dimension of the graphics output area
Operating States: All Return Codes:
Syntax
CALL GASK(VSIZE, vsize, return-code-variable);
WINDOW
853
Description
The GASK(VSIZE, . . . )routine returns the current vertical dimension, in inches, of the graphics output area. GASK(VSIZE, . . . )searches for the current vertical dimension in the following order:
1 the value selected in the GSET(VSIZE, . . . )function 2 the value of the VSIZE= graphics option 3 the devices default VSIZE found in the device entry.
Argument Denitions
vsize return-codevariable numeric variable name; returns the size of the graphics output area in the y dimension (in inches). numeric variable name; returns the return code of the routine call.
See Also
HSIZE on page 829 VPOS on page 852 VSIZE on page 906 VSIZE= graphics option (see VSIZE on page 432)
WINDOW
Finds the coordinates of the window associated with a transformation number
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 50
Syntax
CALL GASK(WINDOW, n, llx, lly, urx, ury, return-code-variable);
Description
The GASK(WINDOW, . . . )routine returns the coordinates of the window associated with the specied transformation number. If no window has been dened with the GSET(WINDOW, . . . )function for transformation n, GASK(WINDOW, . . . )returns the default window coordinates, which are device dependent.
Argument Denitions
n numeric constant or numeric variable name; indicates the transformation number of the window to check. Valid values are 0 to 20, inclusive. If n is expressed as a variable, the variable must be initialized to a value between 0 and 20.
854
WSACTIVE
4
llx lly urx ury
Chapter 32
numeric variable name; returns the x coordinate of the lower-left corner. numeric variable name; returns the y coordinate of the lower-left corner. numeric variable name; returns the x coordinate of the upper-right corner. numeric variable name; returns the y coordinate of the upper-right corner. numeric variable name; returns the return code of the routine call.
return-codevariable
See Also
TRANS on page 849 TRANSNO on page 850 VIEWPORT on page 851 TRANSNO on page 904 VIEWPORT on page 904 WINDOW on page 907
WSACTIVE
Finds whether the interface is active
Operating States: All Return Codes:
29, 30
Syntax
CALL GASK(WSACTIVE, status);
Description
The GASK(WSACTIVE, . . . )routine asks if the workstation is active. When the workstation is active, you can execute certain DSGI routines and functions.
Argument Denitions
status numeric variable name; returns either 29 (active) or 30 (inactive).
See Also
STATE on page 841 WSOPEN on page 855
GDRAW Functions
855
WSOPEN
Finds whether the interface is open
Operating States: All Return Codes: 24, 25
Syntax
CALL GASK(WSOPEN, status);
Description
The GASK(WSOPEN, . . . )routine asks if the workstation is open. If a workstation is open, the graphics catalog can be accessed.
Argument Denitions
status numeric variable name; returns either 24 (open) or 25 (closed).
See Also
WSACTIVE on page 854
GDRAW Functions
GDRAW functions create graphics elements. Each GDRAW operator is associated with a set of GSET operators that control its attributes. The color, height, and font attributes, for the GDRAW(TEXT, . . . )function are controlled by GSET(TEXCOLOR, . . . ), GSET(TEXHEIGHT, . . . ), and GSET(TEXFONT, . . . ), respectively. For a complete list of the attributes associated with each GDRAW function, see Table 31.2 on page 781. The complete graph is displayed after the GRAPH(UPDATE, . . . )function is submitted. When using GDRAW functions: 3 all arguments must be specied 3 all arguments are specied as variables or constants 3 if you express an argument as a variable, the variable must be initialized 3 all character arguments expressed as character strings must be enclosed in quotes 3 all character variable names used as arguments must be declared in a LENGTH statement 3 all character constants must be enclosed in single or double quotes GDRAW functions: 3 ARC 3 BAR 3 ELLARC
856
ARC
Chapter 32
3 3 3 3 3 3 3 3
ARC
Draws a circular arc
Operating States: SGOP Return Codes:
0, 4, 61, 86
Syntax
return-code-variable=GDRAW(ARC, x, y, radius, start, end);
Description
The GDRAW(ARC, . . . )function draws a circular arc. The line attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Figure 32.2 on page 856 illustrates the arguments used with GDRAW(ARC, . . . ).
Figure 32.2
Argument Denitions
x numeric constant or numeric variable name; species the x coordinate of the position of the arc on the display; x coordinates are in units based on the current window system. numeric constant or numeric variable name; species the y coordinate of the position of the arc on the display; y coordinates are in units based on the current window system;
BAR
857
numeric constant or numeric variable name; the arc radius size is in units based on the current window system. numeric constant or numeric variable name; the starting angle of the arc is in degrees, with 0 degrees at 3 oclock. numeric constant or numeric variable name; the ending angle of the arc is in degrees, with 0 degrees at 3 oclock.
See Also
ELLARC on page 858 PIE on page 864 LINCOLOR on page 885 LININDEX on page 886 LINREP on page 887 LINTYPE on page 888 LINWIDTH on page 888
BAR
Draws a rectangle
Operating States: SGOP Return Codes: 0, 4, 76, 79, 80, 86
Syntax
return-code-variable=GDRAW(BAR, x1, y1, x2, y2);
Description
The GDRAW(BAR, . . . )function draws a rectangular bar whose sides are parallel to the sides of the display area. The ll attributes and bundles affect the appearance of this graphics element. See Table 31.2 on page 781 for a list of these attributes. Figure 32.3 on page 857 illustrates the arguments used with GDRAW(BAR, . . . ).
Figure 32.3
858
ELLARC
Chapter 32
Argument Denitions
x1 y1 x2 numeric constant or numeric variable name; refers to the x coordinate of one corner of the bar. numeric constant or numeric variable name; refers to the y coordinate of one corner of the bar. numeric constant or numeric variable name; refers to the x coordinate of the corner of the bar that is diagonally opposite to the corner of (x1,y1). numeric constant or numeric variable name; refers to the y coordinate of the corner of the bar that is diagonally opposite to the corner of (x1,y1).
y2
See Also
FILL on page 860 FILCOLOR on page 878 FILINDEX on page 879 FILREP on page 879 FILTYPE on page 882 FILSTYLE on page 880 HTML on page 884
ELLARC
Draws an elliptical arc
Operating States: SGOP Return Codes:
0, 4, 61, 86
Syntax
return-code-variable =GDRAW(ELLARC, x, y, major, minor, start, end, angle);
Description
The GDRAW(ELLARC, . . . )function draws a hollow section of an ellipse. The line attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Figure 32.4 on page 859 illustrates the arguments used with GDRAW(ELLARC, . . . )and GDRAW(ELLIPSE, . . . ).
ELLIPSE
859
Figure 32.4 Arguments Used with GDRAW(ELLARC,...) function and GDRAW(ELLIPSE,...) function
Argument Denitions
x y major minor start numeric constant or numeric variable name; x coordinates are in units based on the current window system. numeric constant or numeric variable name; y coordinates are in units based on the current window system. numeric constant or numeric variable name; the major axis lengths for the elliptical arc. numeric constant or numeric variable name; the minor axis lengths for the elliptical arc. numeric constant or numeric variable name; the starting angle from the major axis, in degrees, for the elliptical arc with 0 degrees beginning at the major axis. numeric constant or numeric variable name; the ending angle from the major axis, in degrees, for the elliptical arc with 0 degrees at 3 oclock. numeric constant or numeric variable name; the angle that the major axis of the elliptical arc has to 0 degrees (with 0 degrees at 3 oclock).
end
angle
See Also
ELLIPSE on page 859 LINCOLOR on page 885 LINTYPE on page 888 LINWIDTH on page 888 LINREP on page 887 LININDEX on page 886
ELLIPSE
Draws an ellipse
860
FILL
Chapter 32
Syntax
return-code-variable =GDRAW(ELLIPSE, x, y, major, minor, start, end, angle);
Description
The GDRAW(ELLIPSE, . . . )function draws a lled section of an ellipse. The ll attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Figure 32.4 on page 859 illustrates the arguments used with GDRAW(ELLARC, . . . )and GDRAW(ELLIPSE, . . . ).
Argument Denitions
x y major minor start numeric constant or numeric variable name; the x coordinate of the position of the ellipse on the display. numeric constant or numeric variable name; the y coordinate of the position of the ellipse on the display. numeric constant or numeric variable name; the major axis length for the ellipse. numeric constant or numeric variable name; the minor axis length for the ellipse. numeric constant or numeric variable name; the starting angle for the ellipse from the major axis, with 0 degrees beginning at the major axis. numeric constant or numeric variable name; the ending angle for the ellipse from the major axis, with 0 degrees at 3 oclock. numeric constant or numeric variable name; the angle that the major axis of the ellipse has to 0 degrees, with 0 degrees at 3 oclock.
end angle
See Also
ELLARC on page 858 FILCOLOR on page 878 FILINDEX on page 879 FILREP on page 879 FILTYPE on page 882 HTML on page 884
FILL
Draws a lled area
Operating States: SGOP
IMAGE
861
Syntax
return-code-variable=GDRAW(FILL, n, x-values, y-values);
Description
The GDRAW(FILL . . . )function draws a lled polygon. The ll attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Note: All of the x coordinates are listed in the function rst, followed by the y coordinates. This primitive takes the rst n values and stores them as x coordinates. The next n values are stored as y coordinates. 4
Argument Denitions
n numeric constant or numeric variable name; the number of vertices (x and y pairs) in the polygon. You can specify a missing value (.) for n. If n is missing, the number of vertices is computed from the number of x and y arguments. list of numeric constants, variables, or OF arguments that describe the x coordinates for the vertices in units based on the current window system. list of numeric constants, variables, or OF arguments that describe the y coordinates for the vertices in units based on the current window system.
x-values
y-values
See Also
BAR on page 857 FILCOLOR on page 878 FILINDEX on page 879 FILREP on page 879 FILTYPE on page 882 FILSTYLE on page 880 HTML on page 884
IMAGE
Displays an image
Operating State:
SGOP
862
LINE
Chapter 32
Syntax
return-code-variable=GDRAW(IMAGE, external-le, x1, y1, x2, y2, style);
Description
The GDRAW(IMAGE, . . .) function displays the specied image within opposing pairs of coordinates. The format of the external image le varies between operating environments. The (x1, y1) coordinate pair species one corner of the image, and the (x2, y2) coordinate pair species the opposite corner of the image. The style parameter must be either TILE to copy the image as many times as necessary to ll the area; or FIT to stretch one instance of the image to ll the area. For a list of the le types that you use, see Image File Types Supported by SAS/ GRAPH on page 179.
LINE
Draws a polyline
Operating States: SGOP Return Codes:
Syntax
return-code-variable=GDRAW(LINE, n, x-values, y-values);
Description
The GDRAW(LINE . . . )function draws one line, a series of connected lines, or a dot. The line attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Note: All of the x coordinates are listed in the function rst, followed by the y coordinates. This primitive takes the rst n values and stores them as x coordinates and the next n values and stores them as y coordinates. 4
Argument Denitions
n numeric constant or numeric variable name; the number of vertices (x and y pairs) in the polygon. You can specify a missing value (.) for n. If n is missing, the number of vertices is computed from the number of x and y pairs. list of numeric constants, variables, or OF arguments that describe the x coordinates for the vertices in units based on the current window system. list of numeric constants, variables, or OF argument lists that describe the y coordinates for the vertices in units based on the current window system.
x-values
y-values
MARK
863
See Also
FILCOLOR on page 878 LININDEX on page 886 LINREP on page 887 LINTYPE on page 888 LINWIDTH on page 888
MARK
Draws a polymarker
Operating States: SGOP Return Codes: 0, 4, 65, 86, 100, 301
Syntax
return-code-variable=GDRAW (MARK, n, x-values, y-values);
Description
The GDRAW(MARK, . . . )function draws a series of symbols. The marker attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes. Refer to the MARTYPE on page 892 for a list of symbols that you can draw with GDRAW(MARK, . . . ). Note: All of the x coordinates are listed in the function rst, followed by the y coordinates. This primitive takes the rst n values and stores them as x coordinates and the next n values and stores them as y coordinates. 4
Argument Denitions
n numeric constant or numeric variable name; the number of times the symbol is drawn. You can specify a missing value (.) for n. If n is missing, the number of vertices is calculated from the number of x and y pairs. list of numeric constants, variables, or OF arguments that describe the x coordinates of the symbols in units based on the current window system. list of numeric constants, variables, or OF arguments that describe the y coordinates of the symbols in units based on the current window system.
x-values
y-values
See Also
TEXT on page 865 HTML on page 884
864
MESSAGE
Chapter 32
MARCOLOR on page 889 MARINDEX on page 890 MARREP on page 890 MARTYPE on page 892
MESSAGE
Prints a message in the SAS log
Operating States: All Return Codes:
Syntax
return-code-variable=GDRAW(MESSAGE, message);
Description
The GDRAW(MESSAGE, . . . )function prints a message in the SAS log. This function can be used for debugging applications or for printing custom messages for your application.
Argument Denitions
message character string enclosed in quotes or character variable name; the text to be printed in the log.
See Also
MESSAGE on page 893 GPRINT on page 814
PIE
Draws a lled circle or section of a lled circle
Operating States: SGOP Return Codes:
Syntax
return-code-variable=GDRAW(PIE, x, y, radius, start, end);
TEXT
865
Description
The GDRAW(PIE, . . . )function draws a lled section of a circular arc. The ll attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes.
Argument Denitions
x y radius start end numeric constant or numeric variable name; x coordinates are in units based on the current window system. numeric constant or numeric variable name; y coordinates are in units based on the current window system. numeric constant or numeric variable name; the pie radius size in units based on the current window system. numeric constant or numeric variable name; the starting angle of the pie, with 0 degrees at 3 oclock on the unit circle. numeric constant or numeric variable name; the ending angle of the pie, with 0 degrees at 3 oclock on the unit circle.
See Also
ARC on page 856 FILCOLOR on page 878 FILINDEX on page 879 FILREP on page 879 FILTYPE on page 882 FILSTYLE on page 880 HTML on page 884
TEXT
Draws a text string
Operating States: SGOP Return Codes: 0, 4, 69, 86
Syntax
return-code-variable=GDRAW(TEXT, x, y, string);
Description
The GDRAW(TEXT, . . . )function draws a text string. The text attributes and bundles affect the appearance of this primitive. See Table 31.2 on page 781 for a list of these attributes.
866
GRAPH Functions
Chapter 32
Argument Denitions
x y string numeric constant or numeric variable name; x coordinates are in units based on the current window system. numeric constant or numeric variable name; y coordinates are in units based on the current window system. character string enclosed in quotes or character variable name; a set of characters to be drawn on the output beginning at position (x,y).
See Also
MARK on page 863 HTML on page 884 TEXCOLOR on page 896 TEXINDEX on page 898 TEXREP on page 900 TEXHEIGHT on page 898
GRAPH Functions
GRAPH functions perform library management tasks from within the DATA Step Graphics Interface. These functions can be performed only on one catalog at a time. They cannot be performed across catalogs. For example, you cannot copy a graph from one catalog to another. When using GRAPH functions, remember the following:
3 All character arguments expressed as character strings must be enclosed in quotes. 3 All character variable names used as arguments must be declared in a LENGTH
statement.
3 3 3 3 3 3 3
CLEAR
Opens a graphics segment for output
Operating States: WSAC
COPY
867
Syntax
return-code-variable=GRAPH (CLEAR<, name> <, des><, byline>);
Description
The GRAPH(CLEAR, . . . )function opens a graphics segment for output in the current catalog. The rst parameter, CLEAR, is the only required one. The values of name, des, and byline are displayed in catalog listings and in catalog information in the GREPLAY procedure. If the name specied is an existing graph, DSGI adds a sufx number to the name. If PIE is chosen for the name and it already exists, DSGI names the output PIE1; the next time the code is submitted, DSGI names the output PIE2, and so forth. This function moves the operating state from WSAC to SGOP.
Argument Denitions
name character string enclosed in quotes or character variable name; gives a name to the graph to be opened. If name is not specied, DSGI assigns the graph a name that is some form of DSGI: for example, DSGI, DSGI1, and DSGI2. character string enclosed in quotes or character variable name; gives a description to the graph to be opened. If des is not specied, DSGI assigns the following description to the catalog entry: Graph from DATA Step Graphics Interface. character string enclosed in quotes or character variable name; gives another line of description for the graph. The byline appears under the titles on the graph. DSGI does not provide a default byline.
des
BY line
See Also
OPENGRAPH on page 840 UPDATE on page 870
COPY
Copies a graph
Operating States: GKOP, WSOP, WSAC, SGOP Return Codes: 0, 8, 307
Syntax
return-code-variable=GRAPH(COPY, name, new-name);
868
DELETE
Chapter 32
Description
The GRAPH(COPY, . . . )function copies a graph to another catalog entry. The graph to be copied must be closed, and be in the current catalog. You cannot copy from one catalog to another. The new graph is also in the current catalog.
Argument Denitions
name new-name character string enclosed in quotes or character variable name; name of the graph to be copied. character string enclosed in quotes or character variable name; name of the graph to be created.
See Also
CATALOG on page 819 DELETE on page 868 INSERT on page 869 CATALOG on page 874
DELETE
Deletes a graph
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 4, 8, 307
Syntax
return-code-variable=GRAPH(DELETE, name);
Description
The GRAPH(DELETE, . . . )function deletes a graph in the current catalog. The graph does not have to be closed to be deleted.
Argument Denitions
name character string enclosed in quotes or character variable name; the name of the graph to delete.
See Also
CATALOG on page 819 COPY on page 867 CATALOG on page 874
PLAY
869
INSERT
Inserts a previously created segment into the currently open graph
Operating States: SGOP Return Codes: 0, 4, 302, 307
Syntax
return-code-variable=GRAPH(INSERT, name);
Description
The GRAPH(INSERT, . . . )function inserts a graph into the currently open graph. The graph to be inserted must be closed and be in the current catalog.
Argument Denitions
name character string enclosed in quotes or character variable name; the name of a graph to be inserted.
See Also
CATALOG on page 819 COPY on page 867 CATALOG on page 874
PLAY
Displays the specied graph on your output
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 307
Syntax
return-code-variable=GRAPH(PLAY, graph-name);
Description
The GRAPH(PLAY, . . . )function displays the specied graph on your output.
Argument Denitions
graph-name character variable name; the name of the graph you would like to play.
870
RENAME
Chapter 32
See Also
UPDATE on page 870
RENAME
Renames a graph
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes:
0, 8, 307
Syntax
return-code-variable=GRAPH(RENAME, name, new-name);
Description
The GRAPH(RENAME, . . . )function renames a graph. The graph to be renamed must be in the current catalog and be closed.
Argument Denitions
name new-name character string enclosed in quotes or character variable name; the name of the closed graph that is to be changed. character string enclosed in quotes or character variable name; the new name for the graph.
See Also
CATALOG on page 819 INSERT on page 869 CATALOG on page 874
UPDATE
Completes the currently open graph, or displays it, or both
Operating States: SGOP Return Codes:
0, 4 WSAC
Syntax
return-code-variable=GRAPH(UPDATE <, show>);
GSET Functions
871
Description
The GRAPH(UPDATE, . . . )function closes the graph currently open and displays it. DSGI operates in buffered mode, so the picture is never displayed until this function is called. This function can be called only once for the currently open graph. Therefore, you cannot incrementally build a graph; however, you can close the currently open graph and later insert it into another graph within the same DATA step. This function moves the operating state from SGOP to WSAC.
Argument Denitions
show character string, optional; valid values are SHOW and NOSHOW. If SHOW is specied, the graph is displayed. If NOSHOW is specied, the graph is closed and not displayed.
See Also
CLEAR on page 866
GSET Functions
GSET functions allow you to set attributes for the graphics elements. Some GSET functions set the attributes for a subset of graphics primitives. Attributes prexed by FIL control the appearance of the graphics primitives GDRAW(BAR, . . . ), GDRAW(ELLIPSE, . . . ), GDRAW(FILL, . . . ), and GDRAW(PIE, . . . ). See Table 31.2 on page 781 for a complete list of the attributes that control the appearance of the graphics primitives. Some GSET functions affect the appearance of the entire graphics output. GSET(HPOS, . . . )and GSET(VPOS, . . . )set the number of columns and rows for the output. See each GSET function for the aspect of the graphics output it controls. When using GSET functions, remember the following:
3 All arguments must be specied. 3 All arguments are specied as variables or constants. If you express an argument
as a variable, the variable must be initialized.
3 All character arguments that are expressed as character strings must be enclosed
in quotation marks.
872
ASF
Chapter 32
DEVICE FILCOLOR FILINDEX FILREP FILSTYLE FILTYPE HPOS HSIZE HTML LINCOLOR LININDEX LINREP LINTYPE LINWIDTH MARCOLOR MARINDEX MARREP MARSIZE MARTYPE MESSAGE PATREP TEXALIGN TEXCOLOR TEXFONT TEXHEIGHT TEXINDEX TEXPATH TEXREP TEXUP TRANSNO VIEWPORT VPOS VSIZE WINDOW
ASF
Species an aspect source ag to bundle or separate attributes
ASF
873
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8 Default Value:
INDIVIDUAL
Syntax
return-code-variable=GSET(ASF, attribute, status);
Description
The GSET(ASF, . . . )function sets an attributes aspect source ag (ASF) so that it can be used in a bundle (BUNDLED) or individually (INDIVIDUAL). If an attributes ASF is set to BUNDLED, it cannot be used outside of a bundle. It must be dened in a GSET(xxxREP, . . . )function and activated with a GSET(xxxINDEX, . . . )function, where xxx can have one of the following values: FIL, LIN, MAR, TEX. If an attributes ASF is set to INDIVIDUAL, it cannot be used with a bundle. In this case, the attribute is set with a GSET(attribute, . . . ). The values of attribute are listed in Argument Denitions.
Argument Denitions
attribute character string enclosed in quotes or character variable name with one of the following values:
3 3 3 3 3 3 3 3 3 3 3
status
FILCOLOR FILSTYLE FILTYPE LINCOLOR LINTYPE LINWIDTH MARCOLOR MARSIZE MARTYPE TEXCOLOR TEXFONT.
character string enclosed in quotation marks or character variable name; accepts either the value BUNDLED or INDIVIDUAL.
See Also
ASF on page 817 FILCOLOR on page 878 FILSTYLE on page 880 FILTYPE on page 882 LINCOLOR on page 885 LINTYPE on page 888 LINWIDTH on page 888
874
ASPECT
Chapter 32
MARCOLOR on page 889 MARSIZE on page 891 MARTYPE on page 892 TEXCOLOR on page 896 TEXFONT on page 897
ASPECT
Species the aspect ratio
Operating States: GKCL Return Codes: Default Value:
Syntax
return-code-variable=GSET(ASPECT, aspect);
Description
The GSET(ASPECT, . . . )function sets the aspect ratio used to draw graphics output. GSET(ASPECT, . . . )affects only pies, arcs, and software text.
Argument Denitions
aspect numeric constant or numeric variable name; species the aspect ratio and cannot be less than 0.
See Also
ASPECT= graphics option (see ASPECT on page 333) ASPECT on page 818
CATALOG
Species the catalog for the graphs
Operating States: GKCL
Syntax
return-code-variable=GSET(CATALOG, libref, catalog-name);
CBACK
875
Description
The GSET(CATALOG, . . . )function makes the specied catalog the current catalog in which to store graphs generated with DSGI. GSET(CATALOG, . . . )creates the catalog if it does not exist. The values of libref and catalog-name cannot exceed eight characters. The number of characters allowed for a catalog name varies across operating environments; see the SAS companion for your operating system. Libref should have been dened through the LIBNAME statement.
Argument Denitions
libref catalog-name character string enclosed in quotation marks or character variable name; points to the library that contains the catalog. character string enclosed in quotation marks or character variable name; species the catalog name to be used.
See Also
CATALOG on page 819 GRAPHLIST on page 827 NUMGRAPH on page 839
CBACK
Species the background color
Operating States: GKCL Return Codes: 0, 1 Default Value:
color.
Syntax
return-code-variable=GSET(CBACK, cback);
Description
The GSET(CBACK, . . . )function sets the background color. GSET(CBACK, . . . )has the same effect as the CBACK= graphics option.
Argument Denitions
cback character string enclosed in quotation marks or character variable name; can contain any predened SAS color name. See SAS Color Names and RGB Values in the SAS Registry on page 173 for a list of predened SAS color names.
876
CLIP
Chapter 32
See Also
CBACK= graphics option (see CBACK on page 337) CBACK on page 820
CLIP
Species whether clipping is on or off
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0 OFF
Syntax
return-code-variable=GSET(CLIP, status);
Description
The GSET(CLIP, . . . )function activates or suppresses clipping around the current viewport.
Argument Denitions
status character string enclosed in quotation marks or character variable name; valid values are ON and OFF. When ON is used, the graphics elements outside of the specied viewport are not displayed. If you turn clipping OFF, the graphics elements outside of the dened viewport are displayed.
See Also
CLIP on page 820 VIEWPORT on page 851 VIEWPORT on page 904
COLREP
Associates a color name with a certain color index
Operating States: SGOP Return Codes: Default Values:
DEVICE
877
Syntax
return-code-variable=GSET(COLREP, color-index, color);
Description
The GSET(COLREP, . . . )function associates a predened SAS color name with a color index. Many of the GASK routines and GSET functions use color-index as an argument. If this function is not used, DSGI searches for a color specication in the following order: 1 the nth color in the color list of the COLORS= graphics option 2 the nth color in the devices default color list.
Argument Denitions
color-index color numeric constant or numeric variable name; a number from 1 to 256 that identies a color. character string enclosed in quotation marks or character variable name; a predened SAS color name. See SAS Color Names and RGB Values in the SAS Registry on page 173 for a list of predened SAS color names.
See Also
COLORS= graphics option (see COLORS on page 342) COLINDEX on page 821 COLREP on page 822
DEVICE
Species the output graphics device
Operating States: GKCL Return Codes: 0, 1 Default Value:
1. DEVICE= graphics option, if specied; 2. value entered in DEVICE prompt window; 3. value entered in OPTIONS window
Syntax
return-code-variable=GSET(DEVICE, device);
Description
The GSET(DEVICE, . . . )function selects the device driver.
Argument Denitions
device character string enclosed in quotation marks or character variable name; the name of the driver you are using. Device must match one
878
FILCOLOR
Chapter 32
of the device entries in the SASHELP.DEVICES catalog or one of your personal device catalogs, GDEVICE0.DEVICES through GDEVICE9.DEVICES. Refer to Device Catalogs on page 1126 for more information about catalogs that store device entries.
See Also
DEVICE= graphics option (see DEVICE on page 350) DEVICE on page 823
FILCOLOR
Species the color index of the color used to draw ll areas
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 85 1
Syntax
return-code-variable=GSET(FILCOLOR, color-index);
Description
The GSET(FILCOLOR, . . . )function selects the color index of the color used to draw ll areas. The aspect source ag (ASF) of FILCOLOR must be set to INDIVIDUAL for this attribute to be used outside of a ll bundle. DSGI searches for a color to assign to the index in the following order:
1 the color specied for the index in a GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the device entry.
Argument Denitions
color-index numeric constant or numeric variable name; indicates the index of the color to be used. Valid values are 1 to 256, inclusive.
See Also
COLORS= graphics option (see COLORS on page 342) ASF on page 872 COLREP on page 876 FILCOLOR on page 823 FILREP on page 879
FILREP
879
FILINDEX
Species the index of the bundle of ll area attributes
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 75 Default Value:
Syntax
return-code-variable=GSET(FILINDEX, index);
Description
The GSET(FILINDEX, . . . )function activates a particular ll bundle. To use the bundled values when the affected graphics element is drawn; the aspect source ag (ASF) for FILCOLOR, FILSTYLE, and FILTYPE must be set to BUNDLED.
Argument Denitions
index numeric constant or numeric variable name; species the index number of the ll bundle. Valid values are 1 to 20, inclusive.
See Also
FILINDEX on page 824 ASF on page 872 FILREP on page 879
FILREP
Associates a bundle of ll attributes with an index
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 75, 78, 85 Default Value:
none
Syntax
return-code-variable =GSET(FILREP, index, color-index, interior, style-index);
Description
The GSET(FILREP, . . . )function assigns a color, type of interior, and style of the interior to a specic ll bundle. To use the bundled values when the affected graphics
880
FILSTYLE
Chapter 32
element is drawn; the aspect source ag (ASF) for FILCOLOR, FILTYPE, and FILSTYLE must be set to BUNDLED.
Argument Denitions
index numeric constant or numeric variable name; indicates the index to be used with the bundle. Valid values are 1 to 20, inclusive. If index is expressed as a variable, the variable name must be initialized to a value between 1 and 20. numeric constant or numeric variable name; indicates the index of the color to be used. Valid values are 1 to 256, inclusive. The color index should represent one of the following: 3 a color index assigned with the GSET(COLREP, . . . )function 3 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list. character string enclosed in quotation marks or character variable name; indicates the type of interior. Valid values are 3 HATCH 3 HOLLOW 3 PATTERN 3 SOLID. numeric constant or numeric variable name; indicates the index of the style to be used. Valid values are 1 to 15, inclusive, when FILTYPE is PATTERN, or 1 to 60, inclusive, when FILTYPE is HATCH. See the GSET(FILSTYLE, . . . )functionFILSTYLE on page 880 for a table of the patterns used for each style index. If interior is HOLLOW or SOLID, style-index is ignored.
color-index
interior
style-index
See Also
FILREP on page 825 ASF on page 872 COLREP on page 876 FILCOLOR on page 878 FILINDEX on page 879 FILSTYLE on page 880 FILTYPE on page 882
FILSTYLE
Species the style of the interior of the ll area when the FILTYPE is PATTERN or HATCH GKOP, SGOP, WSAC, WSOP 0, 8, 78 Default Value: 1
Operating State: Return Codes:
FILSTYLE
881
Syntax
return-code-variable=GSET(FILSTYLE, style-index);
Description
The GSET(FILSTYLE, . . . )function activates a particular ll pattern when FILTYPE is specied as either PATTERN or HATCH. The aspect source ag (ASF) must be set to INDIVIDUAL for this attribute to be used outside of a ll bundle.
Table 32.1
Value 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
882
FILTYPE
Chapter 32
Value 29 30
PATTERN
Value 59 60
PATTERN
Argument Denitions
style-index numeric constant or numeric variable name. Valid values are 1 to 15, inclusive, when FILTYPE is PATTERN, or 1 to 60, inclusive, when FILTYPE is HATCH. See Table 31.1 on page 777 for value specications.
See Also
FILSTYLE on page 826 ASF on page 872 FILREP on page 879 FILTYPE on page 882
FILTYPE
Species the type of the interior of the ll area
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 78 HOLLOW
Syntax
return-code-variable=GSET(FILTYPE, interior);
Description
The GSET(FILTYPE, . . . )function selects a particular type of interior ll. If FILTYPE is set to HATCH or PATTERN, the GSET(FILSTYLE, . . . )function determines the type of hatch or pattern ll used. The aspect source ag (ASF) for FILTYPE must be set to INDIVIDUAL for this attribute to be used outside of a ll bundle.
Argument Denitions
interior character string or character variable name; indicates the type of interior ll. Valid values are
3 3 3 3
HSIZE
883
See Also
ASF on page 872 FILREP on page 879 FILSTYLE on page 880
HPOS
Species the number of columns
Operating States: GKCL Return Codes: 0, 1, 90, 307 Default Value:
Syntax
return-code-variable=GSET(HPOS, hpos);
Description
The GSET(HPOS, . . . )function sets the number of columns in the graphics output area. GSET(HPOS, . . . )has the same effect as the HPOS= graphics option. See HPOS on page 385 for more information. You can reset the HPOS value by submitting one of the following statements:
goptions reset=goptions; goptions reset=all; goptions hpos=0;
Argument Denitions
hpos numeric constant or numeric variable name; species the number of horizontal columns; must be greater than 0.
See Also
HPOS on page 828 HSIZE on page 829 VPOS on page 852 HPOS= graphics option (see HPOS on page 385)
HSIZE
Species the horizontal dimension of the graphics output area
884
HTML
Chapter 32
0, 1, 90, 307 Default Value: 1. HSIZE= graphics option, if specied; 2. HSIZE device parameter
Return Codes:
Syntax
return-code-variable=GSET(HSIZE, hsize);
Description
The GSET(HSIZE, . . . )function sets the horizontal dimension, in inches, of the graphics output area. GSET(HSIZE, . . . )affects the dimensions of the default window. You can reset the HSIZE value by submitting one of the following statements:
goptions reset=goptions; goptions reset=all; goptions hsize=0;
Argument Denitions
hsize numeric constant or numeric variable name; species the horizontal dimension, in inches, of the graphics output area; must be greater than 0.
See Also
HSIZE on page 829 HPOS on page 883 VSIZE on page 906 HSIZE= graphics option (see HSIZE on page 386)
HTML
Species the HTML string to invoke when an affected DSGI graphic element in a web page is clicked
Operating States: GKOP, SGOP, WSAC, WSOP
Syntax
return-code-variable=GSET(HTML, string);
Description
The GSET(HTML, . . . )function sets the HTML string to invoke when an affected DSGI graphic element in a web page is clicked. The HTML string is used with ODS
LINCOLOR
885
processing to create a drill-down graph. The string value is used as the value for the HREF= attribute in the image map that implements the drill-down capability. The value for string must be HREF= followed by a valid URL that is specied in double quotation marks, as in
rc = GSET("HTML", "HREF="http://www.sas.com/"");
The HTML string can be used by any of the following graphic element types drawn in the code: BAR, ELLIPSE, FILL, MARK, PIE, and TEXT. The string applies to all of these element types that are drawn after the string is set. To change the HTML string, set a new value. To turn off the HTML string, specify a null string:
rc = GSET("HTML", "");
Argument Denitions
string the HTML string. The string must be enclosed in single quotation marks and must begin with HREF= followed by a URL that is enclosed in double quotation marks.
See Also
HTML on page 830 BAR on page 857 ELLIPSE on page 859 FILL on page 860 MARK on page 863 PIE on page 864 TEXT on page 865
LINCOLOR
Species the color index of the color used to draw lines
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 85 Default Value:
Syntax
return-code-variable=GSET(LINCOLOR, color-index);
Description
The GSET(LINCOLOR, . . . )function selects the index of the color used to draw lines. The aspect source ag (ASF) for LINCOLOR must be set to INDIVIDUAL for this attribute to be used outside of a line bundle. DSGI searches for a color specication in the following order: 1 the color specied for the index in a GSET(COLREP, . . . )function
886
LININDEX
Chapter 32
2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the device entry.
Argument Denitions
color-index numeric constant or numeric variable name; indicates the index of the color to use. Valid values are 1 to 256, inclusive.
See Also
COLORS= graphics option (see COLORS on page 342) LINCOLOR on page 830 ASF on page 872 COLREP on page 876 LINREP on page 887
LININDEX
Species the index of the bundle of line attributes
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 60 1
Syntax
return-code-variable=GSET(LININDEX, index);
Description
The GSET(LININDEX, . . . )function activates a particular line bundle. To use the bundled values when the affected graphics element is drawn; the aspect source ag (ASF) for LINCOLOR, LINTYPE, and LINWIDTH must be set to BUNDLED.
Argument Denitions
index numeric constant or numeric variable name; indicates the index of the bundle to activate. Valid values are 1 to 20, inclusive.
See Also
LININDEX on page 831 ASF on page 872 LINREP on page 887
LINREP
887
LINREP
Associates a bundle of line attributes with an index
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 60, 62, 85, 90 Default Value:
none
Syntax
return-code-variable=GSET (LINREP,index, color-index, width, type);
Description
The GSET(LINREP, . . . )function assigns a color, width, and line type to a specic line bundle. To use the bundled values when the affected graphics element is drawn; the aspect source ag (ASF) for LINCOLOR, LINWIDTH, and LINTYPE must be set to BUNDLED.
Argument Denitions
index numeric constant or numeric variable name; indicates the number for the bundle to use as an index. Valid values are 1 and 20, inclusive. If index is expressed as a variable, the variable must be initialized to a value between 1 and 20. numeric constant or numeric variable name; species the index of the color to use. Valid values are 1 to 256, inclusive. The color index should represent one of the following:
color-index
3 a color index assigned with the GSET(COLREP, . . . )function 3 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
width type numeric constant or numeric variable name; indicates the width of the line; must be greater than 0. numeric constant or numeric variable name; indicates the type of line. Valid values are 1 to 46, inclusive. See Figure 14.22 on page 276 for representations of the different line types.
See Also
ASF on page 872 COLREP on page 876 LINCOLOR on page 885 LININDEX on page 886 LINREP on page 887 LINTYPE on page 888 LINWIDTH on page 888
888
LINTYPE
Chapter 32
LINTYPE
Species the line type
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 62 1
Syntax
return-code-variable=GSET(LINTYPE, type);
Description
The GSET(LINTYPE, . . . )function selects a line type. See Figure 14.22 on page 276 for representations of the different line types. The aspect source ag (ASF) for LINTYPE must be set to INDIVIDUAL for this attribute to be used outside of a line bundle.
Argument Denitions
type numeric constant or numeric variable name; indicates the type of line to use. Valid values are 1 to 46, inclusive.
See Also
LINTYPE on page 833 ASF on page 872 LINREP on page 887
LINWIDTH
Species the thickness of the line
Operating States: GKOP, SGOP, WSAC, WSOP
0, 8, 90 Default Value: 1
Return Codes:
Syntax
return-code-variable=GSET(LINWIDTH, width);
Description
The GSET(LINWIDTH, . . . )function selects a line width in units of pixels. The aspect source ag (ASF) for LINWIDTH must be set to INDIVIDUAL for this attribute to be used outside of a line bundle.
MARCOLOR
889
Argument Denitions
width numeric constant or numeric variable name; species the width of the line in pixels; must be greater than 0.
See Also
LINWIDTH on page 833 ASF on page 872 LINREP on page 887
MARCOLOR
Species the color index of the color used to draw markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 85 Default Value:
Syntax
return-code-variable=GSET(MARCOLOR, color-index);
Description
The GSET(MARCOLOR, . . . )function selects the color index of the color used to draw markers. The aspect source ag (ASF) of MARCOLOR must be set to INDIVIDUAL for this attribute to be used outside of a marker bundle. DSGI searches for a color specication in the following order:
1 the color specied for the index in a GSET(COLREP, . . . )function 2 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the device entry.
Argument Denitions
color-index numeric constant or numeric variable name; indicates the index of the color to use. Valid values are 1 to 256, inclusive.
See Also
COLORS= graphics option (see COLORS on page 342) MARCOLOR on page 834 ASF on page 872 COLREP on page 876 MARREP on page 890
890
MARINDEX
Chapter 32
MARINDEX
Species the index of the bundle of marker attributes
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 64 1
Syntax
return-code-variable=GSET(MARINDEX, index);
Description
The GSET(MARINDEX, . . . )function activates the marker bundle indicated by index. The aspect source ag (ASF) for MARCOLOR, MARTYPE, and MARSIZE must be set to BUNDLED before the GDRAW(MARK, . . . )function is executed if you want the bundled values to be used when the marker is drawn.
Argument Denitions
index numeric constant or numeric variable name; the number of the bundle to activate. Valid values are 1 to 20, inclusive.
See Also
MARINDEX on page 835 ASF on page 872 MARREP on page 890
MARREP
Associates a bundle of marker attributes with an index
Operating States: GKOP, SGOP, WSAC, WSOP
Syntax
return-code-variable=GSET (MARREP,index, color-index, size, type);
Description
The GSET(MARREP, . . . )function assigns a color, size, and type of marker to a specic marker bundle. The aspect source ag (ASF) of MARCOLOR, MARSIZE, and
MARSIZE
891
MARTYPE must be set to BUNDLED before the GDRAW(MARK, . . . )function is executed if you want the bundled values to be used when the marker is drawn.
Argument Denitions
index color-index numeric constant or numeric variable name; denes the bundle index number. Valid values are 1 to 20, inclusive. numeric constant or numeric variable name; indicates the color index of the color to use. Valid values are 1 to 256, inclusive. The color index should represent one of the following: 3 a color index assigned to a color name with the GSET(COLREP, . . . )function 3 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list. numeric constant or numeric variable name; indicates the size of the marker in units of the current window system; must be greater than 0. numeric constant or numeric variable name; species the type of marker to use; valid values are 1 to 67, inclusive. See Table 32.2 on page 892 for a table of the symbols used for each marker type.
size
type
See Also
ASF on page 872 COLREP on page 876 MARCOLOR on page 889 MARINDEX on page 890 MARSIZE on page 891 MARTYPE on page 892
MARSIZE
Selects the size of markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 90 Default Value:
Syntax
return-code-variable=GSET(MARSIZE, size);
Description
The GSET(MARSIZE, . . . )function sets the marker size in units of the current window system. The aspect source ag (ASF) of MARSIZE must be set to INDIVIDUAL for this attribute to be used outside of a marker bundle.
892
MARTYPE
Chapter 32
Argument Denitions
size numeric constant or numeric variable name; indicates the size of the marker in units of the current window system; must be greater than 0.
See Also
MARSIZE on page 837 ASF on page 872 MARREP on page 890
MARTYPE
Selects the kind of markers
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 66 1
Syntax
return-code-variable=GSET(MARTYPE, type);
Description
The GSET(MARTYPE, . . . )function determines the type of marker drawn. See Figure 14.21 on page 270 for representations of the symbols described in Table 32.2 on page 892. The aspect source ag (ASF) of MARTYPE must be set to INDIVIDUAL for this attribute to be used outside of a marker bundle.
Table 32.2
Values and Markers 1 2 3 4 5 6 7 8 9 10 plus x star square diamond triangle hash Y Z paw 24 25 26 27 28 29 30 31 32 33 K L M N O P Q R S T 46 47 48 49 50 51 52 53 54 55 9 lozenge spade heart diamond club shamrock eur-de-lis star sun
MESSAGE
893
Values and Markers 11 12 13 14 15 16 17 18 19 20 21 22 23 point dot circle A B C D E F G H I J 34 35 36 37 38 39 40 41 42 43 44 45 U V W 0 1 2 3 4 5 6 7 8 56 57 58 59 60 61 62 63 64 65 66 67 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto moon comet asterisk
Argument Denitions
type numeric constant or numeric variable name; indicates the index of the marker to draw. Valid values are 1 to 67, inclusive. See Table 32.2 on page 892 for value specications.
See Also
MARTYPE on page 837 ASF on page 872 MARREP on page 890
MESSAGE
Species whether the interface error message system is enabled or disabled
Operating States: All Return Codes: 0 Default Value:
ON
Syntax
return-code-variable=GSET(MESSAGE, status);
Description
The GSET(MESSAGE, . . . )function activates or suppresses automatic error logging.
894
PATREP
Chapter 32
Argument Denitions
status character string enclosed in quotation marks or character variable name; indicates whether messages should be displayed. Valid values are ON and OFF. When ON is used, messages are automatically generated by the DSGI based on the return code from the function. If you set MESSAGE to OFF, no messages are automatically printed. You can do this to print custom messages for your application, or custom error messages.
See Also
MESSAGE on page 864 GPRINT on page 814
PATREP
Species the pattern name of a style index for a particular ll type.
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 79 Default value: 1
Syntax
return-code-variable=CALL GSET(PATREP, index, pattern-name, hatch-name);
Description
The GSET(PATREP, . . . )function sets a pattern of a style index for a particular ll type.
Argument Denitions
index pattern-name hatch-name numeric variable name; indicates the index of the pattern to be used. character variable name; sets the name of the pattern at the specied index. character variable name; sets the name of the hatch at the specied index.
See Also
PATREP on page 840
TEXALIGN
Species the horizontal and vertical alignment of the text string
TEXALIGN
895
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8 Default values:
halign=NORMAL, valign=NORMAL
Syntax
return-code-variable=GSET(TEXALIGN, halign, valign);
Description
The GSET(TEXALIGN, . . . )function sets a particular type of horizontal and vertical alignment for text strings. Figure 32.5 on page 895 illustrates halign.
Figure 32.5
Halign Values
Figure 32.6
Valign Values
Argument Denitions
halign character string enclosed in quotation marks or character variable name. Valid values are CENTER LEFT
896
TEXCOLOR
Chapter 32
NORMAL (the natural alignment based on the text path); alignment is chosen according to the following logic:
1 If TEXPATH is RIGHT, then NORMAL is LEFT. 2 Otherwise, if TEXPATH is LEFT, then NORMAL is
RIGHT.
3 Otherwise, the text string is centered.
RIGHT. valign character string enclosed in quotation marks or character variable name. Valid values are BASE (alignment based on the baseline of the text string) BOTTOM (alignment based on the bottom of the text string) HALF (alignment based on the vertical midpoint of the string) NORMAL (natural alignment based on the text path); alignment is chosen according to the following logic:
1 If TEXPATH is RIGHT or TEXPATH is LEFT, then
NORMAL is BASE.
2 Otherwise, if TEXPATH is UP, then NORMAL is
BOTTOM.
3 Otherwise, if TEXPATH is DOWN, then NORMAL is
See Also
TEXALIGN on page 842 TEXT on page 865 TEXPATH on page 899 TEXUP on page 901
TEXCOLOR
Species the color index of the color used to draw text strings
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 85 1
Syntax
return-code-variable=GSET(TEXCOLOR, color-index);
Description
The GSET(TEXCOLOR, . . . )function selects the color for text. The aspect source ag (ASF) of TEXCOLOR must be set to INDIVIDUAL for this attribute to be used outside of a text bundle.
TEXFONT
897
The value of GSET(TEXCOLOR, . . . )can be used in a text bundle. See the TEXREP on page 900 for information on how to dene a text bundle. DSGI searches for a color specication in the following order: 1 the color specied for the index in a GSET(COLREP, . . . )function
2 the nth color from the color list of the COLORS= graphics option 3 the nth color in the devices default color list found in the device entry.
Argument Denitions
color-index numeric constant or numeric variable name; indicates the color index of the color to be used. Valid values are 1 to 256, inclusive.
See Also
COLORS= graphics option (see COLORS on page 342) TEXCOLOR on page 842 ASF on page 872 COLREP on page 876 TEXREP on page 900
TEXFONT
Species the font used to draw text strings
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8 Default values: 1. FTEXT= graphics option, if specied; 2. device-resident font, if
Syntax
return-code-variable=GSET(TEXFONT, font);
Description
The GSET(TEXFONT, . . . )function selects a SAS/GRAPH font for the text. The aspect source ag (ASF) of TEXFONT must be set to INDIVIDUAL for this attribute to be used outside of a text bundle. See SAS/GRAPH Font Lists on page 1636 for a list of valid SAS/GRAPH fonts. You can also use fonts you have created using the GFONT procedure.
Argument Denitions
font character string enclosed in quotation marks or character variable name; the name of a font that can be accessed by SAS/GRAPH software. If you want to use the device-resident font, submit
rc=gset("texfont", " ");
898
TEXHEIGHT
Chapter 32
When DSGI is used with long font names, the font name must be in double quotation marks that are embedded in single quotation marks.
See Also
FTEXT= graphics options (see FTEXT on page 365) TEXFONT on page 844 ASF on page 872 TEXREP on page 900
TEXHEIGHT
Species the character height of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
Syntax
return-code-variable=GSET(TEXHEIGHT, height);
Description
The GSET(TEXHEIGHT, . . . )function sets the height for text. GSET(TEXHEIGHT, . . . )affects text the same way as the HTEXT= graphics option.
Argument Denitions
height numeric constant or numeric variable name; indicates height in units based on the current window system; must be greater than 0.
See Also
TEXHEIGHT on page 845 HTEXT= graphics options (see HTEXT on page 387)
TEXINDEX
Species the index of the bundle of text attributes
Operating States: GKOP, SGOP, WSAC, WSOP
0, 8, 68 Default Value: 1
Return Codes:
TEXPATH
899
Syntax
return-code-variable=GSET(TEXINDEX, index);
Description
The GSET(TEXINDEX, . . . )function activates the text bundle indicated by index. The aspect source ag (ASF) for TEXCOLOR and TEXFONT must be set to BUNDLED before the GDRAW(TEXT, . . . )function is executed if you want the bundled values to be used when the text is drawn.
Argument Denitions
index numeric constant or numeric variable name; indicates the number of the bundle to activate. Valid values are 1 to 20, inclusive.
See Also
TEXINDEX on page 846 ASF on page 872 TEXREP on page 900
TEXPATH
Species the direction of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8 Default Value:
RIGHT
Syntax
return-code-variable=GSET(TEXPATH, path);
Description
The GSET(TEXPATH, . . . )function selects a particular type of text path. Text path determines the direction in which the text string reads. Figure 32.7 on page 900 illustrates the text paths that can be used with DSGI.
900
TEXREP
Chapter 32
Figure 32.7
TEXPATH Values
Argument Denitions
path character string enclosed in quotation marks or character variable name; species the direction the text is read. Valid values:
3 3 3 3
See Also
TEXPATH on page 846 TEXT on page 865 TEXALIGN on page 894 TEXUP on page 901
TEXREP
Associates a bundle of text attributes with an index
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 68, 85 none
Syntax
return-code-variable=GSET (TEXREP,index, color-index, font);
Description
The GSET(TEXREP, . . . )function assigns a color and font to a particular text bundle. The aspect source ags (ASF) of TEXCOLOR and TEXFONT must be set to
TEXUP
901
BUNDLED before the GDRAW(TEXT, . . . )function is executed if you want the bundled values to be used when the text is drawn.
Argument Denitions
index numeric constant or numeric variable name; species the number to use as an index for the bundle; valid values are 1 to 20, inclusive. If index is expressed as a variable, the variable must be initialized to a value between 1 and 20. numeric constant or numeric variable name; indicates the color to use; valid values are 1 to 256, inclusive. The color index should represent one of the following:
color-index
3 a color index assigned with the GSET(COLREP, . . . )function 3 the nth color in the color list of the COLORS= graphics option 3 the nth color in the devices default color list.
font character string enclosed in quotation marks or character variable name; names the font to use with the bundle. See SAS/GRAPH Font Lists on page 1636 for a list of valid SAS/GRAPH fonts. You can also use fonts you have created using the GFONT procedure.
See Also
COLORS= graphics option (see COLORS on page 342) TEXREP on page 847 ASF on page 872 COLREP on page 876 TEXINDEX on page 898
TEXUP
Species the orientation (angle) of the text string
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 74 Default Values:
upx=0, upy=1
Syntax
return-code-variable=GSET(TEXUP,upx, upy);
Description
The GSET(TEXUP, . . . )function sets the angle of the text string. DSGI uses the values of character up vectors to determine the angle of a text string. The character up vector has two components, upx and upy, that describe the angle at which the text string is placed. The angle is calculated with the following formula:
902
TEXUP
Chapter 32
angle=atan(upx/upy)
Effectively, when DSGI is calculating the angle for the text, it uses upx and upy as forces that are pushing the string toward an angle. The natural angle of text in the upx direction is toward the 6 oclock position. In the upy direction, text naturally angles at the 3 oclock position. If upx is greater than upy, the text is angled toward 6 oclock. If upy is greater than upx, the text is angled toward 3 oclock. Figure 32.8 on page 902 shows the angle of text when the values for upx and upy are (0.0, 1.0) and (1.0, 0.0).
Figure 32.8
As you change the values of upx and upy, the coordinate that has the highest value is taken as the angle, and the lowest value as the offset. Figure 32.9 on page 902 shows the angle of text when the character up vector values (+1.0, +0.5) are used.
Figure 32.9 Varying the Angle of Text
You can use the following macro to convert angles measured in degrees to character up vectors:
TEXUP
903
%macro angle(x); if mod(&x, 180)=90 then do; if mod(&x,270) = 0 then xup = 1.0; else xup = -1.0; rc = gset("texup", xup, 0.0); end; else do; b = mod(&x, 360); /* adjust y vector for 2nd and 3rd quadrants */ if b > 90 and b lt 270 then yup = -1.0; else yup = 1.0; a=&x*1.7453292519943300e-002; xup = tan(-a); /* adjust x vector for 3rd quadrant */ if b > 180 and b le 270 then xup = -xup; rc = gset("texup", xup, yup); end; %mend angle; data _null_; rc = ginit(); rc = graph("clear", "angle"); rc = gset("texalign", "left", "base"); rc = gset("texheight", 5); rc = gset("texfont", "swissl"); %angle(180); rc = gdraw("text", 50, 50, "180"); %angle(80); rc = gdraw("text", 50, 50, "80"); %angle(600); rc = gdraw("text", 50, 50, "600"); rc = graph("update"); rc = gterm(); run;
Argument Denitions
upx upy numeric constant or numeric variable name; if upy is 0, upx cannot be 0. numeric constant or numeric variable name; if upx is 0, upy cannot be 0.
See Also
TEXUP on page 848 TEXT on page 865 TEXALIGN on page 894 TEXPATH on page 899
904
TRANSNO
Chapter 32
TRANSNO
Species the number of the transformation to be used
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Value:
0, 8, 50 0
Syntax
return-code-variable=GSET(TRANSNO, n);
Description
The GSET(TRANSNO, . . . )function activates the viewport, or the window you have dened for the specied transformation number, or both. If you have not dened both a viewport and window for a transformation, the default is used for the one missing. You can select 0 as the active transformation, but you cannot dene a viewport or window for that transformation number. A transformation of 0 activates the default viewport, (0,0) to (1,1), and window, which is device dependent.
Argument Denitions
n numeric constant or numeric variable name; indicates the viewport, or the window to activate, or both. Should correspond to the n used in the GSET(VIEWPORT, . . . )or GSET(WINDOW, . . . )functions, or both. Valid values are 0 to 20, inclusive.
See Also
TRANS on page 849 TRANSNO on page 850 VIEWPORT on page 851 WINDOW on page 853 VIEWPORT on page 904 WINDOW on page 907
VIEWPORT
Associates a viewport with a transformation number
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: Default Values:
VPOS
905
Syntax
return-code-variable=GSET(VIEWPORT, n, llx, lly, urx, ury);
Description
The GSET(VIEWPORT, . . . )function denes a viewport and associates it with the transformation number, n. See the TRANSNO on page 904 for information on how to activate the viewport. See the WINDOW on page 907 for information on how to dene a window to be used within the viewport.
Argument Denitions
n numeric constant or numeric variable name; species the transformation number of the viewport. Valid values are 1 to 20, inclusive. numeric constant or numeric variable name; denes the x component of the lower-left corner of the viewport; must not exceed the value of urx; cannot be less than 0. Units are based on percent of the graphics output area. numeric constant or numeric variable name; denes the y component of the lower-left corner of the viewport; must not exceed the value of ury; cannot be less than 0. Units are based on percent of the graphics output area. numeric constant or numeric variable name; denes the x component of the upper-right corner of the viewport; cannot be greater than 1. Units are based on percent of the graphics output area. numeric constant or numeric variable name; denes the y component of the upper-right corner of the viewport; cannot be greater than 1. Units are based on percent of the graphics output area.
llx
lly
urx
ury
See Also
VIEWPORT on page 851 WINDOW on page 907 TRANSNO on page 904 TRANSNO on page 850 TRANS on page 849 WINDOW on page 853
VPOS
Species the number of rows
Operating States: GKCL Return Codes: 0, 1, 90, 307 Default Values: 1. VPOS=graphics option, if specied; 2. devices default VPOS value
906
VSIZE
Chapter 32
Syntax
return-code-variable=GSET(VPOS, vpos);
Description
The GSET(VPOS, . . . )function sets the number of rows in the graphics output area. GSET(VPOS, . . . )has the same effect on graphics output as the VPOS= graphics option. You can reset the VPOS value by submitting one of the following statements:
goptions reset=goptions; goptions reset=all; goptions vpos=0;
Argument Denitions
vpos numeric constant or numeric variable name; species the number of rows in the graphics output area; must be greater than 0.
See Also
VPOS on page 852 HPOS on page 883 VSIZE on page 906 VPOS= graphics option (see VPOS on page 432)
VSIZE
Species the vertical dimension of the graphics output area
Operating States: GKCL Return Codes: Default Values:
0, 1, 90, 307 1. VSIZE= graphics option, if specied; 2. devices default VSIZE value
Syntax
return-code-variable=GSET(VSIZE, vsize);
Description
The GSET(VSIZE, . . . )function sets the vertical dimension, in inches, of the graphics output area. GSET(VSIZE, . . . )affects the dimensions of the default window. You can reset the VSIZE value by submitting one of the following statements:
goptions reset=goptions; goptions reset=all; goptions vsize=0;
WINDOW
907
Argument Denitions
vsize numeric constant or numeric variable name; indicates the vertical dimension for the graph in inches; must be greater than 0.
See Also
VSIZE on page 852 HSIZE on page 883 VPOS on page 905 VSIZE= graphics option (see VSIZE on page 432)
WINDOW
Associates a window with a transformation number
Operating States: GKOP, SGOP, WSAC, WSOP Return Codes: 0, 8, 50, 51 Default Values:
Syntax
return-code-variable=GSET (WINDOW, n, llx, lly, urx, ury);
Description
The GSET(WINDOW, . . . )function denes a window and associates it with a transformation number. See the TRANSNO on page 904 for information on how to activate a window. See the VIEWPORT on page 904 for information on how to dene a viewport for a window.
Argument Denitions
n numeric constant or numeric variable name; species the transformation number of the window. Valid values are 1 to 20, inclusive. numeric constant or numeric variable name; denes the x component of the lower-left corner of the window; must not exceed the value of urx. Units are based on percent of the active viewport. numeric constant or numeric variable name; denes the y component of the lower-left corner of the window; must not exceed the value of ury. Units are based on percent of the active viewport. numeric constant or numeric variable name; denes the x component of the upper-right corner of the window. Units are based on percent of the active viewport. numeric constant or numeric variable name; denes the y component of the upper-right corner of the window. Units are based on percent of the active viewport.
llx
lly
urx
ury
908
Chapter 32
See Also
TRANS on page 849 TRANSNO on page 850 VIEWPORT on page 851 WINDOW on page 853 TRANSNO on page 904 VIEWPORT on page 904
51 52 55 56 60 61 62
See Also
909
64 65 66 68 69 73 74 75 76 78 79 86 87 90 150
Invalid marker index; index numbers must be in the range 1 to 20. No bundle dened for the polymarker index; a GSET(MARREP, . . . )function has not been submitted for the referenced marker index. Marker type is less than or equal to 0 or greater than 67; type must be in the range 1 to 67. Invalid text index; index numbers must be in the range 1 to 20. No bundle dened for the text index; a GSET(TEXREP, . . . )function has not been submitted for the referenced text index. Character height is less than or equal to 0; height must be greater than 0. Both components of the character up vector are 0; both X and Y of a character up vector cannot be 0. Invalid ll index; index numbers must be in the range 1 to 20. No bundle dened for the ll index; a GSET(FILREP, . . . )function has not been submitted for the referenced ll index. Style index is less than or equal to 0 or greater than 60; style indexes must be in the range of 1 to 60. Invalid pattern index. Invalid color index; color index is out of the range 1 to 256 or is not numeric. No color name dened for the color index Value is less than 0; value must be greater than or equal to 0. External image le cannot be accessed. The image le either cannot be accessed, or the image le is in an unsupported format, or the image data is incomplete or otherwise corrupt. Out of memory; your workstation does not have enough memory to generate the graph. Out of room for graph; your device cannot display the size of the graph. Error occurred in program library management; a GRAPH function did not execute properly.
See Also
Chapter 6, Using Graphics Devices, on page 67 for information about specifying device drivers. Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for descriptions of graphics options and device parameters Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for information about the fonts available in SAS/GRAPH software
910
References
Chapter 32
Chapter 12, SAS/GRAPH Colors and Images, on page 165 for information about specifying colors in SAS/GRAPH programs GOPTIONS Statement on page 219 for an explanation of setting graphics options with the GOPTIONS statement PATTERN Statement on page 238 for information about specifying patterns with DSGI SYMBOL Statement on page 250 for representations of the markers that can be used with DSGI Chapter 31, The DATA Step Graphics Interface, on page 769 for a complete explanation of using DSGI statements to produce graphs Chapter 38, The GDEVICE Procedure, on page 1125 for information about device entries The discussion for ARRAY in SAS Language Reference: Dictionary for an explanation of argument lists
References
Enderle, G.; Kansy, K.; and Pfaff, G. (1985), Computer Graphics Programming: GKSThe Graphics Standard Springer-Verlag New York, Inc.
911
P A R T
5
913 931 947 989 1095
SAS/GRAPH Procedures
Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter
34. . . . . . . . .The GAREABAR Procedure 35. . . . . . . . .The GBARLINE Procedure 36. . . . . . . . .The GCHART Procedure
37. . . . . . . . .The GCONTOUR Procedure 38. . . . . . . . .The GDEVICE Procedure 39. . . . . . . . .The GEOCODE Procedure 40. . . . . . . . .The GFONT Procedure 41. . . . . . . . .The GINSIDE Procedure 42. . . . . . . . .The GKPI Procedure 43. . . . . . . . .The GMAP Procedure
1125 1147
1165 1195
1315 1385
46. . . . . . . . .The GPROJECT Procedure 47. . . . . . . . .The GRADAR Procedure 48. . . . . . . . .The GREDUCE Procedure
1409 1437
912
49. . . . . . . . .The GREMOVE Procedure 50. . . . . . . . .The GREPLAY Procedure 51. . . . . . . . .The GSLIDE Procedure 52. . . . . . . . .The GTILE Procedure 53. . . . . . . . .The G3D Procedure
1449 1465
1509 1519
913
CHAPTER
33
The GANNO Procedure
Overview 913 Procedure Syntax 914 PROC GANNO Statement 914 Examples 916 Example 1: Scaling Data-Dependent Output 916 Example 2: Storing Annotate Graphics 919 Example 3: Using the NAME= Option to Produce Multiple Graphs Example 4: Using Annotate Graphics in a Drill-Down Graph 925
921
Overview
The GANNO procedure displays graphs created by Annotate data sets. The procedure can also be used to scale data-dependent graphics to t the graphics output area. Note that the GANNO procedure ignores all currently dened title and footnote statements and some graphics option specications, including BORDER=. To include titles, footnotes, and graphics options along with your Annotate data set, use the GSLIDE procedure instead of the GANNO procedure. For more information about the Annotate facility, see Chapter 29, Using Annotate Data Sets, on page 643. By default, both the GANNO and GSLIDE procedures scale graphics output from the data set to ll the entire graphics area. However, if you are using a data coordinate system and the data values are so large that some of the graphics elements do not t in the graphics output area and are not displayed, you can use the GANNO procedure with the DATASYS option. This will cause the procedure to scale the output to t the available space. The GSLIDE procedure does not have this capability. Figure 33.1 on page 913 displays output from an Annotate data set.
Figure 33.1
914
Procedure Syntax
Chapter 33
Procedure Syntax
Requirements: Supports:
PROC GANNO ANNOTATE=Annotate-data-set <DATASYS> <DESCRIPTION=description> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set> <LONGNAME=entry-name> <NAME= entry-name | variable-name>;
Syntax
PROC GANNO ANNOTATE=Annotate-data-set <DATASYS> <DESCRIPTION=description> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set> <NAME=entry-name | variable-name>;
Required Arguments
ANNOTATE=Annotate-data-set ANNO=Annotate-data-set
species a data set that includes Annotate variables that identify graphics commands and parameters.
See also: Chapter 29, Using Annotate Data Sets, on page 643
Options
Options in the GANNO statement affect all graphs produced by that statement. You can specify as many options as you want and list them in any order.
DATASYS
indicates that absolute or relative data-dependent coordinates occur in the Annotate data set and scales the coordinates to t the graphics output area. Use the DATASYS option only with Annotate data sets in which the coordinate system variables XSYS, YSYS, and HSYS specify the values 1, 2, 7, or 8.
915
Use the DATASYS option when graphics elements that were created with data-dependent variables do not t in the graphics output area. This happens when the coordinate values generated by the data exceed a range of 0 to 100. If you omit the DATASYS option, the GANNO procedure attempts to draw each graphics element according to the data values assigned to it, without scaling the values. If the range of data values is too large, some graphics elements will not display. See also: Using the DATASYS Option to Scale Graphs on page 916 Featured in: Example 1 on page 916
DESCRIPTION=description
species the description of the catalog entry for the chart. The maximum length is 256 characters. The description does not appear on the chart. By default, the GANNO procedure assigns the description OUTPUT FROM PROC GANNO. The descriptive text is shown in each of the following: 3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS HTML statement, assuming that the procedure output is generated while the contents page is open 3 the Description eld of the PROC GREPLAY window 3 the chart description for Web output (depending on the device driver). For more information, see PROC GANNO Statement on page 914.
Alias:
Featured in:
GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output produced by the GANNO procedure. If you omit the libref, the SAS/GRAPH software looks for the catalog in the temporary library called WORK and creates the catalog if it does not exist.
See also: Featured in:
IMAGEMAP=output-data-set
creates a temporary SAS data set that is used to generate an image map in an HTML output le. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identied to the GANNO procedure with the HTML= and/or HTML_LEGEND= options. The %IMAGEMAP macro generates the image map in the HTML output le. The macro takes two arguments, the name of the image map data set and the name or leref of the HTML output le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
See also: Chapter 30, Annotate Dictionary, on page 669 and Adding Links with
the HTML= and HTML_LEGEND= Options on page 603. Featured in: Example 4 on page 925
NAME=entry-name | variable-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to
916
Examples
Chapter 33
lowercase, and periods are converted to underscores. The default GRSEG name is GANNO. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GANNO1. Featured in: Example 2 on page 919 Example 3 on page 921
Examples
917
Figure 33.2
This example uses an Annotate data set to scale data-dependent output with the DATASYS option and create a vertical bar chart of sales for each of six sites. The values that determine the height of each bar range from 137 to 999. The range of values is so large that the GANNO procedure cannot t all of the bars in the output area without scaling the output. This program uses the DATASYS option to scale the data values so that the bars t in the graphics output area.
Set the graphics environment.
goptions reset=all border;
Create the data set WRLDTOTL. WRLDTOTL contains sales data for six sites. SITENAME contains the names of the sites. MEAN contains the average sales for each site.
data wrldtotl; length sitename $ 10; input sitename $ 1-10 mean 12-15; datalines; Paris 999 Munich 571 Tokyo 137 London 273 Frankfurt 546 New York 991 ; run;
Create the Annotate data set, WRLDANNO. XSYS and YSYS specify coordinate system 2 (absolute data values) for X and Y. HSYS species coordinate system 3 (percent of the graphics output area) for SIZE. The SET statement processes every observation in WRLDTOTL.
data wrldanno; length function color $ 8 text $ 20;
918
Chapter 33
retain line 0 xsys ysys "2" hsys "3" x 8; set wrldtotl end=end;
Draw the bars. The MOVE function denes the lower left corner of the bar. The BAR function draws the bar. Bar height (Y) is controlled by MEAN.
function="move"; x=x+8; y=20; output; function="bar"; y=y+(mean); x=x+9; style="empty"; color="red"; output;
Move to the top of the bar and write the value of MEAN.
function="move"; y=y+(mean)-3; output; function="label"; x=x-1; text=left(put(mean,3.)); position="5"; style="swiss"; size=3; output;
After all the observations are processed, add an axis line, title, footnote, and frame. The MOVE and DRAW functions draw the axis line. The LABEL function writes the title and the footnote. The FRAME function draws a border around the output.
if end then do; function="move"; x=10; y=20; output; function="draw"; x=90; y=20; line=1; size=.5; color="blue"; output; function="label"; x=50; y=95; text="Projected Sales"; xsys="3"; ysys="3"; position="5"; style="swissb"; size=5; color=" "; output; x=92; y=5; size=3; style="swiss"; text="GANSCALE"; output; function="frame"; color="blue"; when="b"; style="empty"; output; end; run;
Display the annotate graphics. The ANNOTATE= identies the data set that contains the graphics commands. DATASYS tells the procedure to use the maximum and minimum data values to construct the output environment. In addition, the values of X and Y are scaled to t the environment and all of the bars display on the graph.
proc ganno annotate=wrldanno datasys; run; quit;
919
Figure 33.3
Four Squares
This example creates an Annotate data set that draws four colored squares, displays the data set as a single graphics output, and stores the output as a catalog entry in a permanent catalog. In this example, the NAME= option species a text string that identies the name that is stored with the graphics output in the catalog.
Set the graphics environment.
goptions reset=all border;
Create the Annotate data set, SQUARES. XSYS and YSYS specify coordinate system 3 (percent of the graphics output area) for X and Y.
data squares; length function style color $ 8 text $ 15; xsys="3"; ysys="3";
920
Chapter 33
Draw the rst square. The COLOR variable assigns the color for the square. The FUNCTION variable selects the operation to be performed by the Annotate facility. The X and Y variables contain coordinate values. The BAR function draws the square. When the STYLE variable is used with the BAR function, it selects the ll pattern for the bar.
color="green"; function="move"; x=10; y=65; output; function="bar"; x=30; y=95; style="solid"; output;
Label the rst square. The LABEL function creates the label. The POSITION value of 6 left-justies the text with respect to X and Y. The TEXT variable species the text string to be written.
function="label"; x=10; y=63; position="6"; style="swissb"; size=2; text="Green"; output;
Add a footnote.
x=88; y=5; position="5"; size=1.5; style="swiss"; text="GANSQUAR"; output;
921
run;
Display the annotate graphics. GOUT= assigns the catalog in which the graphics output is stored. NAME= assigns a name to the entry stored in the WORK.EXCAT catalog. DESCRIPTION= assigns a description to the catalog entry.
proc ganno annotate=squares gout=excat name="GANSQUAR" description="Four squares"; run; quit;
In this example, the GANNO procedure uses the NAME= option to generate multiple graphs from one Annotate data set. Since NAME= is assigned the variable COLOR, the GANNO procedure generates separate graphics output for each value of the COLOR, as shown in Figure 33.4 on page 923, Figure 33.5 on page 924, Figure 33.4 on page 923 and Figure 33.6 on page 924. Each output is stored as a separate entry in the temporary output catalog WORK.EXCAT. The entries are named according to the values of COLOR: BLUE, GRAY, GREEN, and RED. Note that the output for GRAY includes the footnote shown in Example 2 on page 919. The output for RED shows the frame that is generated by the Annotate data set. The black borders in the other outputs are not generated by the code.
Set the graphics environment.
goptions reset=all border;
Create the Annotate data set, SQUARES. XSYS and YSYS specify coordinate system 3 (percent of the graphics output area) for X and Y.
data squares; length function style color $ 8 text $ 15; xsys="3"; ysys="3";
922
Chapter 33
Draw the rst square. The COLOR variable assigns the color for the square. The FUNCTION variable selects the operation to be performed by the Annotate facility. The X and Y variables contain coordinate values. The BAR function draws the square. When the STYLE variable is used with the BAR function, it selects the ll pattern for the bar.
color="green"; function="move"; x=10; y=65; output; function="bar"; x=30; y=95; style="solid"; output;
Label the rst square. The LABEL function creates the label. The POSITION value of 6 left-justies the text with respect to X and Y. The TEXT variable species the text string to be written.
function="label"; x=10; y=63; position="6"; style="swissb"; size=2; text="Green"; output;
Add a footnote.
x=88; y=5; position="5"; size=1.5; style="swiss"; text="GANSQUAR"; output;
923
run;
Generate the annotate graphics, separating graphs by color. NAME= identies the variable whose values PROC GANNO uses to generate the output. GANNO produces separate output for each value of COLOR. The COLOR value is the name of the catalog entry.
proc ganno annotate=squares name=color gout=excat description="Individual squares"; run;
Figure 33.4
924
Chapter 33
Figure 33.5
Figure 33.6
925
Figure 33.7
This example creates essentially the same Annotate data set used in Example 2 on page 919. It draws four colored squares and displays the data set as a single graphics output.
However, this time the example shows you how to use Annotate graphics to generate a drill-down graph. The example uses the HTML variable in the Annotate data set to
926
Chapter 33
specify linking information that denes each of the four squares as a hot zone. When the graph is viewed in a browser, you can click on a square to drill down to a related graph. For example, if you click on the green square, it drills down to a graph that conrms that you selected the green square.
The example uses the ODS HTML destination to generate the drill-down graph. To implement the drill-down capability, the Annotate data set uses the HTML variable to provide the linking information (see HTML Variable on page 711). The presence of the HTML variable in the Annotate data set and the IMAGEMAP= option on the GANNO procedure causes the ODS HTML destination to generate an image map for the graph in the HTML output. The example runs four GSLIDE procedures to generate the target output. Each GSLIDE procedure uses the NAME= option to name the graph it produces, ensuring that the GIF driver creates les named green.gif, blue.gif, red.gif, and gray.gif. These are the les that are referenced as targets by the strings that are specied for the Annotate data sets HTML variable.
Allocate a storage location for all the output les, and set the graphics environment.DEV= species the GIF device. GOUTMODE=REPLACE species that the output graphics use the same lenames each time you run the program, instead of appending numbers to the lenames.
/* set the graphics environment */ goptions reset=all dev=gif gunit=pct goutmode=replace border;
927
Create the Annotate data set. The HTML variable is used to dene the linking information for each square. Because the GSLIDE procedures that generate the target output use NAME= to ensure the output les are named green.gif, red.gif, blue.gif, and gray.gif, strings that reference those names are assigned to the HTML variable for the appropriate observation in the data. For the nal observation, the HTML variables value is set to a null string; otherwise it would retain the last assigned value, which is href=gray.gif. In that case, the graphs background area would be dened as a hot zone that links to le gray.gif. For a description of the other functions and variables used in the Annotate data set, see Example 2 on page 919.
/* create the Annotate data set */ data squares; length function style color $ 8 html text $ 15; xsys="3"; ysys="3"; /* draw the green square */ color="green"; function="move"; x=10; y=65; output; function="bar"; x=30; y=95; style="solid"; html="href=green.gif"; output; /* label green square */ function="label"; x=10; y=63; position="6"; style="swissb"; size=2; text="Green"; output; /* draw the red square */ color="red"; function="move"; x=60; y=65; output; function="bar"; x=80; y=95; html="href=red.gif"; output; /* label red square */ function="label"; x=60; y=63; position="6"; style="swissb"; size=2; text="Red"; output; /* draw the blue square */ color="blue"; function="move"; x=10; y=15; output; function="bar"; x=30; y=45; html="href=blue.gif"; output; /* label blue square */ function="label"; x=10; y=12; position="6"; style="swissb"; size=2; text="Blue"; output; /* draw the gray square */ color="gray"; function="move"; x=60; y=15; output; function="bar"; x=80; y=45; html="href=gray.gif"; output; /* label gray square and add a footnote */ function="label"; x=60; y=12; position="6"; style="swissb"; size=2; text="Gray"; output;
928
Chapter 33
/* draw a blue frame */ function="frame"; color="blue"; style="empty"; /* set null link for background area in frame */ html=""; output; run;
Open the ODS HTML destination. BODY= species the lename for the HTML output. PATH species the path where the output graphics les and HTML les are created.
/* open the ODS HTML destination */ ods html body="gandrill.htm" path=".";
Generate the drill-down graph. IMAGEMAP= species ANNOMAP as the name for the Imagemap data set.
/* generate annotate graphics */ proc ganno annotate=squares imagemap=annomap description="Four squares"; run;
Generate the target output.PROC GSLIDE is run four times to generate the four graphs that will serve as target output for the links that are dened in the drill-down graph.
/* generate the target output */ proc gslide wframe=4 cframe=green name="green"; note height=20; note height=10 justify=center color=green "Green Grass"; run; proc gslide wframe=4 cframe=blue name="blue"; note height=20; note height=10 justify=center color=blue "Blue Sky"; run; proc gslide wframe=4 cframe=red name="red"; note height=20; note height=10 justify=center color=red "Red Wine"; run; proc gslide wframe=4 cframe=gray name="gray";
929
note height=20; note height=10 justify=center color=gray "Gray Mare"; run; quit; goptions goutmode=append; run;
930
931
CHAPTER
34
The GAREABAR Procedure
Overview 931 Concepts 932 Procedure Syntax 933 PROC GAREABAR Statement 933 HBAR, HBAR3D, VBAR, and VBAR3D Statements 934 Examples 937 Example 1: Generating an Area Bar Chart 937 Example 2: Generating an Area Bar Chart with a Numeric Chart Variable 939 Example 3: Generating an Area Bar Chart with Subgroups 941 Example 4: Area Bar Chart with Subgroups; Using the RSTAT= option and the WSTAT= option to Calculate Statistics as Percentages 943
Overview
The GAREABAR procedure produces an area bar chart displaying two statistics for each category of data. In the following chart, for each bar, the width, and the height of each bar represent different values, proportionally. The chart creates one bar for each unique value of the SITE variable. The height of each bar represents the SUM of the sales for that SITE. The width of each bar represents the NUMBER of sales persons generating revenue for that site.
932
Concepts
Chapter 34
Display 34.1
Concepts
The GAREABAR procedure produces a chart based on the values of a chart variable, a width variable, and a sum calculation variable specied by the SUMVAR= option. The chart variable can be either character or numeric. All values of the chart variable are treated as discrete. The chart values are displayed in data order. PROC GAREABAR does not calculate a midpoint. For the VBAR statement, the width variable denes the width of the bar along the horizontal axis. The SUMVAR= variable determines the height of the bar on the vertical axis. For the HBAR statement, the width variable denes the width of each bar on the vertical axis. The SUMVAR= variable determines the length of the bar on the horizontal axis. The WIDTH variable, the SUMVAR= option variable, and the SUBGROUP= option variable can be calculated, and displayed as a percentage of the total or as a sum. The default is sum. Examples using the SUBGROUP option are shown in Examples on page 937 and Example 4 on page 943.
933
Procedure Syntax
Requirements:
3 3 3 3 3 3 3
a GOPTIONS statement with DEV=ACTIVEX or DEV=ACTXIMG an ODS statement to close the listing destination an ODS statement to open the output destination at least one HBAR, HBAR3D, VBAR, or VBAR3D statement a SUMVAR= option an ODS statement to close the output destination an ODS statement to open the listing destination.
FOOTNOTE, GOPTIONS, LEGEND, PATTERN, TITLE Reminder: BY, FORMAT, LABEL, WHERE Supports: Run-group processing, Activex, Actximg
Global statements:
Syntax
PROC GAREABAR< DATA=input-data-set>;
Options
PROC GAREABAR statement options affect all graphs produced by the procedure.
DATA=input-data-set;
species the SAS data set that contains the variable(s) to chart. By default the procedure uses the most recently created SAS data set.
934
Chapter 34
One category variable, one width variable, and the SUMVAR= option FOOTNOTE, GOPTIONS, LEGEND, PATTERN, TITLE
variable.
Global statements:
Description
The HBAR, HBAR3D, VBAR, and VBAR3D statements specify the variables that dene the categories, and width of each bar. The SUMVAR= option variable calculates the length or height of each bar. These statements do the following;
3 3 3 3
calculate the chart statistic for each bar (the default is SUM) scale the response axes and the bars according to the statistic value calculate the width of each bar, based on the value of the width variable draw a frame around the axis area using a color determined by the current style
You can use statement options to change the type of chart, to display specic statistics, and to modify the appearance of the chart. You can also specify an additional variable to subgroup your data, which divides the bars into segments and displays a legend to identify the segments. In addition, you can make the following changes with global statements:
3 use the LEGEND statement to modify the legend 3 use the TITLE and FOOTNOTE statements to add titles and footnotes to the chart 3 use the PATTERN statement to create PATTERN denitions that dene the color
and type of area ll for patterns used in graphs.
Syntax
HBAR | HBAR3D | VBAR | VBAR3D chart-variable*width-variable SUMVAR=numeric-variable</ option(s)>; option(s)can be one or more options from any or all of the following categories:
3 appearance options:
CFRAME=background-color CTEXT=text-color FRAME | NOFRAME LEGEND=LEGEND<1...99> NOLEGEND
3 statistic options:
RESPONSESTAT=statistic WIDTHSTAT=statistic
3 midpoint options:
CONTINUOUS DISCRETE SUBGROUP=subgroup-variable
935
3 description options
DESCRIPTION=description NAME=name
Required Arguments
The options in an HBAR, HBAR3D, VBAR, and VBAR3D statement affect all graphs that are produced by that statement. You can specify as many options as you want, and list them in any order.
category-variable
species the variable that denes the categories of data to chart. The CATEGORY variable can be either character or numeric. Each unique value of the category variable results in a separate bar.
sumvar=variable
species the variable that denes the height of each vertical bar or length of each horizontal bar. The SUMVAR= option variable is always numeric. The default statistic is sum.
width-variable
species the variable that denes the width of each bar. The WIDTH variable is always numeric. The width of each bar represents the sum of the width variable values for that category. The default statistic is sum.
Options
The options in an HBAR, HBAR3D, VBAR, and VBAR3D statement affect all graphs that are produced by the statement. You can specify as many options as you want and list them in any order.
CFRAME=background-color
species a background color for the graph. The specied color must be a valid SAS/GRAPH color name. Alias: CFR= Style reference: Color attribute of GraphBackground element Restriction: Not supported by Java.
CONTINUOUS
species that the graph data be treated as continuous. Continuous data can take any of an innite number of values between whole numbers, and so might not be measured accurately. The default is discrete. Restriction: Not supported by Java.
CTEXT=text-color
species a color for all text on the chart. The GAREABAR procedure looks for the text color in the following order: 1 colors specied for labels and values on assigned LEGEND statements, which override the CTEXT= option specied on the GAREABAR statement 2 the color specied by the CTEXT= option in the GAREABAR statement 3 the color specied by the CTEXT= option in a GOPTIONS statement 4 the color specied in the current style Alias: CT= Style reference: Color attributes of the GraphLabelText and GraphValueText elements
936
Chapter 34
Restriction:
DESCRIPTION=description
species the description of the plot. The maximum length for description is 256 characters. The descriptive text is displayed as follows: 3 the description in the Results window 3 the properties that you view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS HTML statement, assuming the output is generated while the contents page is open 3 the ALT= text in the HTML le when the output destination is ODS HTML 3 customized by inserting BY variable values with #BYLINE, #BYVAL(n), and #BYVAR(n) DES= Default: GAREABAR ofcategory variable Restriction: Not supported by Java.
Alias: DISCRETE
treats the chart variable axis data as discrete data. Discrete data is characterized as data in which the variable can take only one of a nite set of values. The GAREABAR procedure creates a separate bar for each unique value of the chart variable. If the chart variable has a format associated with it, each formatted value is treated as a unique value. The default is discrete. Restriction: Not supported by Java.
FRAME | NOFRAME
species whether the two-dimensional axis area frame or the three-dimensional backplane is drawn. The default is FRAME, which draws a frame around the axis areas (in two-dimensional bar charts) or generates a colored three-dimensional backplane (in three-dimensional bar charts). For three-dimensional charts, NOFRAME removes the backplane color, and leaves the backplane grid, the vertical axis and plane, and the horizontal axis and plane. The NOFRAME option overrides the CFRAME= option. Alias: FR | NOFR Restriction: Not supported by Java.
LEGEND=LEGEND<1...99>
assigns the specied LEGEND denition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend. LEGEND= is ignored if any of the following are true: 3 The SUBGROUP= option is not used. 3 The specied LEGEND denition is not in effect. 3 The NOLEGEND option is used.
Restriction: The LEGEND statement options are partially supported by ActiveX. See also: LEGEND Statement on page 223 Restriction: NAME=name
species the name of the graphics output le. The name can be up to 256 characters long. Uppercase characters are converted to lowercase. The default name is graph.png. If the name duplicates and existing name, then SAS/GRAPH adds a number to the name to create a unique name, for example, graph1.png.
937
suppresses the legend that is automatically generated by the SUBGROUP= option. The NOLEGEND option is ignored if the SUBGROUP= option is not used.
Restriction: Not supported by Java. RESPONSESTAT= SUM |PCT| PERCENT
species the statistic for subgroups. The default is sum. If the SUBGROUP= option is not specied, then the RESPONSESTAT= option is ignored.
Alias:
Restriction:
SUBGROUP=subgroup-variable
divides the bars into segments according to the values of the subgroup-variable. The subgroup-variable can be either character or numeric, and is always treated as a discrete variable. The SUBGROUP= option creates a separate segment within each bar for each unique value of the subgroup variable.
Restriction: Not supported by Java. SUMVAR=summary-variable
species the numeric variable for the sum calculation. The GAREABAR procedure calculates the sum of for each category to determine the length or height of each bar.
Restriction: Not supported by Java. WIDTHSTAT= SUM | PCT | PERCENT
species whether the WIDTH= option statistic is a percent or a sum. The default statistic is sum.
Alias:
Examples
Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
WORK.TOTALS
938
Chapter 34
Figure 34.1
This area bar chart reveals three geographic sites (Lima, NY, Rome) along the horizontal axis. The width of each bar represents the sum of the salespersons assigned to each site. The height of each bar represents the sum of the sales for each site. The chart shows that NY had the greatest sales, as well as the greatest number of sales persons.
939
Run PROC GAREABAR with VBAR statement.The VBAR site statement creates a vertical bar for each value of site. *SALESPERSONS sets the width variable for bars. SUMVAR=SALES sets the height variable for each of the bars.
proc gareabar data=totals; vbar site*salespersons / sumvar=sales; run; quit;
940
Chapter 34
Figure 34.2
This chart displays a numeric chart variable, QUARTER, representing the four quarters of an unspecied year. The GAREABAR procedure treats all values of a numeric chart variables as discrete, unless the CONTINUOUS option is used. GAREABAR does not calculate midpoints. The total sales for each quarter of the year is represented by the height of each bar along the vertical axis. The width of each bar along the horizontal axis indicates the percentage of salespersons during each quarter. The chart shows the correlation between the number of salespersons, and the total sales.
Reset the graphics options. Set device to output ActiveX..
goptions reset=all dev=activex;
941
Run PROC GAREABAR with VBAR statement.The VBAR=SITE option creates a vertical bar for each value of quarter. *SALESPERSONS sets the width of each of the bars. The SUMVAR=SALES option sets the height of each of the bars. WSTAT=PCT option sets the number of salespersons as a percentage of the whole.
proc gareabar data=totals; vbar quarter*salespersons/ sumvar=sales wstat=pct; run; quit;
942
Chapter 34
Figure 34.3
This example uses the SUBGROUP= option to display the same statistics as displayed by Examples 1 and 2. Similar to Example 1, this example shows the total sales for each of the three geographic sites. The relative thickness of each bar represents the number of salespersons at each site. The addition of subgroups to this chart shows the relative percentage of sales for each quarter. This chart demonstrates that all of the sites had most of their sales posted in the fourth quarter.
Reset the graphics options. Set the device to output ActiveX.
goptions reset=all dev=activex;
Example 4: Area Bar Chart with Subgroups; Using the RSTAT= option and the WSTAT= option to Calculate Statistics as Percentages 943
Run PROC GAREABAR with an HBAR statement. The SUMVAR=SALES option sets the length of the bar. The HBAR SITE*SALESPERSONS creates a horizontal bar for each site. SALESPERSONS is represented by the width of each bar. The WSTAT=PERCENT option sets the statistic to percentage to compare the distribution of salespersons for each quarter. The SUBGROUP=QUARTER option and the RSTAT=SUM option are reected in the statistics that are displayed as absolute numbers along the horizontal bar.
proc gareabar data=totals; hbar site*salespersons / sumvar=sales subgroup=quarter wstat=PCT; run; quit;
Example 4: Area Bar Chart with Subgroups; Using the RSTAT= option and the WSTAT= option to Calculate Statistics as Percentages
Procedure features: Data set:
944
Example 4: Area Bar Chart with Subgroups; Using the RSTAT= option and the WSTAT= option to Calculate Statistics as
Percentages
Chapter 34
Figure 34.4
This example uses the RSTAT= option and the WSTAT= option to calculate percentages for the length variable (sumvar) and the width variable (chart variable). The SUBGROUP= option subgroups each bar by quarter. When the SUBGROUP= option is specied, you can use the RSTAT= option to specify whether the SUMVAR= option variable is to be calculated as a percentage or as a sum.
Reset the graphics options. Set the device to output Activex.
goptions reset=all dev=activex;
Example 4: Area Bar Chart with Subgroups; Using the RSTAT= option and the WSTAT= option to Calculate Statistics as Percentages 945
Run PROC GAREABAR with an HBAR statement. Because SITE*SALESPERSONS and WSTAT=PERCENT, the percentage of salespersons is shown by the relative thickness of each bar along the vertical axis. The SUBGROUP=QUARTER option and the RSTAT=PCT option, request that sales for each quarter is displayed as percentages along the horizontal axis.
proc gareabar data=totals; hbar site*salespersons / sumvar=sales subgroup=quarter rstat=PCT wstat=PCT; run; quit;
946
947
CHAPTER
35
The GBARLINE Procedure
Overview 947 About Bar-Line Charts 948 Concepts 949 About the Chart Variable 950 About Midpoints 950 Character Values 950 Discrete Numeric Values 950 Continuous Numeric Values 951 Selecting and Ordering Midpoints 952 About Response Variables 952 About Chart Statistics 953 Frequency 953 Cumulative Frequency 953 Percentage 953 Cumulative Percentage 953 Sum 953 Mean 953 Calculating Weighted Statistics 954 Missing Values 954 Plot Variable Values Out of Range 955 Controlling Patterns, Outlines, Colors, and Images 955 Default Patterns, Symbols, Lines, Colors, and Outlines 955 User-Dened Patterns, Colors, Lines, Symbols, and Outlines 956 Adding Images to Bar-Line Charts 957 Controlling When Bar Patterns Change 957 Controlling Axis Color 957 Procedure Syntax 958 PROC GBARLINE Statement 958 BAR Statement 959 PLOT Statement 975 Examples 982 Example 1: Producing a Basic Bar-Line Chart 982 Example 2: Calculating Weighted Statistics 984 Example 3: Specifying Subgroups, Multiple Plots, Data Tips, and Drill-Down URLs
986
Overview
The GBARLINE procedure produces bar-line charts. Bar-line charts are vertical bar charts with one or more plot overlays. These charts graphically represent the value of a
948
Chapter 35
statistic calculated for one or more variables in an input SAS data set. The charted variables can be either numeric or character. The procedure calculates these statistics: 3 sum 3 mean 3 frequency or cumulative frequency 3 percentage or cumulative percentage. Use the GBARLINE procedure to do the following tasks: 3 display and compare exact and relative magnitudes 3 examine the contribution of parts to the whole 3 analyze where data are out of balance 3 display a long series of data, showing trends and patterns. In conjunction with the SYMBOL statement, the GBARLINE procedure can produce needle plot overlays, and overlay plots with stepped interpolation. Note: PROC GBARLINE is not supported by Java.
Figure 35.1
Bar-Line Chart
Concepts
949
Concepts
The GBARLINE procedure produces a bar chart based on the values of a chart variable and an optional response variable (SUMVAR= option). The computed statistic can be set with the TYPE= option. Each line chart uses the same chart variable and has an optional response variable (SUMVAR= option). A computed statistic can be set with the TYPE= option. Figure 35.2 on page 949 illustrates the parts of a bar-line chart.
Figure 35.2
Bar-line charts have three axes: 3 a midpoint axis that shows the categories of data, based on the chart variable 3 a left response axis that displays the scale of values for the bar statistic (based on the response variable, if specied) 3 a right response axis that displays the scale of values for the line statistic (based on the response variable, if specied) The response axes are divided into evenly spaced intervals identied with major tick marks that are labeled with the corresponding statistic value. Minor tick marks are
950
Chapter 35
evenly distributed between the major tick marks. Each axis is labeled with the variable name or label. The right response axis is scaled to accommodate all the line variable response values when multiple PLOT statements are present.
About Midpoints
Midpoints are the values of the chart variable that identify categories of data. By default, midpoints are selected or calculated by the procedure. The way the procedure handles the midpoints depends on whether the values of the chart variable are character, discrete numeric, or continuous numeric.
Character Values
A character chart variable generates a midpoint for each unique value of the variable. In the following example, the chart variable CITY contains the names of three different cities, and each city is a midpoint, resulting in three midpoints for the chart:
Figure 35.3
Character Midpoints
By default, character midpoints are arranged in alphabetic order. If a character variable has an associated format, then the values are arranged in order of the formatted values.
About Midpoints
951
Figure 35.4
By default, numeric midpoints are arranged in ascending order of the chart variable. If the numeric variable has an associated format, then each formatted value generates a separate midpoint. Formatted numeric variables are arranged in ascending order according to their unformatted numeric values.
Figure 35.5
952
Chapter 35
In this case, values excluded by the option are not included in the calculation of the chart statistic. You can order or select discrete numeric midpoint values just as you do character values, but you omit the quotation marks when specifying numeric values. For continuous numeric variables, use the LEVELS= or MIDPOINTS= option to change the number of midpoints, to control the range of values each midpoint represents, or to change the order of the midpoints. To control the range of values each midpoint represents, use the MIDPOINTS= option to specify the midpoint value of each range. For example, to select the ranges 2029, 3039, and 4049, specify the following values:
midpoints=25 35 45;
Alternatively, to select the number of midpoints that you want and let the procedure calculate the ranges and midpoints, use the LEVELS= option. You can also use formats to control the ranges of continuous numeric variables, but in that case the values are no longer continuous but become discrete. Note: You cannot use the MIDPOINTS= option to exclude continuous numeric values from the chart because values below or above the ranges specied by the option are automatically included in the rst and last midpoints. To exclude continuous numeric values from a chart, use a WHERE statement in a DATA step or the WHERE= data set option. 4 See also the description of the LEVELS= and MIDPOINTS= options.
When you specify a response variable, the only statistics available are SUM or MEAN, with SUM being the default. To change the statistic, you specify the TYPE= option. For example, TYPE=MEAN. If you do not specify a response variable, a summary statistic for the chart variable is computed. By default it is FREQ (frequency). You can use the TYPE= option to indicate another statistic: PERCENT, CFREQ (cumulative frequency) or CPERCENT (cumulative percent). For more information about these statistics, see About Chart Statistics on page 953. See also the descriptions of the SUMVAR= and TYPE= options for the PLOT statement.
953
Frequency
The frequency statistic is the total number of observations in the data set for each midpoint. For example, seven observations of the bar variable, CITY, contain the value Denver, so the frequency for the Denver midpoint is 7.
Cumulative Frequency
The cumulative frequency statistic adds the frequency for the current midpoint to the frequency of all of the preceding midpoints. For example, the frequency for the Denver midpoint is 7, and the frequency for the next midpoint, Seattle, is 9. Therefore, the cumulative frequency for Seattle is 16 and the cumulative frequency for Tokyo is 21.
Percentage
The percentage statistic is calculated by dividing the frequency for each midpoint by the total frequency count for all midpoints in the chart or group and multiplying it by 100. For example, the frequency count for the Denver midpoint is 7 and the total frequency count for the chart is 21, so the percentage statistic for Denver is 33.3%.
Cumulative Percentage
The cumulative percentage statistic adds the percentage for the current midpoint to the percentage for all of the preceding midpoints in the chart or group. For example, the percentage for the Denver midpoint is 33.3, and the percentage for the next midpoint, Seattle, is 42.9, so the cumulative percentage for Seattle is 76.2.
Sum
The sum statistic is the total of the values, for each midpoint, for the variable specied by the SUMVAR= option. For example, if you specify SUMVAR=SALES and the values of the SALES variable for the seven Denver observations are 8734, 982, 1504, 3207, 4502, 624, and 918, the sum statistic for the Denver midpoint is 20,471. You must use the SUMVAR= option to specify the variable for which you want the sum statistic.
Mean
The mean statistic is the average of the values, for each midpoint, for the variable specied by the SUMVAR= option. For example, if TYPE=MEAN and SUMVAR=SALES, the mean statistic for the Denver midpoint is 2924.42.
954
Missing Values
Chapter 35
You must use the SUMVAR= option to specify the variable for which you want the mean statistic.
By default, the percentage and cumulative percentage statistics are calculated based on the frequency. If you want to graph a percentage or cumulative percentage based on a sum, then you can use the FREQ= option to specify a variable to use for the sum calculation and then specify PCT as the statistic, as shown in this example:
freq=count type=pct;
Because the variable that is specied by the FREQ= option determines the number of times an observation is counted, the value of COUNT is the equivalent of the sum statistic. See also the descriptions of the TYPE=, SUMVAR=, and FREQ= options. Note: The FREQ= option is not supported by ActiveX or Java.
Missing Values
By default, the GBARLINE procedure ignores missing midpoint values for the chart variable. If you specify the MISSING option, then missing values are treated as a valid midpoint and are included on the axis. Missing values for the subgroup variables are always treated as valid subgroups. When the value of the variable that is specied in the FREQ= option is missing, zero, or negative, the observation is excluded from the calculation of the chart statistic. When the value of the variable specied in the SUMVAR= option is missing, the observation is excluded from the calculation of the chart statistic.
955
If all of the values for a response variable are missing for the bar chart, a midpoint is drawn, but no bar appears above it. For a line plot, no marker is drawn and the line connects the adjacent markers.
956
Chapter 35
If you use the default style colors and the rst color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, then the procedure uses all the colors in the list to generate the patterns.
3 uses the styles outline color to outline every patterned area. 3 uses the styles default symbol for the initial PLOT statement points, the second
default symbol for the next PLOT statement, the third default symbol for the next PLOT statement, and so on, continuing through the set of symbols belonging to that style until all the PLOT statements have been satised.
3 selects the rst default ll, which is always solid, and rotates it through the color
list, generating one solid pattern for each color. If the rst color in the devices color list is black (or white), the procedure skips that color and begins generating patterns with the next color.
3 uses the foreground color to outline every patterned area. 3 selects the next default pattern ll (if it needs additional patterns), and rotates
that pattern through the color list, skipping the foreground color as before. The procedure continues in this fashion until it has generated enough patterns for the chart.
3 uses the devices default color to outline every patterned area. 3 selects the next color in the list after the last bar color and uses it to draw the rst
PLOT statement symbol and connecting line.
3 rotates through the color list for any subsequent PLOT statements.
If the procedure needs additional patterns, PROC GBARLINE selects the next default pattern ll (empty) and rotates it through the color list, skipping the foreground color as before. The procedure continues in this fashion until it has generated enough patterns for the chart. Changing any of the following conditions might change or override the default behavior:
3 If you specify a color list with the COLORS= option in a GOPTIONS statement
and the list contains more than one color, then the procedure rotates the default solid pattern through that list, using every color, even if the foreground color is black (or white). The default outline color remains the foreground color or the color specied by the current style. For a description of these graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
957
lls are ignored. For a complete description of all bar patterns, see the VALUE= option in the PATTERN statement on page 240. When you use PATTERN statements, the procedure uses the specied patterns until all of the PATTERN denitions they generate have been used. Then, if more patterns are required, the procedure returns to the default pattern rotation. To change the outline color of any pattern, whether the pattern is default or user-dened, use the COUTLINE= option in the BAR statement that generates the chart. (See COUTLINE= on page 963.) To override the default plot colors, symbols and line widths, use the SYMBOL statement. For a complete description of its parameters, see the SYMBOL Statement on page 250. The SYMBOL statements are used in order for each PLOT statement. If there are fewer SYMBOL statements than PLOT statements, default SYMBOL values are used for subsequent plots.
958
Procedure Syntax
Chapter 35
Procedure Syntax
Requirements:
Global statements:
Reminder: The procedure can also include the BY, FORMAT, LABEL, and WHERE statements. Restriction:
PROC GBARLINE <DATA=input-data-set> <ANNOTATE=Annotate-data-set> <IMAGEMAP=output-data-set>; BAR bar-variable </option(s)>; <PLOT </option(s)>;>... <PLOT </option(s)>;>
Syntax
PROC GBARLINE <DATA=input-data-set> <ANNOTATE=Annotate-data-set> <IMAGEMAP=output-data-set>;
Options
PROC GBARLINE statement options affect all graphs produced by the procedure.
ANNOTATE=Annotate-data-set
species a data set to annotate all graphs that are produced by the GBARLINE procedure. To annotate individual graphs, use the ANNOTATE= option in the BAR statement.
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643 DATA=input-data-set
species the SAS data set that contains the variable or variables to chart. By default, the procedure uses the most recently created SAS data set.
See also: SAS Data Sets on page 54 and About the Chart Variable on page 950
BAR Statement
959
IMAGEMAP=output-data-set
creates a temporary SAS data set that is used to generate an image map in an HTML output le. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identied to the GBARLINE procedure with the HTML= option. The %IMAGEMAP macro generates the image map in the HTML output le. The macro takes two arguments, the name of the image map data set and the name or leref of the HTML output le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
BAR Statement
Creates vertical bar charts in which the height of the bars represents the value of the bar statistic for each category of data.
Requirements:
Description
The BAR statement species the variable that denes the categories of data to chart. This statement automatically performs the following operations:
3 3 3 3 3 3
determines the midpoints calculates the chart statistic for each midpoint (the default is FREQ) scales the response axis and the bars according to the statistic value determines bar width and spacing assigns patterns to the bars (the default bar pattern is SOLID) draws a frame around the axis area using the color dened by the current style or the rst color in the color list if the NOGSTYLE system option is specied.
You can use statement options to select or order the midpoints (bars), to control the tick marks on the response axis, to change the type of chart statistic, to display specic statistics, and to modify the appearance of the chart. You can also specify additional variables by which to subgroup or sum the data. Bar charts support subgroups, which subdivide the bars into segments based on the values of a subgroup variable. In addition, you can do the following actions:
3 use global statements to add a legend, modify the axes, and change the bar
patterns. See Chapter 14, SAS/GRAPH Statements, on page 195 for more information.
3 add titles and footnotes to the chart. See TITLE, FOOTNOTE, and NOTE
Statements on page 278 for more information.
3 use an Annotate data set to enhance the chart. See Chapter 29, Using Annotate
Data Sets, on page 643 for more information.
960
BAR Statement
Chapter 35
3 display an image in the background of the chart. See IBACK on page 388 for
more information. 3 display images in the bars of the chart. See the IMAGE= option on page 239 for the PATTERN statement.
Syntax
BARchart-variable </option(s)>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ANNOTATE=Annotate-data-set CAUTOREF=reference-line-color CAXIS=axis-color CERROR=error-bar-color CFRAME=background-color COUTLINE=bar-outline-color | SAME CREF=reference-line-color|(reference-line-color)|reference-line-color-list CTEXT=text-color FRAME | NOFRAME LAUTOREF=reference-line-type LEGEND=LEGEND<1...99> LREF=reference-line-type|(reference-line-type)|reference-line-type-list NOLEGEND PATTERNID=BY|MIDPOINT SPACE=bar-spacing WAUTOREF=reference-line-width WIDTH=bar-width WOUTLINE=bar-outline-width WREF=reference-line-width|(reference-line-width)|reference-line-width-list 3 statistic options CFREQ CLM=condence-level CPERCENT ERRORBAR=BARS | BOTH | TOP FREQ FREQ=numeric-variable INSIDE=statistic MEAN OUTSIDE=statistic PERCENT SUM SUMVAR=summary-variable TYPE=statistic 3 midpoint options DISCRETE LEVELS=number-of-midpoints
BAR Statement
961
3 axes options
ASCENDING AUTOREF AXIS=AXIS<1...99> CLIPREF DESCENDING MAXIS=AXIS<1...99> MINOR=number-of-minor-ticks NOAXIS NOBASEREF NOZERO RANGE RAXIS=value-list | AXIS<1...99> REF=value-list
3 ODS options
HTML=variable HTML_LEGEND=variable
Required Arguments
chart-variable
species the variable that denes the categories of data to chart. The variable must be in the input data set.
See also: About the Chart Variable on page 950
Options
Options in the BAR statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order. For details on specifying colors, see Chapter 12, SAS/GRAPH Colors and Images, on page 165. For details on specifying images, see Specifying Images in SAS/GRAPH Programs on page 179. For a complete description of the graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
ANNOTATE=Annotate-data-set
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643
962
BAR Statement
Chapter 35
ASCENDING
arranges the bars in ascending order of the value of the bar statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. ASCENDING reorders the bars from shortest to longest. The ordering is left to right. ASCENDING overrides any midpoint order specied in the MIDPOINTS= option or specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
AUTOREF
draws a reference line at each major tick mark on the bar (left) response axis. To draw reference lines at specic points on the response axis, use the REF= option. By default, reference lines are drawn in front of the bars. To draw reference lines behind the bars, use the CLIPREF option.
AXIS=AXIS<1...99>
species the color of reference lines drawn at major tick marks, as determined by the AUTOREF option. If you do not specify the CAUTOREF option, the default color is the value of the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the devices color list if the NOGSTYLE system option is specied. To specify a line type for these reference lines, use the LAUTOREF= option.
Style reference: Color attribute of the GraphGridLines element. CAXIS=axis-color
species a color for the response and midpoint axis lines and for the default axis area frame. If you omit the CAXIS option, the default color is dened by the current style or is the rst color in the color list if the NOGSTYLE option is specied.
Style reference: Color attribute of the GraphAxisLines element. CERROR=error-bar-color
species the color of error bars. The default color is the color of the response axis, which is controlled by the CAXIS= option.
Style reference: Color attribute of the GraphError element. CFRAME=background-color
species the color with which to ll the axis area. The axis area color does not affect the frame color, which is always the same as the midpoint axis line color and controlled by the CAXIS= option. By default, the axis area is not lled. The CFRAME= option is overridden by the NOFRAME option. Note: If the background color, the bar color, and the outline color are the same, then you cannot distinguish the bars. If the specied style contains an embedded image, the image is drawn instead of the specied CFRAME color. 4
Style reference: Color attribute of the GraphWalls element. CFREQ
displays the cumulative frequency statistic above the bars. A maximum of two statistics can be printed if the INSIDE= option is also used. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ option is specied.
See also: About Chart Statistics on page 953 and Displaying Statistics In
BAR Statement
963
CLIPREF
clips the reference lines at the bars. Using this option makes the reference lines appear to be behind the bars.
CLM=condence-level
species the condence intervals to use when drawing error bars. Values for condence-level must be greater than or equal to 50 and strictly less than 100. The default is 95. See ERRORBAR= for details on how error bars are computed and drawn.
COUTLINE=bar-outline-color | SAME
outlines all bars or bar segments and legend values in the subgroup legend (if it appears) using the specied color. SAME species that the outline color of a bar or a bar segment or a legend value is the same as the interior pattern color. The default outline color depends in the PATTERN statement:
3 If you do not specify a PATTERN statement, the default outline color is the
color of the current style.
3 If you specify the NOGSTYLE system option and no PATTERN statement, the
default outline color is black for the ActiveX device. Otherwise, the default outline color is the foreground color. If you specify an empty PATTERN statement, then the default outline color is the same as the ll color.
Style reference: Color attribute of the GraphOutlines element. See also: Controlling Patterns, Outlines, Colors, and Images on page 955 CPERCENT CPCT
displays the cumulative percentage statistic above the bars. A maximum of two statistics can be printed using the INSIDE= option for the second statistic. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, or PERCENT option is specied.
See also: About Chart Statistics on page 953 and Displaying Statistics In
species colors for reference lines. Specifying a single color without parentheses applies that color to all reference lines, including lines drawn with the AUTOREF and REF= options. The CAUTOREF= option overrides the CREF= reference line color for reference lines drawn with the AUTOREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the REF= option. Specifying a reference color list applies colors in sequence to successive lines drawn with the REF= option. The syntax of the color list is of the form (color1 color2 ...colorN) or (color1, color2 ..., colorN). If you do not specify the CREF= option, the GBARLINE procedure uses the color specied by the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE system option is specied. To specify line types for these reference lines, use the LREF= option.
Style reference: LineStyle attribute of the GraphGridLines element. CTEXT=text-color
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GBARLINE procedure looks for the text color in the following order:
1 colors specied for labels and values on assigned AXIS and LEGEND
statements, which override the CTEXT= option specied in the BAR statement
2 the color specied by the CTEXT= option in the BAR statement
964
BAR Statement
Chapter 35
3 the color specied by the CTEXT= option in a GOPTIONS statement. 4 the color specied in the current style or, if the NOGSTYLE system option is
specied, black for the ActiveX device and the rst color in the color list for all other devices. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, then the CTEXT= color overrides the AXIS statements COLOR= specication, and the CTEXT= color is used for axis labels and values. The AXIS statements COLOR= color is still used for all other axis elements, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference: GraphLabelText, GraphValueText DESCENDING
arranges the bars in descending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. DESCENDING reorders the bars from longest to shortest. The ordering is left to right. DESCENDING overrides any midpoint order that is specied with the MIDPOINTS= option or that is specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
DESCRIPTION=entry-description
species the description of the catalog entry for the chart. The maximum length for the entry-description is 256 characters. The description does not appear on the chart. By default, the GBARLINE procedure assigns a description of the form BAR CHART OF variable, where variable is the name of the chart variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. Refer to Substituting BY Line Values in a Text String on page 293. The 256-character limit rule is applied before the substitution takes place for these options. Thus, if, in the SAS program, the entry-description text exceeds 256 characters, it is truncated to 256 characters rst, and then the substitution is performed. The descriptive text is shown in each of the following:
3 the description portion of the Results window 3 the catalog entry properties that you can view from the Explorer window 3 the Description eld of the PROC GREPLAY window 3 the data tip text for web output (depending on the device driver you are using).
DISCRETE
treats a numeric chart variable as a discrete variable rather than as a continuous variable. The GBARLINE procedure creates a separate midpoint and, hence, a separate bar for each unique value of the chart variable. If the chart variable has a format associated with it, then each formatted value is treated as a midpoint. The LEVELS= option is ignored when you use DISCRETE. The MIDPOINTS= option overrides DISCRETE. The ORDER= option in an AXIS statement that is assigned to the midpoint axis can rearrange or exclude discrete midpoint values.
BAR Statement
965
3 the mean of the SUMVAR= variable for each midpoint if you specify
TYPE=MEAN
Let LEVEL be the condence level specied using the CLM= option, with a default value of 95. The upper condence limit for the percentage is computed as follows:
UCLP = PCT + APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 );
When you use ERRORBAR= with TYPE=MEAN, the sum variable must have at least two non-missing values for each midpoint. Let N be the number of observations assigned to a midpoint, MEAN be the mean of those observations, and STD be the standard deviation of the observations. The standard error of the mean is computed as follows:
STDERR = STD / SQRT(N);
Let LEVEL be the condence level specied using the CLM= option, with a default value of 95. The upper condence limit for the mean is computed as follows:
UCLM = MEAN + STDERR * TINV( 1-(1-LEVEL/100)/2, N-1);
966
BAR Statement
Chapter 35
If you want the error bars to represent a given number, C, of standard errors instead of a condence interval, and if the number of observations assigned to each midpoint is the same, then you can nd the appropriate value for the CLM= option by running a DATA step. For example, if you want error bars that represent one standard error (C=1) with a sample size of N, then you can run the following DATA step to compute the appropriate value for the CLM= option and assign that value to a macro variable &LEVEL:
data null; c = 1; n = 10; level = 100 * (1 - 2 * (1 - probt( c, n-1))); put all; call symput("level",put(level,best12.)); run;
Then, when you run the GBARLINE procedure, you can specify CLM=&LEVEL. Note that this method does not work precisely if different midpoints have different numbers of observations. However, choosing an average value for N can yield sufciently accurate results for graphical purposes if the sample sizes are large or do not vary much.
FRAME | NOFRAME
species whether the axis area frame is drawn. The default is FRAME, which draws a frame around the axis area. Specifying NOFRAME removes the axis area frame, including any background color or image. To remove one or more axis elements, use either the AXIS statement or the NOAXIS option. The NOFRAME option overrides the CFRAME= option and the IBACK= graphics option. The color of the frame or backplane outline is the color of the midpoint axis, which is determined by the CAXIS= option.
FREQ
displays the frequency statistic above the bars. Non-integer values are rounded down to the nearest integer. A maximum of two statistics can be printed using the INSIDE= option for the second. This option is ignored if the bars are too narrow to avoid overlapping values. This option overrides the CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.
See also: About Chart Statistics on page 953 and Displaying Statistics In
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times that is specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, zero, or negative, then the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The FREQ= option is valid with all chart statistics. Because you cannot use TYPE=PERCENT, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. The statistics are affected by applying a format to numeric-variable.
Restriction:
BAR Statement
967
HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS statement. These links are associated with the bars and point to the data or graph you want to display when the user drills down on the bar.
Featured in:
See also: Data Tips for Web Presentations on page 600 and Adding Links with
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.
Restriction: Not supported by ActiveX See also: Data Tips for Web Presentations on page 600 and Adding Links with
displays the values of the specied statistic inside the bars. Statistic can be one of the following:
3 3 3 3 3 3
To display statistics with INSIDE=SUM or INSIDE=MEAN, you must also specify the SUMVAR= option.
See also: About Chart Statistics on page 953 and Displaying Statistics In
species the line type for reference lines at major tick marks, as determined by the AUTOREF option. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE system option is specied, the default value is 1, which draws a solid line. To specify a color for these reference lines, use the CAUTOREF= option.
Style reference: LineStyle attribute of the GraphGridLines element. LEGEND=LEGEND<1...99>
Assigns the specied LEGEND denition to the plot part of the graph. LEGEND= is ignored if the specied LEGEND denition is not in effect. When you specify the LEGEND option, the BAR statement generates a legend even if the SUBGROUP= option is not specied. This output differs from the output generated by the GCHART procedure where the SUBGROUP option creates a legend by default. In this case, only one bar is represented in the legend. To create a legend based on the chart midpoints instead of the subgroups, use the chart variable as the subgroup variable:
bar city / subgroup=city;
968
BAR Statement
Chapter 35
You can specify both a BAR and PLOT legend on the same graph. If LEGEND= is specied for both the BAR and the POSITION= options on the LEGEND statements are the same location, a single combined legend will be drawn. However, ActiveX output will display separate but adjacent legends. The ActiveX device does not support all LEGEND statement options. See LEGEND Statement on page 223 for more information.
Featured in: See also:
LEVELS=number-of-midpoints | ALL
species the number of midpoints for the numeric chart variable. The range for each midpoint is calculated automatically using the algorithm described in Terrell and Scott (1985). If your data contains a large number of unique midpoint values (over 200), then you can use the XPIXELS and YPIXELS GOPTIONS to allow the device driver to render a larger (and more readable) graph. The LEVELS= option is ignored if any of these statements are true:
3 The chart variable is character type. 3 The DISCRETE option is used. 3 The MIDPOINTS= option is used.
LREF=reference-line-type|( reference-line-type|reference-line-type-list)
species line types for reference lines. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. Specifying a line type without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the LAUTOREF= option overrides LREF=reference-line-type for reference lines drawn with the AUTOREF option. Specifying a single line type in parentheses applies that line type to the rst reference line drawn with the REF= option. Specifying a line type list applies line types in sequence to successive reference lines drawn with the REF= option. The syntax of the line-type list is of the form (type1 type2 ...typeN). If you do not specify the LREF= option, the GBARLINE procedure uses the type specied by the AXIS statements STYLE= option. If neither option is specied, the default line type is retrieved from the current style. If the NOGSTYLE system option is specied, the default value is 1, which draws a solid line. To specify colors for these reference lines, use the CREF= option.
Style reference: GraphReference MAXIS=AXIS<1...99>
assigns the specied AXIS denition to the midpoint axis. The MAXIS= option is ignored if the specied AXIS denition does not exist.
See also: AXIS Statement on page 196 and About Midpoints on page 950 MEAN
displays the mean statistic above the bars. A maximum of two statistics can be printed using the INSIDE= option for the second. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, CPERCENT, or SUM option is specied. MEAN is ignored unless you also use the SUMVAR= option.
See also: About Chart Statistics on page 953 and Displaying Statistics In
species the midpoint values for the bars. The way you specify value-list depends on the type of the bar variable.
BAR Statement
969
generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric.
MINOR=number-of-minor-ticks
species the number of minor tick marks between each major tick mark on the bar response axis. The MINOR= option in a bar chart statement overrides the MINOR= option in an AXIS denition assigned to the response axis with the RAXIS= option.
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with missing values are ignored.
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to
970
BAR Statement
Chapter 35
lowercase, and periods are converted to underscores. The default name is gbarline. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, gbarline1.
NOAXIS
suppresses the left BAR response axis and displays the midpoint and right PLOT axes. The axis lines, axis labels, axis values, and all major and minor tick marks are suppressed on the left axis. If you specify an axis denition with the MAXIS= or RAXIS= options, then the axes are generated as dened in the AXIS statement, but all lines, labels, values, and tick marks are suppressed. Therefore, AXIS statement options such as ORDER=, LENGTH=, and OFFSET= are used. To remove only selected axis elements such as lines, values, or labels, use specic AXIS statement option. If NOAXIS is specied for both the BAR and PLOT statements, both response axes and the midpoint axis are suppressed. NOAXIS does not suppress either the default frame or an axis area ll requested by the CFRAME= option. To remove the axis frame, use the NOFRAME option in the procedure.
NOBASEREF
suppresses the zero reference line when the SUM or MEAN bar statistic has negative values.
NOLEGEND
suppresses any midpoints for which there are no corresponding values of the chart variable and, hence, no bar. Note: If you assign bar label names to each bar with the VALUE= option in an AXIS statement, and a bar is omitted from your graph, then the label names might be inadvertantly shifted and assigned to the wrong bar. 4
BAR Statement
971
OUTSIDE=statistic
displays the values of the specied statistic above the bars. Statistic can be one of the following:
3 3 3 3 3 3
To display statistics with OUTSIDE=SUM or OUTSIDE=MEAN, you must also specify the SUMVAR= option. A second statistic can be displayed by also using the INSIDE= option.
See also: About Chart Statistics on page 953 and Displaying Statistics In
species the way ll patterns are assigned. By default, all of the bars are the same color. Values for PATTERNID= are as follows: BY changes patterns each time the value of the BY variable changes. All bars use the same pattern if the GBARLINE procedure does not include a BY statement. MIDPOINT changes patterns every time the midpoint value changes. SUBGROUP changes patterns every time the value of the subgroup variable changes. The bars must be subdivided by the SUBGROUP= option for the SUBGROUP value to have an effect. Without the SUBGROUP= option, all bars have the same pattern.
PERCENT
displays the percentages of observations having a given value for the bar variable above the bars. A maximum of two statistics can be printed using the INSIDE= option for the second. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ or CFREQ option is specied.
See also: About Chart Statistics on page 953 and Displaying Statistics In
displays on the axis of the chart the range of numeric values represented by each bar. In the graphics output, the less-than symbol (<) and the less-than-or-equal-to symbol (<=) are used to accurately specify the starting and ending values of each range. The RANGE option has no affect on axes that represent character data. By default, the values shown on the axis are determined by the value of the MIDPOINTS= option on page 968. If specied, the DISCRETE option overrides the RANGE option.
RAXIS=value-list | AXIS<1...99> AXIS=value-list | AXIS<1...99>
species values for the major tick mark divisions on the response axis or assigns the specied AXIS denition to the axis. See the MIDPOINTS= option on page 968 for a description of value-list. By default, the GBARLINE procedure scales the response axis automatically and provides an appropriate number of tick marks. The left response axis applies to the BAR statement when a PLOT statement is used. Otherwise, both the left and right axes apply to the BAR statement.
972
BAR Statement
Chapter 35
You can specify negative values, but negative values are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums or means are less than zero. Frequency and percentage values are never less than zero. For lists of values, a separate major tick mark is created for each individual value. A warning message is written to the SAS log if the values are not evenly spaced. If the values represented by the bars are larger than the highest tick mark value, then the bars are truncated at the highest tick mark. See also: AXIS Statement on page 196
REF=value-list
draws reference lines at the specied points on the chart response axis. See the MIDPOINTS= option on page 968 for a description of value-list. Values can be listed in any order, but should be within the range of values represented by the chart response axis. A warning is written to the SAS log if any of the points are off of the axis, and no reference line is drawn for such points. You can use the AUTOREF option to draw reference lines automatically at all of the major tick marks.
SPACE=bar-spacing
species the amount of space between individual bars along the midpoint axis. Bar-spacing can be any non-negative number, including decimal values. Units are character cells. By default, the GBARLINE procedure calculates spacing based on the size of the axis area and the number of bars on the chart. Use SPACE=0 to leave no space between adjacent bars. The SPACE= option is ignored if its value results in a chart that is too large to t in the space available for the midpoint axis. As a result, a warning message is issued in the log.
SUBGROUP=subgroup-variable
divides the bars into segments according to the values of subgroup-variable. Subgroup-variable can be either character or numeric and is always treated as a discrete variable. SUBGROUP= creates a separate segment within each bar for every unique value of the subgroup variable for that midpoint. When you specify the LEGEND option, the BAR statement generates a legend even if the SUBGROUP= option is not specied. This output differs from the output generated by the GCHART procedure where the SUBGROUP option automatically creates a legend by default. In this case, only one bar is represented in the legend. To assign a LEGEND denition, use the LEGEND= option. Featured in: Example 3 on page 986 See also: LEGEND Statement on page 223
SUM
displays the sum statistic above the bars. A maximum of two statistics can be printed using the INSIDE= option for the second. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, or CPERCENT option is specied. SUM is ignored unless you also use the SUMVAR= option. See also: About Chart Statistics on page 953 and Displaying Statistics In Bar-Line Charts on page 974
SUMVAR=summary-variable
species a numeric variable for sum or mean calculations. The GBARLINE procedure calculates the sum or, if requested, the mean of summary-variable for each midpoint. The resulting statistics are represented by the length of the bars along the response axis, and they are displayed at major tick marks. When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With the SUMVAR= option, the default is TYPE=SUM.
BAR Statement
973
species the chart statistic. 3 If the SUMVAR= option is not used, statistic can be one of the following: FREQ frequency (default) CFREQ cumulative frequency PERCENT percentage CPERCENT cumulative percentage 3 If the SUMVAR= option is used, statistic can be: SUM sum (default) MEAN mean Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT, or TYPE=CPERCENT with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 954. See also: About Chart Statistics on page 953 for a complete description of statistic types
WAUTOREF=reference-line-width
species the line width for reference lines at major tick marks, as determined by the AUTOREF option. Line widths are specied as whole numbers. The default line width is specied by the current style or by the AXIS statements WIDTH= option. (By default, WIDTH=1.) To specify a color for these reference lines, use the CAUTOREF= option.
WIDTH=bar-width
species the width of the bars. By default, the GBARLINE procedure selects a bar width that accommodates the midpoint values displayed on the midpoint axis using a hardware font and a height of one cell. Units for bar-width are character cells. The value for bar-width must be greater than zero, but it does not have to be an integer, for example:
bar site / width=1.5;
If the requested bar width results in a chart that is too large to t in the space available for the midpoint axis, then the procedure issues a warning in the SAS log and ignores the WIDTH= specication. If the specied width is too narrow, the procedure might display the midpoint values vertically.
WOUTLINE=bar-outline-width
species the width of the bar outline in pixels. WOUTLINE= affects both the slice and the subgroup outlines. Style reference: LineThickness attribute of the GraphOutlines element.
WREF=reference-line-width|( reference-line-width|reference-line-width-list)
species line widths for reference lines. Line widths are specied as whole numbers. Specifying a line width without parentheses applies that type to all reference lines
974
BAR Statement
Chapter 35
drawn with the AUTOREF and REF= options. Note that the WAUTOREF= option overrides WREF=reference-line-width for reference lines drawn with the AUTOREF option. Specifying a single line width in parentheses applies that line width to the rst reference line drawn with the REF= option. Specifying a line width list applies line widths in sequence to successive reference lines drawn with the REF= option. The syntax of the line-width list is of the form (width1 width2 ...widthN). The default line width is specied by the current style or by the AXIS statements WIDTH= option. (By default, WIDTH=1.) To specify colors for these reference lines, use the CREF= option. Style reference: LineThickness attribute of the GraphReference element.
PLOT Statement
975
PLOT Statement
Creates one or more plot overlays on top of the bar-line chart.
Requirements:
If specied, PLOT statements must be specied after the BAR statement. AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, TITLE
Description
The PLOT statement species one plot request. You can use multiple PLOT statements to generate multiple plots. The PLOT statement automatically
3 scales the plot response (right) axis to include the maximum and minimum data
values
3 plots data points within the axis and connects them from left to right 3 labels the plot response axis and displays each major tick mark value.
You can use statement options to specify a plot variable, manipulate the plot response axis, modify the appearance of your graph, and describe catalog entries. You can use SYMBOL denitions to modify plot symbols for the data points, suppress the joining of data points, or specify other types of interpolations. For more information on the SYMBOL statement, see SYMBOL Statement on page 250. In addition, you can use global statements to add a legend, modify the axis, or add titles, footnotes, and notes to the plot.
Syntax
PLOT </options(s)>; PLOT statements are optional, but if specied, they must follow the BAR statement. If you do not specify any PLOT statements, GBARLINE generates only a bar chart and duplicates the chart response axis (left axis) as the right response axis. To specify a variable to plot, use the SUMVAR= option. If you do not specify a plot variable, GBARLINE uses the chart variable as the plot variable. For more information, see About Response Variables on page 952 and the description of the SUMVAR= option.
976
PLOT Statement
Chapter 35
Option(s) can be one or more options from any or all of the following categories:
3 appearance options:
ANNOTATE=Annotate-data-set ASCENDING CAUTOREF=reference-line-color CAXIS=axis-color CREF=reference-line-color|(reference-line-color)|reference-line-color-list CTEXT=text-color DESCENDING LAUTOREF=reference-line-type LEGEND=LEGEND<1...99> LREF=reference-line-type|(reference-line-type)|reference-line-type-list NOLINE NOMARKER WAUTOREF=reference-line-width WREF=reference-line-width|(reference-line-width)|reference-line-width-list
3 statistic options:
CFREQ CPERCENT FREQ FREQ=numeric-variable MEAN PERCENT SUM SUMVAR=plot-variable TYPE=statistic
3 axes options:
AUTOREF AXIS=AXIS<1...99> CLIPREF MINOR=number-of-minor-ticks NOAXIS RAXIS=value-list | AXIS<1...99> REF=value-list
3 ODS options:
HTML=variable HTML_LEGEND=variable
Options
You can specify as many options as you want and list them in any order.
ASCENDING
joins the plot points in ascending order of the value of the plot statistic. By default, plot points are connected from left to right.
PLOT Statement
977
AUTOREF
draws a reference line at each major tick mark on the plot (right) response axis. To draw reference lines at specic points on the response axis, use the REF= option. By default, reference lines are drawn in front of the bars. To draw reference lines behind the bars, use the CLIPREF option.
AXIS=AXIS<1...99>
species the color of reference lines drawn at major tick marks, as determined by the AUTOREF option. If you do not specify the CAUTOREF option, the default color is the value of the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the devices color list if the NOGSTYLE system option is specied. To specify a line type for these reference lines, use the LAUTOREF= option. Style reference: Color attribute of the GraphGridLines element.
CAXIS=axis-color
species a color for the tick marks and for the axis area frame on the plot (right) response axis. If you omit the CAXIS option, the default color is the color dened by the default style or is the rst color in the color list.
CLIPREF
clips the reference lines at the bars. Using this option makes the reference lines appear to be behind the bars.
CREF=reference-line-color|(reference-line-color)|reference-line-color-list
species colors for reference lines. Specifying a single color without parentheses applies that color to all reference lines, including lines drawn with the AUTOREF and REF= options. The CAUTOREF= option overrides the CREF= reference line color for reference lines drawn with the AUTOREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the REF= option. Specifying a reference color list applies colors in sequence to successive lines drawn with the REF= option. The syntax of the color list is of the form (color1 color2 ...colorN) or (color1, color2 ..., colorN). If you do not specify the CREF= option, the GBARLINE procedure uses the color specied by the CAXIS= option. If neither option is specied, then the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE option is specied. To specify line types for these reference lines, use the LREF= option. Alias: CRF= Style reference: LineStyle attribute of the GraphGridLines element.
CTEXT=text-color
species a color for all text on the plot response axis and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GBARLINE procedure looks for the text color in the following order: 1 colors specied for labels and values on assigned AXIS and LEGEND statements, which override the CTEXT= option specied in the PLOT statement 2 the color specied by the CTEXT= option in the PLOT statement 3 the color specied by the CTEXT= option in a GOPTIONS statement. 4 the color specied in the current style or, if the NOGSTYLE system option is specied, then the default color is black for the ActiveX device and the rst color in the color list for all other devices. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels.
978
PLOT Statement
Chapter 35
The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, then the CTEXT= color overrides the AXIS statements COLOR= specication, and the CTEXT= color is used for axis labels and values. The COLOR= color is still used for all other axis elements, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference: GraphLabelText, GraphValueText DESCENDING
joins the plot points in descending order of the value of the plot statistic. By default, plot points are connected from left to right.
FREQ=numeric-variable
species a variable whose values weight the contribution of each observation in the computation of the plot statistic. Each observation is counted the number of times that is specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, zero, or negative, then the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The FREQ= option is valid with all plot statistics. Because you cannot use TYPE=PERCENT, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. The statistics are not affected by applying a format to numeric-variable.
Restriction: Not supported by ActiveX HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS statement. These links are associated with the plot points and bars. The links point to the data or graph that you want to display when the user drills down on the plot point or bar area. This option is featured in Example 3 on page 986.
See also: Data Tips for Web Presentations on page 600 and Adding Links with
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.
Restriction: Not supported by Java and ActiveX See also: Data Tips for Web Presentations on page 600 and Adding Links with
species the line type for reference lines at major tick marks, as determined by the AUTOREF option. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify a color for these reference lines, use the CAUTOREF= option.
PLOT Statement
979
LEGEND=LEGEND<1...99>
Generates a legend and assigns the specied LEGEND denition to the legend. LEGEND= is ignored if the specied LEGEND denition is not in effect. When you specify the LEGEND option, the BAR statement generates a legend even if the SUBGROUP= option is not specied. This output differs from the output generated by the GCHART procedure where the SUBGROUP option automatically creates a legend by default. In this case, only one bar is represented in the legend. Only one PLOT statement can contain a LEGEND= reference. If you request a PLOT legend, then all of the PLOT lines are displayed in the legend. You can specify both a BAR and PLOT legend on the same graph. If LEGEND= is specied for both the BAR and the POSITION= options on the LEGEND statements are the same location, a single combined legend will be drawn. However, ActiveX output will display separate but adjacent legends. The ActiveX device does not support all LEGEND statement options. See LEGEND Statement on page 223 for more information. Featured in: Example 3 on page 986 Restriction: Not supported by Java. Partially supported by ActiveX. See also: LEGEND Statement on page 223
LREF=reference-line-type|( reference-line-type|reference-line-type-list)
species line types for reference lines. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. Specifying a line type without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the LAUTOREF= option overrides LREF=reference-line-type for reference lines drawn with the AUTOREF option. Specifying a single line type in parentheses applies that line type to the rst reference line drawn with the REF= option. Specifying a line type list applies line types in sequence to successive reference lines drawn with the REF= option. The syntax of the line-type list is of the form (type1 type2 ...typeN). If you do not specify the LREF= option, the GBARLINE procedure uses the type specied by the AXIS statements STYLE= option. If neither option is specied, the default line type is retrieved from the current style. If the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify colors for these reference lines, use the CREF= option. Alias: LR= Style reference: GraphReference Restriction: Not supported by Java
MINOR=number-of-minor-ticks
species the number of minor tick marks that are drawn between each major tick mark on the PLOT response axis. Minor tick marks are not labeled. The MINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS denition. You must specify a positive number.
NOAXIS
suppresses the right PLOT response axis and displays the midpoint and left BAR axes. The axis lines, axis labels, axis values, and all major and minor tick marks are suppressed on the right axis. If you specify an axis denition with the MAXIS= or RAXIS= options, then the axes are generated as dened in the AXIS statement, but all lines, labels, values, and tick marks are suppressed. Therefore, AXIS statement options such as ORDER=, LENGTH=, and OFFSET= are still used. To remove only selected axis elements such as lines, values, or labels, use specic AXIS statement options. NOAXIS does not suppress either the default frame or an axis area ll requested by the CFRAME= option. To remove the axis frame, use the NOFRAME option in the procedure.
980
PLOT Statement
Chapter 35
NOLINE
suppresses the line connecting the PLOT symbols, regardless of what is specied in the SYMBOL statement.
NOMARKER
suppresses drawing the marker symbol, regardless of what is specied in the SYMBOL statement.
RAXIS=value-list | AXIS<1...99> AXIS=value-list | AXIS<1...99>
species the major tick mark values for the PLOT (right) response axis or assigns an AXIS denition. The way you specify value-list depends on the type of variable:
3 For date-time values, value-list includes any SAS date, time, or datetime value
described for the SAS functions INTCK and INTNX, shown here as SAS-value: SAS-valuei < ...SAS-valuei> SAS-valuei TO SAS-valuei<BY interval> Any response values that exceed the highest tick mark value are not plotted. The overlay plot line connects only the visible plot response values.
REF=value-list
draws reference lines at the specied points using the chart response axis. See the MIDPOINTS= option on page 968 for a description of value-list. Values can be listed in any order, but should be within the range of values represented by the PLOT response axis. A warning is written to the SAS log if any of the points are off of the axis, and no reference line is drawn for such points. You can use the AUTOREF option to draw reference lines automatically at all of the major tick marks.
SUMVAR=plot-variable
species the variable to plot. Plot-variable, if specied, must be numeric. The GBARLINE procedure calculates the sum or, if requested, the mean of plot-variable for each midpoint. When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With the SUMVAR= option, the default is TYPE=SUM.
Featured in:
3 If the SUMVAR= option is not used, statistic can be one of the following:
FREQ frequency ( default) CFREQ cumulative frequency
PLOT Statement
981
species the line width for reference lines at major tick marks, as determined by the AUTOREF option. Line widths are specied as whole numbers. The default line width is specied by the current style or by the AXIS statements WIDTH= option. (By default, WIDTH=1.) To specify a color for these reference lines, use the CAUTOREF= option.
Style reference: LineThickness attribute of the GraphGridLines element. WREF=reference-line-width|( reference-line-width|reference-line-width-list)
species line widths for reference lines. Line widths are specied as whole numbers. Specifying a line width without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the WAUTOREF= option overrides WREF=reference-line-width for reference lines drawn with the AUTOREF option. Specifying a single line width in parentheses applies that line width to the rst reference line drawn with the REF= option. Specifying a line width list applies line widths in sequence to successive reference lines drawn with the REF= option. The syntax of the line-width list is of the form (width1 width2 ...widthN). The default line width is specied by the current style or by the AXIS statements WIDTH= option. (By default, WIDTH=1.) To specify colors for these reference lines, use the CREF= option.
Style reference: LineThickness attribute of the GraphReference element.
3 3 3 3
the shape, size, and color of the plot symbols that mark the data points the plot line style, color, and width an interpolation method (either JOIN, NEEDLE, STEP, or NONE) for plotting data how missing values are treated in interpolation calculations
SYMBOL denitions are assigned either by default by the GBARLINE procedure or explicitly with a plot request. If no SYMBOL denition is currently in effect, the GBARLINE procedure produces a join interpolation using the default plot symbol. For multiple PLOT statements where no SYMBOL statements were specied, the procedure rotates through the default symbols for the current device.
982
Examples
Chapter 35
See SYMBOL Statement on page 250 for a complete discussion of the features of the SYMBOL statement.
Examples
This example produces a basic bar-line chart showing the volume and closing price for each of ve days of trading activity on the New York Stock Exchange. The vertical
983
bars indicate the volume using the left (chart) response axis, and the line plot shows the closing price. This graph uses the statistical style.
Set the graphics environment. Some graphics options might override style attributes, so if you are using a style, specify the minimum graphic options needed by your graph.
goptions reset=all border;
Create the data set NYSE. NYSE contains one observation for each of ve workdays. Each observation includes the date, closing price, and volume.
data nyse; format Day date7.; format High Low Close comma12.; format Volume comma12.; input Day date7. High Low Close Volume; datalines; 01AUG07 10478.76 02AUG07 11042.92 05AUG07 10498.22 06AUG07 10694.47 07AUG07 10801.12 run;
Produce the bar-line chart. The SUMVAR= option in the BAR statement species the variable whose values determine the height of the bars. The SUMVAR= option in the PLOT statement species the variable whose values are used to calculate the overlay plot.
proc gbarline data=nyse; bar day / discrete sumvar=volume space=4; plot / sumvar=close; run; quit;
984
Chapter 35
BAR statement options: AXIS= SUMVAR= PLOT statement options: AXIS= FREQ= SUMVAR=
Other Features:
AXIS statement
This example uses the FREQ= option to calculate weighted statistics for the line plot. During the manufacture of a metal-oxide semiconductor (MOS) capacitor, various defects and their frequencies were recorded.
Set the graphics environment.
goptions reset=all border;
Create the data set FAILURE. Each observation of the FAILURE data set contains the type of manufacturing defect, a count of how many times it occurred, and a cost associated with the defect.
data failure; length Defect $15; input Defect Count @@;
985
select (Defect) ; when ("Contamination") when ("Metallization") when ("Oxide") when ("Corrosion") when ("Doping") when ("Silicon") otherwise end; datalines; Contamination Miscellaneous Corrosion 3 Oxide 9 Doping 1 Silicon 2 Metallization Contamination Miscellaneous ; run;
15 3
0 23 1
2 16 1
Produce the bar-line chart. The SUMVAR= option in the BAR statement species the variable that determines the height of the bars. The SUMVAR= option in the PLOT statement species the plot variable. GBARLINE multiplies the value of the FREQ= variable by the value of the COUNT variable, and uses the result to determine the plot points.
proc gbarline data=failure; bar Defect/ sumvar=Count axis=axis1; plot / sumvar=Count freq=cost axis=axis2; run; quit;
986
Example 3: Specifying Subgroups, Multiple Plots, Data Tips, and Drill-Down URLs
Chapter 35
Example 3: Specifying Subgroups, Multiple Plots, Data Tips, and Drill-Down URLs
Procedure Features:
BAR statement options: DISCRETE HTML= LEGEND= MAXIS= RAXIS= SUBGROUP= SUMVAR= PLOT statement options: AXIS= HTML= LEGEND= Multiple PLOT statements: SUMVAR=
Other Features:
STYLE= option in the ODS statement AXIS statements LEGEND statements ODS HTML statement SYMBOL statement
Data set:
SASHELP.ELECTRIC
This graph shows the total amount of power generated by six different energy sources in the US during the years 1994 to 2005. It also shows the revenue received from four different customer sectors during these same years.
Example 3: Specifying Subgroups, Multiple Plots, Data Tips, and Drill-Down URLs
987
The power generated is graphed as a subgrouped bar chart. The chart variable is YEAR, and the subgroup variable is CUSTOMER, the customer sector. The program also species the DISCRETE option, so each years data is graphed as a separate midpoint. The subgroups create a separate segment in the bar for each year, and the height of each bar represents the total revenue for that year for all customer sectors. The power generated from each energy source is plotted as six different line plots. Each of the six plot lines represents a different energy source. Separate legends are created for the bar chart and the line plots. By specifying the LEGEND POSITION= option, the legend for the bar chart is displayed at the top middle of the graph. The legend for the plots is displayed at the bottom right of the graph. The colors used for everything except the plot lines is controlled by the style. The example species the Analysis style. This example denes data tip text for both the plot symbols and the bar chart segments. It denes drill-down URLs for the entries in the footnotes.
Set the graphics environment.
goptions reset=all border;
Open the HTML destination. The GTITLE option causes the title to be rendered as part of the graph image instead of being created by the HTML code as text. Alternatively, the NOGFOOTNOTE option causes the footnote to be created by the HTML le as text instead of being rendered as an image with the rest of the graph. Notice that, as a result, the TITLE appears within the graph frame, but the footnotes appear outside the frame. You can also use the ODS PATH= and FILE= options to specify a location for the output les.
ods listing close; ods html style=analysis gtitle nogfootnote;
Dene the title and footnotes. The LINK= option in the FOOTNOTE statement denes drill-down URLs for the source of the information.
title1 "US Electric Power - Revenue and Generation Sources"; footnote1 j=r "GBLPOWER"; footnote2 j=l italic link="http://www.eia.doe.gov/cneaf/electricity/epa/epat7p3.html" "Link to Bar Data: USEIA Energy Customer Sectors";
footnote3 j=l italic link="http://www.eia.doe.gov/cneaf/electricity/epa/epat1p1.html" "Link to Line Data: USEIA Energy Generation Sources" ;
988
Example 3: Specifying Subgroups, Multiple Plots, Data Tips, and Drill-Down URLs
Chapter 35
Dene the labels for the axes. The AXIS1 statement denes the axis properties for the bar response (left) axis. The AXIS2 statement denes the properties for the plot response (right) axis. The AXIS3 statement is used to suppress the default label on the midpoint axis.
axis1 label=(j=c "Revenue" j=c "(billions)") minor=none; /* left */ axis2 label=(j=c "Power" j=c "Generated" j=c "(GWh)") minor=none; /* right */ axis3 label=none; /* bottom */
Specify options for the bar and plot legends. Using different LEGEND statements and positioning the legends in different places for the bar chart and the overlay plots causes GBARLINE to produce two separate legends instead of combining the legends into one.
/* Bar legend */ legend1 position=(middle right outside) across=1 label=(position=(top ) j=l "Customer Sector"); /* Line plot legend */ legend2 position=(bottom right outside) across=1 repeat=1 label=(position=(top) j=l "Generation Source") ;
Produce the bar-line chart. This graph uses the data set entitled ELECTRIC found in the SASHELP library. The SUMVAR= option in the BAR statement species the variable that determines the height of the bars. The SUMVAR= option in the PLOT statement species the plot variable. The HTML= options associate data tip text with the bars and plot points.
proc gbarline data=sashelp.electric; bar year / discrete sumvar=Revenue subgroup=Customer raxis=axis1 maxis=axis3 legend=legend1 html=revtip name="US_Electric_Power" des="Chart of US Electricity Generation Sources and Consumers"; plot plot plot plot plot plot run; quit; / / / / / / sumvar=AllPower sumvar=Coal sumvar=Nuclear sumvar=NaturalGas sumvar=Hydro sumvar=Other html=alltip legend=legend2 axis=axis2; html=coaltip; html=nuketip; html=gastip; html=hydrotip; html=othertip;
Close the ODS HTML destination. You must close the HTML destination before you can view the output with a browser.
ods HTML close; ods listing;
989
CHAPTER
36
The GCHART Procedure
Overview 990 About Block Charts 990 About Bar Charts 991 About Pie, Detail Pie, and Donut Charts 993 About Star Charts 995 Concepts 996 About Chart Variables 997 Missing Values 998 About Midpoints 998 Character Values 998 Discrete Numeric Values 998 Continuous Numeric Values 999 Selecting and Ordering Midpoints 1000 About Chart Statistics 1000 Frequency 1000 Cumulative Frequency 1000 Percentage 1001 Cumulative Percentage 1001 Sum 1001 Mean 1001 Calculating Weighted Statistics 1001 About Patterns 1002 Default Patterns and Outlines 1002 User-Dened Patterns, Outlines, and Images 1003 Procedure Syntax 1004 PROC GCHART Statement 1004 BLOCK Statement 1005 HBAR, HBAR3D, VBAR, and VBAR3D Statements 1016 PIE, PIE3D, and DONUT Statements 1039 STAR Statement 1055 Examples 1066 Example 1: Specifying the Sum Statistic in a Block Chart 1066 Example 2: Grouping and Subgrouping a Block Chart 1068 Example 3: Specifying the Sum Statistic in Bar Charts 1070 Example 4: Subgrouping a Three-Dimensional Vertical Bar Chart 1073 Example 5: Controlling Midpoints and Statistics in a Horizontal Bar Chart Example 6: Generating Error Bars in a Horizontal Bar Chart 1079 Example 7: Specifying the Sum Statistic for a Pie Chart 1081 Example 8: Subgrouping a Donut or Pie Chart 1084 Example 9: Ordering and Labeling Slices in a Pie Chart 1085 Example 10: Grouping and Arranging Pie Charts 1087
1076
990
Overview
Chapter 36
Example 11: Specifying the Sum Statistic in a Star Chart 1089 Example 12: Charting a Discrete Numeric Variable in a Star Chart Example 13: Creating a Detail Pie Chart 1093 References 1094
1090
Overview
The GCHART procedure produces six types of charts: block charts, horizontal and vertical bar charts, pie and donut charts, and star charts. These charts graphically represent the value of a statistic calculated for one or more variables in an input SAS data set. The charted variables can be either numeric or character. The procedure calculates these statistics:
3 3 3 3
Use the GCHART procedure to do the following tasks: 3 display and compare exact and relative magnitudes
3 examine the contribution of parts to the whole 3 analyze where data are out of balance
991
Figure 36.1
The program for this chart is in Example 1 on page 1066. For more information on producing block charts, see BLOCK Statement on page 1005.
992
Chapter 36
Figure 36.2
The program for this chart is Example 3 on page 1070. Figure 36.3 on page 992 shows the same data presented as a three-dimensional, vertical bar chart. The two types of bar charts have essentially the same characteristics except for where they display statistical values. Horizontal bar charts by default display a table of statistic values to the right of the bars. You can specify that vertical bar charts display the statistic value above or inside of each bar.
Figure 36.3
993
The program for this chart is Example 3 on page 1070. For more information on producing horizontal and vertical bar charts, see HBAR, HBAR3D, VBAR, and VBAR3D Statements on page 1016.
Figure 36.4
Figure 36.5 on page 994 shows the three-dimensional version of the same pie chart. This version features the exploded slice.
994
Chapter 36
Figure 36.5
Figure 36.6 on page 994 shows a detail pie chart generated from the same data.
Figure 36.6
995
The programs for these charts are in Example 7 on page 1081 and Example 13 on page 1093. For more information on producing pie or donut charts, see PIE, PIE3D, and DONUT Statements on page 1039.
Figure 36.7
The program for this chart is Example 11 on page 1089. For more information on producing star charts, see STAR Statement on page 1055. For an alternative way of producing similar types of charts, see Chapter 47, The GRADAR Procedure, on page 1409.
996
Concepts
Chapter 36
Concepts
The GCHART procedure produces charts based on the values of a chart variable. These values are represented by a set of midpoints. The chart itself displays information about the chart variable in the form of chart statistics. Figure 36.8 on page 996 and Figure 36.9 on page 997 illustrate these terms as well as other terms used with the GCHART procedure.
Figure 36.8
group variable (group axis label)
group value
midpoints
table of statistics
response axis major tick mark value minor tick mark response axis label response variable type of statistic
legend
subgroup variable
subgroup values
Bar charts have at least two axes: a midpoint axis that shows the categories of data, and a response axis that displays the scale of values for the chart statistic. By default, the response axis is divided into evenly spaced intervals identied with major tick marks that are labeled with the corresponding statistic value. Minor tick marks are evenly distributed between the major tick marks. Each axis is labeled with the chart variable name or label. The response axis is also labeled with the statistic type.
997
Figure 36.9
Pie charts show statistics based on values of a variable called the chart variable. Generally, the values of the chart variable are represented by the slices in the chart. Beside each pie slice a number (or character string) appears that identies the value or range of values assigned to that slice by the GCHART procedure. This number (or character string) is known as the midpoint for that slice. The statistic value for each midpoint is displayed beneath the midpoint. Each pie slice represents a different value of a given variable (the chart variable). Because the pie chart forms a circle of 360 degrees, each slice represents a percentage of degrees of the circle. The number of degrees created by each slice represents the statistic value for the midpoint.
998
About Midpoints
Chapter 36
Numeric chart variables are always treated as continuous variables unless the DISCRETE option is used in the action statement, or, unless a format is used to group ranges of values. In most cases it is a good idea to specify the DISCRETE option when using date values.
Missing Values
By default, the GCHART procedure ignores missing midpoint values for the chart variable. If you specify the MISSING option, then missing values are treated as a valid midpoint and are included on the chart. Missing values for the group and subgroup variables are always treated as valid groups and subgroups. When the value of the variable that is specied in the FREQ= option is missing, 0, or negative, the observation is excluded from the calculation of the chart statistic. When the value of the variable specied in the SUMVAR= option is missing, the observation is excluded from the calculation of the chart statistic.
About Midpoints
Midpoints are the values of the chart variable that identify categories of data. By default, midpoints are selected or calculated by the procedure. The way the procedure handles the midpoints depends on whether the values of the chart variable are character, discrete numeric, or continuous numeric.
Character Values
A character chart variable generates a midpoint for each unique value of the variable. For example, if the chart variable CITY contains the names of three different cities, each city is a midpoint, resulting in three midpoints for the chart:
Figure 36.10 Character Midpoints
(In pie charts, midpoint values that compose a small percentage of the total for the chart might be placed in the OTHER slice and will not produce a separate midpoint.) By default, character midpoints are arranged in alphabetic order. If a character variable has an associated format, the values are arranged in order of the formatted values.
About Midpoints
999
Figure 36.11
By default, numeric midpoints are arranged in ascending order. The DISCRETE option is very useful for working with dates and numeric values with text user-dened formats. If the numeric variable has an associated format, each formatted value generates a separate midpoint. Formatted numeric variables are arranged in ascending order according to their unformatted numeric values.
Figure 36.12
1000
Chapter 36
In this case, values excluded by the option are not included in the calculation of the chart statistic. You can order or select discrete numeric midpoint values just as you do character values, but you omit the quotation marks when specifying numeric values. For continuous numeric variables, use the LEVELS= or MIDPOINTS= option to change the number of midpoints, to control the range of values each midpoint represents, or to change the order of the midpoints. To control the range of values each midpoint represents, use the MIDPOINTS= option to specify the median value of each range. For example, to select the ranges 2029, 3039, and 4049, specify the following:
midpoints=25 35 45
Alternatively, to select the number of midpoints that you want and let the procedure calculate the ranges and medians, use the LEVELS= option. You can also use formats to control the ranges of continuous numeric variables, but in that case the values are no longer continuous but discrete. Note: You cannot use the MIDPOINTS= option to exclude continuous numeric values from the chart. Values below or above the ranges specied by the option are automatically included in the rst and last midpoints, respectively. To exclude continuous numeric values from a chart, use a WHERE statement in a DATA step or the WHERE= DATA set option. 4 See also the description of the LEVELS= and MIDPOINTS= options for the appropriate statement.
Frequency
The frequency statistic is the total number of observations in the data set for each midpoint. For example, seven observations of the chart variable, CITY, contain the value Denver, so the frequency for the Denver midpoint is 7.
Cumulative Frequency
The cumulative frequency statistic adds the frequency for the current midpoint to the frequency of all of the preceding midpoints. For example, the frequency for the Denver
1001
midpoint is 7, and the frequency for the next midpoint, Seattle, is 9, so the cumulative frequency for Seattle is 16. You cannot request cumulative frequency with the DONUT, PIE, PIE3D, or STAR statements.
Percentage
The percentage statistic is calculated by dividing the frequency for each midpoint by the total frequency count for all midpoints in the chart or group and multiplying it by 100. For example, the frequency count for the Denver midpoint is 7 and the total frequency count for the chart is 21, so the percentage statistic for Denver is 33.3%.
Cumulative Percentage
The cumulative percentage statistic adds the percentage for the current midpoint to the percentage for all of the preceding midpoints in the chart or group. For example, the percentage for the Denver midpoint is 33.3, and the percentage for the next midpoint, Seattle, is 42.9, so the cumulative percentage for Seattle is 76.2. You cannot request cumulative percentage with the DONUT, PIE, PIE3D, or STAR statements.
Sum
The sum statistic is the total of the values for the SUMVAR= variable for each midpoint. For example, if you specify SUMVAR=SALES, and the values of the SALES variable for the seven Denver observations are 8734, 982, 1504, 3207, 4502, 624, and 918, then the sum statistic for the Denver midpoint is 20,471. You must use the SUMVAR= option to specify the variable for which you want the sum statistic.
Mean
The mean statistic is the average of the values for the SUMVAR= variable for each midpoint. For example, if TYPE=MEAN and SUMVAR=SALES, the mean statistic for the Denver midpoint is 2924.42. You must use the SUMVAR= option to specify the variable for which you want the mean statistic.
1002
About Patterns
Chapter 36
For example, to use a variable called COUNT to produce weighted statistics, assign FREQ=COUNT. If you also assign the variable HEIGHT to the SUMVAR= option, then the following table shows how the values of COUNT and HEIGHT would affect the statistic calculation:
Value of COUNT 1 5 . -3 Value of HEIGHT 55 65 63 60 Number of times the observation is used 1 5 0 0 Value used for HEIGHT 55 325 -
By default, the percentage and cumulative percentage statistics are calculated based on the frequency. If you want to chart a percentage or cumulative percentage based on a sum, you can use the FREQ= option to specify a variable to use for the sum calculation and specify the PCT statistic, as shown in this example:
freq=count type=pct
Because the variable that is used by the FREQ= option determines the number of times an observation is counted, the value of COUNT is the equivalent of the sum statistic. See also the descriptions of the TYPE=, SUMVAR=, and FREQ= options for the action statements.
About Patterns
When a chart needs one or more patterns, the procedure uses either one of the following: 3 default patterns and outlines that are automatically generated by SAS/GRAPH
3 patterns, colors, outlines, and images that are dened by PATTERN statements,
graphics options, and procedure options The following sections summarize pattern behavior for the GCHART procedure. For more information, see PATTERN Statement on page 238.
3 use the CPATTERN= graphics option 3 use the COLORS= graphics options 3 use the COUTLINE= option in the action statement
The default patterns, colors, and outlines are generated from the current style. If all of the above conditions are true, and the GSTYLE option is in effect, then the GCHART procedure does the following:
3 selects the default ll, which is always solid, and rotates it through the color list of
the current style, generating one solid pattern for each color. If the rst color in
About Patterns
1003
the styles color list is black (or white), the procedure skips that color and begins generating patterns with the next color.
1004
Procedure Syntax
Chapter 36
Procedure Syntax
Requirements: At least one BLOCK, HBAR, HBAR3D, VBAR, VBAR3D, PIE, PIE3D, DONUT, or STAR statement is required. Global statements: AXIS, FOOTNOTE, GOPTIONS, LEGEND, PATTERN, TITLE Reminder: The procedure can include the BY, FORMAT, LABEL, and WHERE statements as well as the SAS/GRAPH NOTEstatement. Supports:
RUN-group processing
PROC GCHART< DATA=input-data-set> <ANNOTATE=Annotate-data-set> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set>; BLOCK chart-variable(s) </ option(s)>; HBAR | HBAR3D | VBAR | VBAR3Dchart-variable(s) </ option(s)>; PIE | PIE3D | DONUT chart-variable(s) </ option(s)>; STAR chart-variable(s) < / option(s)>;
Syntax
PROC GCHART< DATA=input-data-set> <ANNOTATE=Annotate-data-set> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set>;
Options
PROC GCHART statement options affect all graphs produced by the procedure.
ANNOTATE=Annotate-data-set
species a data set to annotate all graphs that are produced by the GCHART procedure. To annotate individual graphs, use ANNOTATE= in the action statement. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
DATA=input-data-set
species the SAS data set that contains the variable or variables to chart. By default, the procedure uses the most recently created SAS data set.
BLOCK Statement
1005
See also: SAS Data Sets on page 54 and About Chart Variables on page 997 GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output that is produced by the GCHART 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: Specifying the Catalog Name and Entry Name for Your GRSEGs on
page 100
IMAGEMAP=output-data-set
creates a temporary SAS data set that is used to generate an image map in an HTML output le. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identied to the GCHART procedure with the HTML= or HTML_LEGEND= or both options. The %IMAGEMAP macro generates the image map in the HTML output le. The macro takes two arguments, the name of the image map data set and the name or leref of the HTML le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
BLOCK Statement
Creates block charts in which the height of the blocks represents the value of the chart statistic for each category of data.
Requirements:
Drill-down functionality
Description
The BLOCK statement species the variable or variables that dene the categories of data to chart. This statement automatically does the following actions:
3 3 3 3
determines the midpoints calculates the chart statistic for each midpoint (the default is FREQ) scales the blocks according to the statistic value assigns patterns and colors to the block faces and the grid; the default block pattern is solid
You can use statement options to select or order the midpoints (blocks), to change the type of chart statistic, and to modify the appearance of the chart. You can also specify additional variables by which to group, subgroup, or sum the data. Block charts enable grouping, which organizes the blocks into rows based on the values of a group variable, and subgrouping, which subdivides the blocks into segments based on the values of a subgroup variable.
1006
BLOCK Statement
Chapter 36
In addition, you can use global statements to modify the block patterns and the legend, as well as add titles, footnotes, and notes to the chart. You can also use an Annotate data set to enhance the chart. Note: If you get a message that the chart is too large to display on your terminal or printer, try one or both of the following: 3 reduce the size of the character cells dened for the output device by specifying larger values for the HPOS= and VPOS= graphics options 3 decrease the size of the chart text with the HTEXT= graphics option
4
See The Graphics Output and Device Display Areas on page 59 for details.
Syntax
BLOCK chart-variable(s) </ option(s)>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ANNOTATE=Annotate-data-set BLOCKMAX=max-value CAXIS=grid-color COUTLINE=block-outline-color | SAME CTEXT=text-color LEGEND=LEGEND<1...99> NOHEADING NOLEGEND PATTERNID=BY |GROUP |MIDPOINT |SUBGROUP WOUTLINE=block-outline-width
3 midpoint options
DISCRETE GROUP=group-variable LEVELS=number-of-midpoints MIDPOINTS=value-list MIDPOINTS=OLD MISSING SUBGROUP=subgroup-variable 3 statistic options FREQ=numeric-variable G100 SUMVAR=summary-variable TYPE=statistic
BLOCK Statement
1007
3 axes options
GAXIS=AXIS<1...99> MAXIS=AXIS<1...99> RAXIS=value-list | AXIS<1...99>
Required Arguments
chart-variable(s)
species one or more variables that dene the categories of data to chart. Each chart variable draws a separate chart. All variables must be in the input data set. Separate multiple chart variables with blanks. The values of a chart variable used with the BLOCK statement have a maximum length of 13. See also: About Chart Variables on page 997
Options
Options in a BLOCK statement affect all graphs produced by that statement. You can specify as many options as you want and list them in any order. For details on specifying colors, see Chapter 12, SAS/GRAPH Colors and Images, on page 165. For a complete description of the graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
ANNOTATE=Annotate-data-set
species a data set to annotate charts produced by the BLOCK statement. Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid with block charts. 4 Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
BLOCKMAX=max-value
species the chart statistic value of the tallest block on the chart. This option lets you produce a series of block charts using the same scale. All blocks are rescaled as if max-value were the maximum value on the chart. Restriction: Not supported by Java or ActiveX
CAXIS=grid-color
species the color for the midpoint grid. By default, the midpoint grid uses the color of the current style, or, if the NOGSTYLE option is specied, then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. Style reference: Color attribute of the GraphAxisLines element. Featured in: Example 2 on page 1068
COUTLINE=block-outline-color | SAME
outlines all blocks or all block segments and legend values in the subgroup legend (if it appears) using the specied color. SAME species that the outline color of a block or a block segment or a legend value is the same as the interior pattern color. The default outline color depends on the PATTERN statement: 3 If you do not specify a PATTERN statement, the default outline color is the color of the current style. 3 If you specify the NOGSTYLE option and no PATTERN statement, the default outline color is black for the Java or ActiveX devices. Otherwise, the default
1008
BLOCK Statement
Chapter 36
outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the ll color.
Style reference: Color attribute of the GraphOutlines element. Featured in:
Restriction: Partially supported by Java and ActiveX See also: Controlling Block Chart Patterns and Colors on page 1014 and About
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GCHART procedure looks for the text color in the following order:
1 colors specied for labels and values on assigned AXIS and LEGEND
statements, which override the CTEXT= option specied in the BLOCK statement
2 the color specied by the CTEXT= option in the BLOCK statement 3 the color specied by the CTEXT= option in a GOPTIONS statement. 4 the color specied in the current style or, if the NOGSTYLE option is specied,
then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference: Color attributes of the GraphValueText and the GraphLabelText
elements.
DESCRIPTION=description
species the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. The description does not appear on the chart. By default, the GCHART procedure assigns a description of the form BLOCK CHART OF variable, where variable is the name of the chart variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. Refer to Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if, in the SAS program, the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following:
3 3 3 3
the description portion of the Results window. the catalog-entry properties that you can view from the Explorer window. the Description eld of the PROC GREPLAY window. the data tip text for Web output (depending on the device driver you are using). See Data Tips for Web Presentations on page 600 for details. DES=
Alias:
BLOCK Statement
1009
DISCRETE
treats a numeric chart variable as a discrete variable rather than as a continuous variable. The GCHART procedure creates a separate midpoint and, hence, a separate grid square and block for each unique value of the chart variable. If the chart variable has a format associated with it, then each formatted value is treated as a midpoint. The LEVELS= option is ignored when you use DISCRETE. The MIDPOINTS= option overrides DISCRETE.
FREQ=numeric-variable
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. FREQ= is valid with all chart statistics. Because you cannot use the PERCENT, CPERCENT, FREQ, or CFREQ statistics with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. The statistics are not affected by applying a format to numeric-variable.
See also: Calculating Weighted Statistics on page 1001 GAXIS=AXIS<1...99>
assigns the specied AXIS denition to the group axis. (A group axis is created when you use the GROUP= option.) You can use the AXIS denition to modify the order of the groups, the text of the labels, and appearance of the axis. GAXIS= is ignored if the specied AXIS denition does not exist. The AXIS statement options MAJOR= and MINOR= are ignored in AXIS denitions assigned to the group axis because the axis does not use tick marks. A warning message is written to the SAS log if these options appear in the AXIS denition. The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information. To remove groups from the chart, use the ORDER= option in the AXIS statement. To suppress the brackets drawn around the values on the group axis in vertical bar charts, use the NOBRACKETS option in the AXIS statement.
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
Restriction: Supported by Java and ActiveX only. See also: AXIS Statement on page 196 G100
calculates the percentage and cumulative percentage statistics separately for each group. When you use G100, the individual percentages reect the contribution of the midpoint to the group and total 100 percent for each group. G100 is ignored unless you also use the GROUP= option. By default, the individual percentages reect the contribution of the midpoint to the entire chart and total 100 percent for the entire chart.
GROUP=group-variable
organizes the data according to the values of group-variable. Group-variable can be either character or numeric and is always treated as a discrete variable. The group variable can have up to 12 different values. GROUP= produces a group grid that contains a separate row of blocks for each unique value of the group variable. Each row contains a square for each midpoint. The groups are arranged from front to back in ascending order of the group variable
1010
BLOCK Statement
Chapter 36
values. These values are printed to the left of each row; the group variable name or label is printed above the list of group values. By default, each group includes all midpoints, even if no observations for the group fall within the midpoint range. Missing values for group-variable are treated as a valid group. Featured in: Example 2 on page 1068
HTML=variable
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with an area of the chart and point to the data or graph you want to display when the user drills down on the area. There is no limit on the length of the variable. See also: Overview of Enhancing Web Presentations on page 598
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated. Restriction: Not supported by Java orActiveX See also: Overview of Enhancing Web Presentations on page 598
LEGEND=LEGEND<1...99>
assigns the specied LEGEND denition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend. LEGEND= is ignored if the following is true: 3 SUBGROUP= is not used. 3 The specied LEGEND denition is not in effect. 3 The NOLEGEND option is used. 3 The PATTERNID= option is set to any value other than SUBGROUP; that is, the value of PATTERNID= is BY or GROUP or MIDPOINT. To create a legend based on the chart midpoints instead of the subgroups, use the chart variable as the subgroup variable:
block city / subgroup=city;
The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 223 for more information. Featured in: Example 2 on page 1068 Restriction: Partially supported by Java and ActiveX See also: SUBGROUP= on page 1013 and LEGEND Statement on page 223
LEVELS=number-of-midpoints
species the number of midpoints for the numeric chart variable. The range for each midpoint is calculated automatically using the algorithm described in Terrell and Scott (1985). The LEVELS= option is ignored if the following is true: 3 The chart variable is character type. 3 The DISCRETE option is used. 3 The MIDPOINTS= option is used.
MAXIS=AXIS<1...99>
assigns the specied AXIS denition to the midpoint axis. The MAXIS= option is ignored if the specied AXIS denition does not exist.
BLOCK Statement
1011
The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information.
Featured in:
Restriction: Supported by Java and ActiveX only See also: AXIS Statement on page 196 and About Midpoints on page 998 MIDPOINTS=value-list
species the midpoint values for the blocks. The way you specify value-list depends on the type of variable:
3 The lowest midpoint consolidates all data points from negative innity to
the median of the rst two midpoints.
3 The highest midpoint consolidates all data points from the median of the
last two midpoints up to innity.
3 All other values in value-list specify the median of a range of values, and
the GCHART procedure calculates the midpoint values. If you include the DISCRETE option, then each value in value-list species a unique numeric value.
generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric.
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with missing values are ignored. Missing values are always valid for the group and subgroup variables.
1012
BLOCK Statement
Chapter 36
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GCHART. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GCHART1.
NOHEADING
suppresses the heading describing the type of statistic. For the Java and ActiveX devices, NOHEADING is the default. For other devices, by default the heading is printed at the top of each block chart. Featured in: Example 2 on page 1068 Restriction: Not supported by Java or ActiveX
NOLEGEND
suppresses the legend automatically generated by the SUBGROUP= option. NOLEGEND is ignored if the SUBGROUP= option is not used.
PATTERNID=BY | GROUP | MIDPOINT | SUBGROUP
species the way ll patterns are assigned. By default, PATTERNID=SUBGROUP. Values for PATTERNID= are as follows: BY changes patterns each time the value of the BY variable changes. All blocks use the same pattern if the GCHART procedure does not include a BY statement. GROUP changes patterns every time the value of the group variable changes. All blocks in each group (row) use the same pattern, but a different pattern is used for each group. MIDPOINT changes patterns every time the midpoint value changes. If you use the GROUP= option, the respective midpoint patterns are repeated for each group. SUBGROUP changes patterns every time the value of the subgroup variable changes. The blocks must be subdivided by the SUBGROUP= option for the SUBGROUP value to have an effect. Without SUBGROUP=, all block faces have the same pattern. Note: If you use the SUBGROUP= option and specify a PATTERNID= value other than SUBGROUP, the block segments use the same pattern and are indistinguishable. 4 Featured in: Example: Creating Bar Charts with Drill-Down for the Web on page 620 See also: Controlling Block Chart Patterns and Colors on page 1014
RAXIS=value-list | AXIS<1...99> AXIS=value-list | AXIS<1...99>
species values for the major tick mark divisions on the response axis or assigns the specied AXIS denition to the axis. See the MIDPOINTS= option on page 1029 for a description of value-list. By default, the GCHART procedure scales the response axis automatically and provides an appropriate number of tick marks. You can specify negative values, but negative values are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums or means are less than 0. Frequency and percentage values are never less than 0. For lists of values, a separate major tick mark is created for each individual value. A warning message is written to the SAS log if the values are not evenly spaced.
BLOCK Statement
1013
If the values represented by the bars are larger than the highest tick mark value, the bars are truncated at the highest tick mark. If you use a BY statement with the PROC GCHART statement, then the same response axes are produced for each BY group when RAXIS=value-list is used or if there is an ORDER= list in the AXIS statement assigned to the response axis. The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information. Featured in: Example 4 on page 1073 and Example: Creating Bar Charts with Drill-Down for the Web on page 620 Restriction: Supported by Java and ActiveX only See also: AXIS Statement on page 196
SUBGROUP=subgroup-variable
divides the blocks into segments according to the values of subgroup-variable. Subgroup-variable can be either character or numeric and is always treated as a discrete variable. SUBGROUP= creates a separate segment within each block for every unique value of the subgroup variable for that midpoint. If PATTERNID=SUBGROUP (the default setting), each segment is lled with a different pattern, and a legend providing a key to the patterns is automatically generated. If the value of PATTERNID= is anything other than SUBGROUP, the segments are all the same color, the legend is suppressed, and the subgrouping effect is lost. By default the legend appears at the bottom of the chart. To modify the legend, assign a LEGEND denition with the LEGEND= option. To suppress the legend, specify NOLEGEND. Featured in: Example 2 on page 1068 See also: LEGEND Statement on page 223
SUMVAR=summary-variable
species a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of numeric-variable for each midpoint. The resulting statistics are represented by the height of the blocks in each square. The values of a summary variable used with the BLOCK statement have a maximum length of 8. When you use SUMVAR=, the TYPE= option value must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM. Featured in: Example 1 on page 1066
TYPE=statistic
species the chart statistic. 3 If the SUMVAR= option is not used, statistic can be one of the following: FREQ frequency (the default) CFREQ cumulative frequency PERCENT PCT percentage CPERCENT CPCT cumulative percentage 3 If SUMVAR= is used, statistic can be either: SUM sum (the default)
1014
BLOCK Statement
Chapter 36
MEAN mean Because you cannot specify the statistics PERCENT, CPERCENT, FREQ, or CFREQ in conjunction with the SUMVAR= option, you must use FREQ= to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 1001. If you specify TYPE=MEAN and use the SUBGROUP= option, the height of the block represents the mean for the entire midpoint. The subgroup segments are proportional to the subgroups contribution to the sum for the block. Featured in: Example 2 on page 1068 See also: About Chart Statistics on page 1000
WOUTLINE=block-outline-width
species the width of the block outline in pixels. Style reference: LineThickness attribute of the GraphOutlines element. Restriction: Not supported by Java
User-dened patterns
To override the default patterns and select lls and colors for the blocks or block segments, use the PATTERN statement. Only bar or block patterns are valid; all other pattern lls are ignored. For a complete description of all bar or block patterns, see the description of the PATTERN statement option VALUE= on page 240. Whenever you use PATTERN statements, the default pattern outline color is that of the current style. Only when the EMPTY pattern is used does the pattern change to SAME. That is, the outline color is the same as the ll color. To specify the outline color, use the COUTLINE= option on page 1007.
BLOCK Statement
1015
subdivide the blocks, the pattern automatically changes each time the subgroup value changes, and each subdivision of the block displays a different pattern. As a result, the number of values for the SUBGROUP= variable determines the number of block patterns on the chart. If you do not subdivide the blocks, all blocks use the same pattern. Instead of changing the pattern for each subgroup, you can change the pattern for each midpoint, each group, or each BY group, by changing the value of the PATTERNID= option. See the PATTERNID= option on page 1012 for details.
Axis color
By default, axis elements use the color specied in the current style. To change the grid color, use the CAXIS= option. To change the axis text color, use the CTEXT= option.
Figure 36.13
1016
Chapter 36
Description
The HBAR, HBAR3D, VBAR, and VBAR3D statements specify the variable or variables that dene the categories of data to chart. These statements automatically do the following: 3 determine the midpoints 3 calculate the chart statistic for each midpoint (the default is FREQ) 3 scale the response axis and the bars according to the statistic value 3 determine bar width and spacing 3 assign patterns to the bars; the default bar/block pattern is SOLID 3 draw a frame around the axis area using a color determined by the current style, or, if the NOGSTYLE option is specied, using the rst color in the devices color list You can use statement options to select or order the midpoints (bars), to control the tick marks on the response axis, to change the type of chart statistic, to display specic statistics, and to modify the appearance of the chart. You can also specify additional variables by which to group, subgroup, or sum the data. All bar charts allow grouping, which uses an additional category to organize the bars into groups, and subgrouping, which divides the bars into segments. In addition, you can do the following: 3 use global statements to modify the axes (including requesting a logarithmic axis), the bar patterns, and the legend. See Chapter 14, SAS/GRAPH Statements, on page 195 for more information. 3 add titles, footnotes, and notes to the chart. See TITLE, FOOTNOTE, and NOTE Statements on page 278 for more information. 3 use an Annotate data set to enhance the chart. See Chapter 29, Using Annotate Data Sets, on page 643 for more information. 3 display an image in the axis frame or backplane area. See the IFRAME= option on page 1026. 3 display images in the bars of an HBAR or VBAR chart. See the PATTERN statement IMAGE= option on page 239.
Syntax
HBAR | HBAR3D | VBAR | VBAR3D chart-variable(s) </ option(s)>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ANNOTATE=Annotate-data-set
1017
CAUTOREF=reference-line-color CAXIS=axis-color CERROR=error-bar-color CFRAME=background-color CLM=condence-level COUTLINE=bar-outline-color | SAME CREF=reference-line-color|(reference-line-color)|reference-line-color-list CTEXT=text-color FRAME | NOFRAME GSPACE= group-spacing IFRAME= leref | external-le IMAGESTYLE = TILE | FIT LAUTOREF=reference-line-type LEGEND=LEGEND<1...99> LREF=reference-line-type|(reference-line-type)|reference-line-type-list NOLEGEND NOPLANE PATTERNID=BY | GROUP | MIDPOINT | SUBGROUP SHAPE=3D-bar-shape (HBAR3D and VBAR3D only) SPACE=bar-spacing WAUTOREF=reference-line-width WIDTH=bar-width WOUTLINE=bar-outline-width WREF=reference-line-width
3 statistic options
CFREQ CFREQLABEL=column-label | NONE (HBAR and HBAR3D only) CPERCENT CPERCENTLABEL=column-label | NONE (HBAR and HBAR3D only) ERRORBAR=BARS | BOTH | TOP FREQ FREQLABEL=column-label | NONE (HBAR and HBAR3D only) FREQ=numeric-variable G100 INSIDE=statistic MEAN MEANLABEL=column-label | NONE (HBAR and HBAR3D only) NOSTATS (HBAR and HBAR3D only) OUTSIDE=statistic PERCENT PERCENTLABEL=column-label | NONE (HBAR and HBAR3D only) PERCENTSUM SUM SUMLABEL=column-label | NONE (HBAR and HBAR3D only) SUMVAR=summary-variable
1018
Chapter 36
TYPE=statistic midpoint options DISCRETE GROUP=group-variable LEVELS=number-of-midpoints|ALL MIDPOINTS=value-list MIDPOINTS=OLD MISSING RANGE SUBGROUP=subgroup-variable axes options ASCENDING AUTOREF AXIS=AXIS<1...99> CLIPREF DESCENDING FRONTREF (HBAR3D and VBAR3D only) GAXIS=AXIS<1...99> MAXIS=AXIS<1...99> MINOR=number-of-minor-ticks NOAXIS NOBASEREF NOZERO RANGE RAXIS=value-list | AXIS<1...99> REF=value-list catalog entry description options DESCRIPTION=entry-description NAME=entry-name ODS options HTML=variable HTML_LEGEND=variable
Required Arguments
chart-variable(s)
species one or more variables that dene the categories of data to chart. Each chart variable draws a separate chart. All variables must be in the input data set. Multiple chart variables must be separated with blanks. See also: About Chart Variables on page 997
Options
Options in an HBAR, HBAR3D, VBAR, or VBAR3D statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order. For details on specifying colors, see Chapter 12, SAS/GRAPH Colors
1019
and Images, on page 165. For details on specifying images, see Specifying Images in SAS/GRAPH Programs on page 179. For a complete description of the graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
ANNOTATE=Annotate-data-set
species a data set to annotate charts produced by the bar chart statement. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
ASCENDING
arranges the bars in ascending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. The ASCENDING option reorders the bars from shortest to longest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints might be different for each group. The ASCENDING option overrides any midpoint order specied with the MIDPOINTS= option or specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
AUTOREF
draws a reference line at each major tick mark on the response axis. To draw reference lines at specic points on the response axis, use the REF= option. By default, reference lines in two-dimensional bar charts are drawn in front of the bars. To draw reference lines behind the bars, use the CLIPREF option. By default, reference lines in three-dimensional bar charts are drawn on the back plane of the axis. To draw reference lines in front of the bars, use the FRONTREF option. Featured in: Example 5 on page 1076
AXIS=AXIS<1...99>
species the color of reference lines drawn at major tick marks, as determined by the AUTOREF option. If you do not specify the CAUTOREF option, the default color is the value of the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. To specify a line type for these reference lines, use the LAUTOREF= option. Style reference: Color attribute of the GraphGridLines element.
CAXIS=axis-color
species a color for the response and midpoint axis lines and for the default axis area frame. If you omit the CAXIS= option, PROC GCHART searches for a color specication in this order: 1 the COLOR= option in AXIS denitions 2 the color specied in the current style or, if the NOGSTYLE option is specied, then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. This option also species the default color for all reference lines. Style reference: Color attribute of the GraphAxisLines attribute.
CERROR=error-bar-color
species the color of error bars in bar charts. The default is the color of the response axis, which is controlled by the CAXIS= option.
1020
Chapter 36
species the color with which to ll the axis area in two-dimensional bar charts or in the backplane in three-dimensional bar charts. The axis area color does not affect the frame color, which is always the same as the midpoint axis line color and controlled by the CAXIS= option. By default, the axis area in two-dimensional bar charts is not lled. CFRAME= is overridden by the NOFRAME and IFRAME= options. Note: If the background color, the bar color, and the outline color are the same, you might not be able to distinguish the bars. 4
Alias:
Style reference: Color attribute of the GraphWalls element. Featured in: CFREQ
displays the cumulative frequency statistic in the table of statistics and above vertical bars. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ option is specied.
See also: About Chart Statistics on page 1000, Displaying Statistics in
Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
CFREQLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the CFREQ statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word breaks as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify CFREQLABEL=NONE.
Restriction: Not supported by Java or ActiveX CLIPREF
clips the reference lines at the bars. This makes the reference lines appear to be behind the bars. Because the CLIPREF option is the default for three-dimensional bar charts, it affects only two-dimensional charts.
Featured in:
CLM=condence-level
species the condence intervals to use when drawing error bars. Values for condence-level must be greater than or equal to 50 and strictly less than 100. The default is 95. See ERRORBAR= for details on how error bars are computed and drawn.
COUTLINE=bar-outline-color | SAME
outlines all bars or bar segments and legend values in the subgroup legend (if it appears) using the specied color. SAME species that the outline color of a bar or a bar segment or a legend value is the same as the interior pattern color. The default outline color depends on the PATTERN statement:
3 If you do not specify a PATTERN statement, the default outline color is the
color of the current style.
3 If you specify the NOGSTYLE option and no PATTERN statement, the default
outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the ll color.
1021
Style reference: Color attribute of the GraphOutlines element. Featured in: Example 3 on page 1070, Example 5 on page 1076 and Example 6 on
page 1079
See also: Controlling Bar Chart Patterns, Colors, and Images on page 1037 and
displays the cumulative percentage statistic in the table of statistics and above vertical bars. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, or PERCENT option is specied. Alias: CPCT= See also: About Chart Statistics on page 1000, Displaying Statistics in Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
CREF=reference-line-color|(reference-line-color)|reference-line-color-list
species colors for reference lines. Specifying a single color without parentheses applies that color to all reference lines, including lines drawn with the AUTOREF and REF= options. Note that the CAUTOREF= option overrides the CREF= reference color for reference lines drawn with the AUTOREF option. Specifying a single color in parentheses applies that color to only the rst reference line drawn with the REF= option. Specifying a reference color list applies colors in sequence to successive lines drawn with the REF= option. The syntax of the color list is of the form (color1 color2 ...colorN) or (color1, color2 ..., colorN). If you do not specify the CREF= option, the GCHART procedure uses the color specied by the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE option is specied. To specify line types for these reference lines, use the LREF= option. Alias: CR= Style reference: LineStyle attribute of the GraphGridLines element.
CPERCENTLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the CPERCENT statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word breaks as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify CPERCENTLABEL=NONE. Restriction: Not supported by Java or ActiveX
CTEXT=text-color
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GCHART procedure searches for a color specication in this order: 1 colors specied for labels and values on assigned AXIS and LEGEND statements, which override the CTEXT= option specied in the BAR statement. 2 the color specied by the CTEXT= option in the BAR statement. 3 the color specied by the CTEXT= option in the GOPTIONS statement. 4 the color specied in the current style, or, if the NOGSTYLE option is specied, then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis
1022
Chapter 36
colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference:
elements.
DESCENDING
arranges the bars in descending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. The DESCENDING option reorders the bars from longest to shortest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints might be different for each group. The DESCENDING option overrides any midpoint order that is specied with the MIDPOINTS= option or that is specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
DESCRIPTION=description
species the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. The description does not appear on the chart. By default, the GCHART procedure assigns a description of the form BAR CHART OF variable, where variable is the name of the chart variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. Refer to Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following:
3 3 3 3
the description portion of the Results window. the catalog-entry properties that you can view from the Explorer window. the Description eld of the PROC GREPLAY window. the data tip text for Web output (depending on the device driver you are using). See Data Tips for Web Presentations on page 600 for details. DES= Example: Creating Bar Charts with Drill-Down for the Web on page
Alias:
Featured in:
620
DISCRETE
treats a numeric chart variable as a discrete variable rather than as a continuous variable. The GCHART procedure creates a separate midpoint and, hence, a separate bar for each unique value of the chart variable. If the chart variable has a format associated with it, each formatted value is treated as a midpoint. The LEVELS= option is ignored when you use the DISCRETE option. The MIDPOINTS= option overrides the DISCRETE option. The ORDER= option in an AXIS statement that is assigned to the midpoint axis can rearrange or exclude discrete midpoint values.
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
1023
3 the mean of the SUMVAR= variable for each midpoint if you specify
TYPE=MEAN
Let LEVEL be the condence level specied using the CLM= option, with a default value of 95. The upper condence limit for the percentage is computed as follows:
UCLP = PCT + APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 );
When you use the ERRORBAR= option with TYPE=MEAN, the sum variable must have at least two non-missing values for each midpoint. Let N be the number of observations assigned to a midpoint, MEAN be the mean of those observations, and STD be the standard deviation of the observations. The standard error of the mean is computed as follows:
STDERR = STD / SQRT(N);
Let LEVEL be the condence level specied using the CLM= option, with a default value of 95. The upper condence limit for the mean is computed as follows:
UCLM = MEAN + STDERR * TINV( 1-(1-LEVEL/100)/2, N-1);
1024
Chapter 36
If you want the error bars to represent a given number C of standard errors instead of a condence interval, and if the number of observations assigned to each midpoint is the same, then you can nd the appropriate value for the CLM= option by running a DATA step. For example, if you want error bars that represent one standard error (C=1) with a sample size of N, you can run the following DATA step to compute the appropriate value for the CLM= option and assign that value to a macro variable &LEVEL:
data null; c = 1; n = 10; level = 100 * (1 - 2 * (1 - probt( c, n-1))); put all; call symput("level",put(level,best12.)); run;
Then when you run the GBARLINE procedure, you can specify CLM=&LEVEL. Note that this trick does not work precisely if different midpoints have different numbers of observations. However, choosing an average value for N can yield sufciently accurate results for graphical purposes if the sample sizes are large or do not vary much.
FRAME | NOFRAME
species whether the two-dimentional axis area frame or the three-dimensional backplane is drawn. The default is FRAME, which draws a frame around the axis area (in two-dimensional bar charts) or generates a colored three-dimensional backplane (in three-dimensional bar charts). Specifying the NOFRAME option removes the axis area frame from two-dimensional charts, including any background color or image. For three-dimensional charts, NOFRAME removes the backplane color or image, and leaves the vertical and horizontal axis planes and axes. To remove these planes, use the NOPLANE option in the AXIS statement. To remove one or more axis elements, use either the AXIS statement or the NOAXIS option. The NOFRAME option overrides the CFRAME= and IFRAME= options and the IBACK= goptionIBACK on page 388. The color of the frame or backplane outline is the color of the midpoint axis, which is determined by the CAXIS= option. Alias: FR|NOFR= Featured in: Example: Creating Bar Charts with Drill-Down for the Web on page 620 and Example 6 on page 1079
FREQ
displays the frequency statistic in the table of statistics and above vertical bars. Non-integer values are rounded down to the nearest integer. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values. This option overrides the CFREQ, PERCENT, CPERCENT, SUM, and MEAN options. Featured in: Example 5 on page 1076 See also: About Chart Statistics on page 1000, Displaying Statistics in Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
FREQLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the FREQ statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word will break as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify FREQLABEL=NONE.
1025
Featured in:
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times that is specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. FREQ= is valid with all chart statistics. Because you cannot use TYPE=PERCENT, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use FREQ= to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. The statistics are not affected by applying a format to numeric-variable.
See also: Calculating Weighted Statistics on page 1001 FRONTREF
species that reference lines drawn by the AUTOREF or REF= options should be drawn in front of the bars. By default, reference lines in three-dimensional bar charts are drawn on the back plane of the axis.
G100
calculates the percentage and cumulative percentage statistics separately for each group. When you use the G100 option, the individual percentages reect the contribution of the midpoint to the group and total 100 percent for each group. The G100 option is ignored unless you also use the GROUP= option. By default, the individual percentages reect the contribution of the midpoint to the entire chart and total 100 percent for the entire chart.
GAXIS=AXIS<1...99>
assigns the specied AXIS denition to the group axis. (A group axis is created when you use the GROUP= option.) You can use the AXIS denition to modify the order of the groups, the text of the labels, and appearance of the axis. The GAXIS= option is ignored if the specied AXIS denition does not exist. The AXIS statement options MAJOR= and MINOR= are ignored in AXIS denitions assigned to the group axis because the axis does not use tick marks. A warning message is written to the SAS log if these options appear in the AXIS denition. The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information. To remove groups from the chart, use the ORDER= option in the AXIS statement. To suppress the brackets drawn around the values on the group axis in vertical bar charts, use the NOBRACKETS option in the AXIS statement.
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
Restriction: Partially supported by Java and ActiveX See also: AXIS Statement on page 196 GROUP=group-variable
organizes the data according to values of group-variable. Group-variable can be either character or numeric and is always treated as a discrete variable. The GROUP= option produces a separate group of bars for each unique value of the group variable. Missing values for group-variable are treated as a valid group. The groups are arranged in ascending order of the group variable values.
1026
Chapter 36
By default, each group includes all midpoints, even if no observations for the group fall within the midpoint range, meaning that no bar is drawn at the midpoint. Use the NOZERO option to suppress midpoints with no observations. The GROUP= option also produces a group axis that lists the values that distinguish the groups. The group axis has no axis line but displays the group variable name or label. To modify the group axis, assign an AXIS denition with the GAXIS= option. In horizontal bar charts, the group axis is to the left of the midpoint axis and the groups are arranged from top to bottom, starting with the lowest value at the top. In vertical bar charts, the group axis is below the midpoint axis and the groups are arranged from left to right starting with the lowest value at the left. If the group label in a vertical bar chart is narrower than all the bars in the group, brackets are added to the label to emphasize which bars belong in each group. Group brackets are not displayed if the space between the group values is less than one and one-half character cells. Use the NOBRACKETS option in the AXIS statement to suppress the group brackets. Featured in: Example: Creating Bar Charts with Drill-Down for the Web on page 620
GSPACE=group-spacing
species the amount of extra space between groups of bars. Group-space can be any non-negative number. Units are character cells. Use GSPACE=0 to leave no extra space between adjacent groups of bars. In this case, the same space appears between groups of bars as between the bars in the same group. The GSPACE= option is ignored unless you also use the GROUP= option. By default, the GCHART procedure calculates group spacing based on the size of the axis area and the number of bars in the chart. Featured in: Example: Creating Bar Charts with Drill-Down for the Web on page 620
HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS statement. These links are associated with an area of the chart and point to the data or graph you want to display when the user drills down on the area. There is no limit on the length of the variable. See also: Overview of Enhancing Web Presentations on page 598
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS statement. These links are associated with a legend value and point to the data or graph you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated. Restriction: Not supported by Java or ActiveX. See also: Overview of Enhancing Web Presentations on page 598
IFRAME=leref | external-le
species an image le to use on a 2D charts frame area or a 3D charts backplane. Fileref must be a valid SAS leref up to eight characters long and must have been previously assigned with a FILENAME statement. External-image-le must specify the complete le name of the image le you want to use. The format of external-image-le varies across operating environments. See also the IMAGESTYLE= option and Displaying an Image in Graph Frame on page 182. This option is overridden by the NOIMAGEPRINT goption. To ll the backplane frame of two-dimensional bar charts, see the IBACK= goption.
1027
species whether to use multiple instances of an image to ll the axis frame or backplane (TILE) or to stretch a single instance of an image to ll the axis frame or backplane frame (FIT). The TILE value is the default. See also the IFRAME= option.
Restriction: Not supported by Java INSIDE=statistic
displays the values of the specied statistic inside the bars. For the Java and ActiveX devices, this option is valid for both horizontal and vertical bar charts. For other devices, this option is valid only for vertical bar charts. For subgrouped bar charts generated with the Java and ActiveX devices, you can display only one statistic for each bar (these devices do not create both inside and outside bar labels). For graphs generated with the Java and ActiveX devices, the OUTSIDE= option overrides INSIDE=. Statistic can be one of the following:
3 3 3 3 3 3 3 3 3 3
FREQ CFREQ CPERCENT | CPCT MEAN PERCENT | PCT SUM FREQ PERCENT | PCT SUBPCT SUM
If the bars are subgrouped, only the following statistics are valid:
With subgroups, PERCENT displays the percent contribution of each subgroup to the midpoint value of the bar, based on frequency. The PERCENT values for each subgroup total the percent contribution of the bar to the whole. For example, if the percent contribution of the whole bar is 60%, the PERCENT statistic for all the subgroups in that bar are 60% total. To calculate PERCENT based on the SUMVAR= variable, use the FREQ= and TYPE= options. For details, see Calculating Weighted Statistics on page 1001. SUBPCT displays the percent contribution of each subgroup to the total bar. The SUBPCT values for each subgroup total the percent contribution to the whole bar. Because of rounding, the total of the percents might not equal 100.
Featured in:
Example 4 on page 1073, and Example: Creating Bar Charts with Drill-Down for the Web on page 620 Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
LAUTOREF=reference-line-type
species the line type for reference lines at major tick marks, as determined by the AUTOREF option. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify a color for these reference lines, use the CAUTOREF= option.
1028
Chapter 36
assigns the specied LEGEND denition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend. LEGEND= is ignored if any of the following is true: 3 The SUBGROUP= option is not used. 3 The specied LEGEND denition is not in effect. 3 The NOLEGEND option is used. 3 The PATTERNID= option is set to any value other than SUBGROUP; that is, the value of PATTERNID= is BY or GROUP or MIDPOINT. To create a legend based on the chart midpoints instead of the subgroups, use the chart variable as the subgroup variable:
hbar city / subgroup=city;
The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 223 for more information. Featured in: Example 4 on page 1073 See also: LEGEND Statement on page 223 and SUBGROUP= on page 1034 option
LEVELS=number-of-midpoints|ALL
species the number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically, using the algorithm in Terrell and Scott (1985). If you specify LEVELS=ALL, then all unique midpoint values are graphed. If your data contains a large number of unique midpoint values (over 200), you can use the XPIXELS and YPIXELS GOPTIONS to enable the device driver to render a larger (and more readable) graph. The LEVELS= option is ignored if any of the following are true: 3 The chart variable is character type. 3 The DISCRETE option is used. 3 The MIDPOINTS= option is used.
LREF=reference-line-type|( reference-line-type|reference-line-type-list)
species line types for reference lines. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. Specifying a line type without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the LAUTOREF= option overrides LREF=reference-line-type for reference lines drawn with the AUTOREF option. Specifying a single line type in parentheses applies that line type to the rst reference line drawn with the REF= option. Specifying a line type list applies line types in sequence to successive reference lines drawn with the REF= option. The syntax of the line-type list is of the form (type1 type2 ...typeN). If you do not specify the LREF= option, the GCHART procedure uses the type specied by the AXIS statements STYLE= option. If neither option is specied, the default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify colors for these reference lines, use the CREF= option. Style reference: LineStyle attribute of the GraphGridLines element. Alias: LR= Restriction: Not supported by Java
MAXIS=AXIS<1...99>
assigns the specied AXIS denition to the midpoint axis. The MAXIS= option is ignored if the specied AXIS denition does not exist.
1029
The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information.
Featured in:
Restriction: Partially supported by Java and ActiveX See also: AXIS Statement on page 196 and About Midpoints on page 998 MEAN
displays the mean statistic in the table of statistics and above vertical bars. By default, the column heading in the table includes the name of the variable for which the mean is calculated. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, CPERCENT, or SUM option is specied. The MEAN option is ignored unless you also use the SUMVAR= option.
See also: About Chart Statistics on page 1000, Displaying Statistics in
Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
MEANLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the MEAN statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word breaks as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify MEANLABEL=NONE.
Featured in:
species the midpoint values for the bars. The way you specify value-list depends on the type of the chart variable.
3 The lowest midpoint consolidates all data points from negative innity to
the median of the rst two midpoints.
3 The highest midpoint consolidates all data points from the median of the
last two midpoints up to innity.
3 All other values in value-list specify the median of a range of values, and
the GCHART procedure calculates the midpoint values. If you include the DISCRETE option, then each value in value-list species a unique numeric value.
1030
Chapter 36
If a character variable has an associated format, the specied values must be the formatted values. For a complete description of value-list, see the ORDER= option on page 203 in the AXIS statement. If the value-list for either type of variable species so many midpoints that the axis values overwrite each other, the values may be unreadable. In this case the procedure writes a warning to the SAS log. On many devices, this problem can be corrected by either adjusting the size of the text with the HTEXT= graphics option or by increasing the number of cells in your graphics display using the HPOS= and VPOS= graphics options. The ORDER= option in the AXIS statement overrides the order specied in the MIDPOINTS= option. The bar chart statement options ASCENDING and DESCENDING also override both MIDPOINTS= and ORDER= in the AXIS statement.
Featured in:
generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric.
MINOR=number-of-minor-ticks
species the number of minor tick marks between each major tick mark on the response axis. The MINOR= option in a bar chart statement overrides the number of minor tick marks specied in the MINOR= option in an AXIS denition assigned to the response axis with the RAXIS= option.
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with missing values are ignored. Missing values are always valid for group and subgroup variables.
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GCHART. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique name-for example, GCHART1.
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
NOAXIS
suppresses all axes, including axis lines, axis labels, axis values, and all major and minor tick marks. If you specify an axis denition with the GAXIS, MAXIS=, or RAXIS= options, then the axes are generated as dened in the AXIS statement, but then all lines, labels, values, and tick marks are suppressed. Therefore, axis statement options such as ORDER=, LENGTH, and OFFSET= are still used. To remove only selected axis elements such as lines, values or labels, use specic AXIS statement options. The NOAXIS option does not suppress either the default frame or an axis area ll requested by the CFRAME= option. To remove the axis frame or the three-dimensional backplane, use the NOFRAME option in the procedure. To remove the horizontal or vertical axis planes, use the NOPLANE option in the AXIS statement.
1031
NOBASEREF
suppresses the zero reference line when the SUM or MEAN chart statistic has negative values.
NOLEGEND
suppresses the legend that is automatically generated by the SUBGROUP= option. The NOLEGEND option is ignored if the SUBGROUP= option is not used.
NOPLANE
removes either the horizontal or vertical three-dimensinal axis plane in bar charts produced by the HBAR3D and VBAR3D statements. NOPLANE affects only the axis to which the AXIS statement applies. To remove selected axis elements such as lines, values or labels, use specic AXIS statement options. To remove all axis elements except the three-dimensional planes use the NOAXIS option in the procedure. To remove the backplane, use the NOFRAME option in the procedure. This option is not supported by the GRADAR Procedure.
Featured in:
suppresses the table of statistics. The NOSTATS option suppresses both the default statistics and specic statistics requested by the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.
Restriction: Not supported by Java NOZERO
suppresses any midpoints for which there are no corresponding values of the chart variable and, hence, no bar. The NOZERO option usually is used with the GROUP= option to suppress midpoints when not all values of the chart variable are present for every group or if the chart statistic for the bar is 0. Note: If a bar is omitted and if you have also specied bar labels with the VALUE= option in an AXIS statement, then the labels can be shifted and not displayed with the correct bar. 4
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
OUTSIDE=statistic
displays the values of the specied statistic above the bars. For the Java and ActiveX devices, this option is valid for both horizontal and vertical bar charts. For other devices, this option is valid only for vertical bar charts. For subgrouped bar charts generated with the Java and ActiveX devices, you can display only one statistic for each bar (these devices do not create both inside and outside bar labels). For graphs generated with the Java and ActiveX devices, the OUTSIDE= option overrides INSIDE=. Statistic can be one of the following: 3 FREQ
3 3 3 3 3
Featured in:
Example 4 on page 1073 and Example: Creating Bar Charts with Drill-Down for the Web on page 620
1032
Chapter 36
Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
PATTERNID=BY | GROUP | MIDPOINT | SUBGROUP
species the way ll patterns are assigned. By default, PATTERNID=SUBGROUP. Values for PATTERNID= are as follows: BY changes patterns each time the value of the BY variable changes. All bars use the same pattern if the GCHART procedure does not include a BY statement. GROUP changes patterns every time the value of the group variable changes. All bars in each group use the same pattern, but a different pattern is used for each group. MIDPOINT changes patterns every time the midpoint value changes. If you use the GROUP= option, the respective midpoint patterns are repeated for each group. SUBGROUP changes patterns every time the value of the subgroup variable changes. The bars must be subdivided by the SUBGROUP= option for the SUBGROUP value to have an effect. Without the SUBGROUP= option, all bars have the same pattern. Note: If you use the SUBGROUP= option and specify a PATTERNID= value other than SUBGROUP, the bar segments use the same pattern and are indistinguishable. 4 Featured in: Example 4 on page 1073 and Example: Creating Bar Charts with Drill-Down for the Web on page 620 See also: Controlling Bar Chart Patterns, Colors, and Images on page 1037
PERCENT
prints the percentages of observations having a given value for the chart variable in the table of statistics and above vertical bars. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ or CFREQ option is specied. Alias: PCT See also: About Chart Statistics on page 1000, Displaying Statistics in Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
PERCENTSUM
calculates a percent of the sum variable for horizontal bar charts. The PERCENTSUM option is ignored if the SUMVAR= option is not specied. Alias: PCTSUM See also: About Chart Statistics on page 1000, Displaying Statistics in Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
PERCENTLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the PERCENT statistic in the table of statistics. column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word breaks as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify PERCENTLABEL=NONE. Restriction: Not supported by Java and ActiveX
1033
RANGE
displays on the axis of the chart the range of numeric values represented by each bar. In the graphics output, the starting value of each range is indicated with the less-than symbol (<), and the ending value is indicated with the greater-than-or-equal-to symbol (>=). The RANGE option has no affect on axes that represent character data. By default, the values shown on the axis are determined by the value of the MIDPOINTS= option on page 1029. If specied, the DISCRETE option on page 1022 overrides the RANGE option.
RAXIS=value-list | AXIS<1...99> AXIS=value-list | AXIS<1...99>
species values for the major tick mark divisions on the response axis or assigns the specied AXIS denition to the axis. See the MIDPOINTS= option on page 1029 for a description of value-list. By default, the GCHART procedure scales the response axis automatically and provides an appropriate number of tick marks. You can specify negative values, but negative values are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums or means are less than 0. Frequency and percentage values are never less than 0. For lists of values, a separate major tick mark is created for each individual value. A warning message is written to the SAS log if the values are not evenly spaced. If the values represented by the bars are larger than the highest tick mark value, the bars are truncated at the highest tick mark. If you use a BY statement with the PROC GCHART statement, then the same response axes are produced for each BY group when RAXIS=value-list is used or if there is an ORDER= list in the AXIS statement assigned to the response axis. The Java and ActiveX devices do not support all AXIS statement options. See AXIS Statement on page 196 for more information. Featured in: Example 4 on page 1073 and Example: Creating Bar Charts with Drill-Down for the Web on page 620 Restriction: Partially supported by Java and ActiveX See also: AXIS Statement on page 196
REF=value-list
draws reference lines at the specied points on the response axis. See the MIDPOINTS= option on page 1029 for a description of value-list. Values can be listed in any order, but should be within the range of values represented by the response axis. A warning is written to the SAS log if any of the points are off of the axis, and no reference line is drawn for such points. You can use the AUTOREF option to draw reference lines automatically at all of the major tick marks. By default, reference lines in three-dimensional bar charts are drawn on the back plane of the axis. To draw the reference lines in front of the bars, use the FRONTREF option.
SHAPE=three-dimensional-bar-shape (HBAR3D and VBAR3D only)
species the shape of the bars in charts that are produced with the HBAR3D and VBAR3D statements. three-dimensional-bar-shape can be one of the following: 3 BLOCK | B (the default) 3 CYLINDER | C 3 HEXAGON | H 3 PRISM | P 3 STAR | S
Featured in:
Example: Creating Bar Charts with Drill-Down for the Web on page
620
1034
Chapter 36
SPACE=bar-spacing
species the amount of space between individual bars or between the bars within each group if you also use the GROUP= option. Bar-spacing can be any non-negative number, including decimal values. Units are character cells. By default, the GCHART procedure calculates spacing based on the size of the axis area and the number of bars on the chart. Use SPACE=0 to leave no space between adjacent bars. The SPACE= option is ignored if the following is true:
3 You specify the WIDTH= option and are using the Java or ActiveX devices. 3 The specied spacing requests a chart that is too large to t in the space
available for the midpoint axis. In this case, a warning message is issued.
Featured in:
Example 4 on page 1073 and Example: Creating Bar Charts with Drill-Down for the Web on page 620
SUBGROUP=subgroup-variable
divides the bars into segments according to the values of subgroup-variable. Subgroup-variable can be either character or numeric and is always treated as a discrete variable. SUBGROUP= creates a separate segment within each bar for every unique value of the subgroup variable for that midpoint. If PATTERNID=SUBGROUP (the default setting), each segment is lled with a different pattern and a legend that provides a key to the patterns is automatically generated. If the value of PATTERNID= is anything other than SUBGROUP, the segments are all the same color, the legend is suppressed, and the subgrouping effect is lost. By default the legend appears at the bottom of the chart. To modify the legend, assign a LEGEND denition with the LEGEND= option. To suppress the legend, specify NOLEGEND.
Featured in:
Example 4 on page 1073, Example: Creating Bar Charts with Drill-Down for the Web on page 620 and Example 5 on page 1076
displays the sum statistic in the table of statistics and above vertical bars. By default, the column heading in the table includes the name of the variable for which the sum is calculated. Default statistics are suppressed when you request specic statistics. For vertical bar charts, this option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, or CPERCENT option is specied. SUM is ignored unless you also use the SUMVAR= option.
See also: About Chart Statistics on page 1000, Displaying Statistics in
Horizontal Bar Charts on page 1036, and Displaying Statistics in Vertical Bar Charts on page 1037
SUMLABEL=column-label | NONE (HBAR and HBAR3D only)
species the text of the column label for the SUM statistic in the table of statistics. Column-label can be up to 32 characters long, but a single line of the label can be no more than 24 characters. By default, a label with more than one word breaks as close to the center of the line as possible. A double space in the string forces a line break. To suppress the label, specify SUMLABEL=NONE.
Restriction: Not supported by Java and ActiveX SUMVAR=summary-variable
species a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of summary-variable for each midpoint. The resulting statistics are represented by the length of the bars along the response axis, and they are displayed at major tick marks.
1035
When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With the SUMVAR= option, the default is TYPE=SUM. Featured in: Example 3 on page 1070 and Example 6 on page 1079
TYPE=statistic
species the chart statistic. 3 If the SUMVAR= option is not used, statistic can be one of the following: FREQ frequency (the default) CFREQ cumulative frequency PERCENT PCT percentage CPERCENT CPCT cumulative percentage 3 If the SUMVAR= option is used, statistic can be either of the following: SUM sum (the default) MEAN mean Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT, or TYPE=CPERCENT with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 1001. If you specify TYPE=MEAN and use the SUBGROUP= option, the height or length of the bar represents the mean for the entire midpoint. The subgroup segments are proportional to the subgroups contribution to the sum for the bar. See also SUBGROUP= on page 1034. Featured in: Example 6 on page 1079 See also: About Chart Statistics on page 1000 for a complete description of statistic types
WAUTOREF=reference-line-width
species the line width for reference lines at major tick marks, as determined by the AUTOREF option. Line widths are specied as whole numbers. The default line width is specied by the current style or by the AXIS statements WIDTH= option. (By default, WIDTH=1.) To specify a color for these reference lines, use the CAUTOREF= option. Style reference: LineThickness attribute of the GraphGridLines element.
WIDTH=bar-width
species the width of the bars. By default, the GCHART procedure selects a bar width that accommodates the midpoint values displayed on the midpoint axis using a hardware font and a height of one cell. Units for bar-width are character cells. The value for bar-width must be greater than 0, but it does not have to be an integer, for example:
vbar site / width=1.5;
If the requested bar width results in a chart that is too large to t in the space available for the midpoint axis, then the procedure issues a warning in the log and ignores the WIDTH= option. If the specied width is too narrow, the procedure displays the midpoint values vertically.
1036
Chapter 36
Featured in:
WOUTLINE=bar-outline-width
species the width of the outline in pixels. The WOUTLINE= option affects both the bar and the subgroup outlines.
Style reference: LineThickness attribute of the GraphOutlines element. Restriction: Not supported by Java WREF=reference-line-width
species line widths for reference lines. Line widths are specied as whole numbers. To specify colors for these reference lines, use the CREF= option.
Style reference: LineThickness attribute of the GraphReference element. Restriction: Not supported by Java
1037
To control the font and size of the text in the table of statistics, use the HTEXT= and FTEXT= graphics options.
1038
Chapter 36
exhausted, the procedure a slightly modied version of the original color list. It continues in this fashion until each of the chart variables have been assigned a unique pattern. If you use the default style colors and the rst color in the list is either black or white, then the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, the procedure uses all the colors in the list to generate the patterns.
3 outlines bars and bar segments using the color dened by the style.
See About Patterns on page 1002 for more information on how the GCHART procedure assigns default patterns and outlines.
User-Dened Patterns
To override the default patterns and select lls and colors for the bars or bar segments, use the PATTERN statement. Only bar or block patterns are valid; all other pattern lls are ignored. For a complete description of all bar or block patterns, see VALUE= option on page 240 in PATTERN Statement on page 238. Whenever you use PATTERN statements, the default pattern outline color is that of the current style. Only when the EMPTY pattern is used does the pattern change to SAME. That is, the outline color is the same as the ll color. To specify the outline color, use the COUTLINE= option (see COUTLINE=).
Axis Color
By default, axis elements use the colors specied in the current style or the colors that are specied by AXIS statement color options. However, action statement options can also control the color of the axis lines, text, and frame.
To change the color of... the axis text the axis lines the area within the frame Use this option... CTEXT= CAXIS= CFRAME=
1039
Description
The PIE, PIE3D, and DONUT statements specify the variable or variables that dene the categories of data to chart. These statements automatically do the following: 3 determine the midpoints. 3 calculate the chart statistic for each midpoint (the default is FREQ). 3 scale each slice to represent its chart statistic. No slice is drawn if the chart statistic for the midpoint is 0. 3 order the slices by midpoint value in ascending order starting at the three oclock position and proceeding counterclockwise around the pie. 3 print the slice name (midpoint value) and slice value (chart statistic) beside each slice. 3 assign patterns and colors to the slices. The default pie pattern is PSOLID. You can use statement options to select or order the midpoints (slices), to change the type of chart statistic, and to modify the appearance of the chart, including the content and position of the slice labels, and patterns used by the slices. You can also specify additional variables by which to group, subgroup, or sum the data. Statement options can also produce special effects, such as exploded or invisible slices. Donut and pie charts allow grouping and subgrouping. Grouping creates two or more separate pie or donut charts that display in rows or columns on one graph. Subgrouping creates a separate ring of slices within the circle for each value of the subgroup variable. The concentric rings of the subgrouped pie or donut chart make it easy to compare slice values between subgroups. In addition, you can use global statements to modify patterns and legends, as well as add titles, footnotes, and notes to the chart. You can also use an Annotate data set to enhance the chart.
Syntax
PIE | PIE3D | DONUT chart-variable(s) </ option(s)>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ANNOTATE=Annotate-data-set CFILL=ll-color COUTLINE=slice-outline-color | SAME DETAIL_RADIUS=percent (PIE and DONUT only) EXPLODE=value-list FILL=SOLID | X
1040
Chapter 36
INVISIBLE=value-list NOHEADING RADIUS= WOUTLINE=slice-outline-width statistic options FREQ=numeric-variable SUMVAR=summary-variable TYPE=statistic midpoint options DISCRETE LEVELS=number-of-midpoints|ALL MIDPOINTS=value-list MIDPOINTS=OLD MISSING OTHER=percent-of-total detail pie options (PIE and DONUT only) DETAIL=variable DETAIL_THRESHOLD=percent grouping and subgrouping options ACROSS=number-of-columns DOWN=number-of-rows GROUP=group-variable NOGROUPHEADING SUBGROUP=subgroup-variable slice-ordering options ANGLE=degrees ASCENDING CLOCKWISE DESCENDING JSTYLE slice-labeling options CTEXT=text-color LEGEND | LEGEND=LEGEND<1...99> MATCHCOLOR NOLEGEND OTHERLABEL=text-string PERCENT=ARROW | INSIDE | NONE | OUTSIDE PLABEL=(text argument(s)) SLICE=ARROW | INSIDE | NONE | OUTSIDE VALUE=ARROW | INSIDE | NONE | OUTSIDE detail pie slice-labeling options (PIE and DONUT only) DETAIL_PERCENT=BEST|NONE DETAIL_SLICE=BEST|NONE DETAIL_VALUE=BEST|NONE donut-labeling options (DONUT only):
1041
Required Arguments
chart-variable(s)
species one or more variables that dene the categories of data to chart. Each chart variable draws a separate chart. All variables must be in the input data set. Separate multiple chart variables with blanks. See also: About Chart Variables on page 997
Options
Options in a PIE, PIE3D, or DONUT statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order. For details on specifying colors, see Chapter 12, SAS/GRAPH Colors and Images, on page 165. For a complete description of the graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
ACROSS=number-of-columns
draws number-of-columns pies across the procedure output area. ACROSS is ignored unless you also use the GROUP= option. If number-of-columns calls for more pies than t horizontally in the graphics output area, no pies are drawn and an error message is written to the SAS log. If you also use the DOWN= option, the pies are drawn in left-to-right and top-to-bottom order.
ANGLE=degrees
starts the rst slice at the specied angle. A value of 0 for degrees corresponds to the three oclock position. Degrees can be either positive or negative. Positive values move the starting position in the counterclockwise direction; negative values move the starting position clockwise. By default, ANGLE=0. Successive slices are drawn counterclockwise from the starting slice.
ANNOTATE=Annotate-data-set
species a data set to annotate charts produced by the PIE, PIE3D, or DONUT statement. Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid with pie or donut charts. 4 Alias: ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643 ASCENDING
arranges the slices in ascending order of the value of the chart statistic. By default, slices are arranged in ascending order of midpoint value, without regard to size. The ASCENDING option reorders the slices from smallest to largest. The OTHER slice is still last regardless of its size.
1042
Chapter 36
If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoint values might be different for each pie or donut. The ASCENDING option overrides any midpoint order that is specied with the MIDPOINTS= option.
CFILL=ll-color
species one color for all patterns in the chart, regardless of whether the ll is solid or hatch. For the PIE3D statement, the ll is always solid. For the PIE and DONUT statements, if no pattern is specied in the pattern statement or with the FILL= option, the procedure starts with the default solid ll and then, beginning with P2N0, uses each default pie hatch pattern with the specied color. For the outline color, the procedure uses the default color, which is retrieved from the current style, or, if the NOGSTYLE option is specied, it uses the rst color in the devices color list. Use the COUTLINE= option to specify a different outline color. The CFILL= option overrides any other pattern color specication and controls the color of all slices.
Style reference: Color attribute of the GraphData1 element. Featured in:
See also: Controlling Bar Chart Patterns, Colors, and Images on page 1037 and
draws the slices clockwise starting at the twelve oclock position. Although this position implies ANGLE=90, you can use the ANGLE= option to specify a different starting angle.
COUTLINE=slice-outline-color | SAME
outlines all slices, rings (subgroups), and legend values (if a legend appears) in the specied color. SAME species that the outline color of a slice or a slice segment or a legend value is the same as the interior pattern color. The default outline color depends in the PATTERN statement:
3 If you do not specify a PATTERN statement, the default outline color is the
color of the current style.
3 If you specify the NOGSTYLE option and no PATTERN statement, the default
outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the ll color.
Style reference: Color attribute of the GraphOutlines element. Featured in:
See also: Controlling Slice Patterns and Colors on page 1053 and About
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GCHART procedure looks for the text color in the following order:
1 the colors specied for labels and values on assigned AXIS and LEGEND
statements, which override the CTEXT= option specied on the PIE/DONUT statement
2 the color specied by the CTEXT= option in the PIE/DONUT statement 3 the color specied by the CTEXT= option in a GOPTIONS statement 4 the color specied in the current style or, if the NOGSTYLE option is specied,
then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices
1043
The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference: Color attributes of the GraphValueText and the GraphLabelText
elements.
Featured in: DESCENDING
arranges the slices in descending order of the value of the chart statistic. By default, slices are arranged in ascending order of alphabetical or numeric midpoint value, without regard to size or summary statistic. DESCENDING reorders the slices from largest to smallest. The OTHER slice is still last, regardless of its size. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of midpoint values might be different for each pie or donut. DESCENDING overrides any midpoint order that is specied with the MIDPOINTS= option.
DESCRIPTION=description
species the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. The description does not appear on the chart. By default, the GCHART procedure assigns a description of the form PIE (or PIE3D or DONUT) CHART OF variable, where variable is the name of the chart variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. Refer to Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following:
3 the description portion of the Results window. 3 the catalog-entry properties that you can view from the Explorer window. 3 the Description eld of the PROC GREPLAY window. 3 the data tip text for the entire chart area for web output (depending on the
device driver you are using). See Data Tips for Web Presentations on page 600 for details.
Alias:
DES=
produces an inner pie overlay whose slices show the major components that comprise the outer pies slice. Variable is the variable whose values are used to construct the detail pie. If you specify the DETAIL= option and either GROUP= or SUBGROUP=, then the DETAIL= option is ignored.
DETAIL_PERCENT=BEST|NONE (PIE and DONUT only)
species the algorithm to use for displaying the percentage values for the detail pie slices. NONE turns off the display of the percentage values.
1044
Chapter 36
determines the size of the detail pie. Percent species the percent of the outer pie radius to use as the detail pie radius. The valid range is 25 to 90. The default is 75.
DETAIL_SLICE=BEST|NONE (PIE and DONUT only)
species the algorithm to use for displaying the detail variable labels for the inner pie slices. NONE turns off the display of the detail variable labels.
DETAIL_THRESHOLD=percent (PIE and DONUT only)
determines whether a detail slice is included in the inner pie. Any detail slice comprising percent or more percent of the whole pie is included. The valid range for percent is 0 to 75. The default is 4.
DETAIL_VALUE=BEST|NONE (PIE and DONUT only)
species the algorithm to use for displaying the data values for the detail pie slices. NONE turns off the display of the data values.
DISCRETE
treats a numeric chart variable as a discrete variable rather than as a continuous variable. The GCHART procedure creates a separate midpoint and, hence, a separate slice for each unique value of the chart variable. If the chart variable has a format associated with it, each formatted value is treated as a midpoint. The LEVELS= option is ignored when you use DISCRETE. The MIDPOINTS= option overrides DISCRETE.
DONUTPCT=percent (DONUT only)
species the size of the donut hole in percent of the radius of the whole chart. Values of percent range from 0 to 99. By default, DONUTPCT=25. Featured in: Example 8 on page 1084
DOWN=number-of-rows
draws number-of-rows pies vertically in the procedure output area. The DOWN= option is ignored unless you also use the GROUP= option. If number-of-rows calls for more pies than t vertically in the graphics area of the output device, no pies are drawn and an error message is written to the SAS log. If you also use the ACROSS= option, the pies are drawn in left-to-right and top-to-bottom order.
EXPLODE=value-list
pulls the specied slices slightly out from the rest of the pie for added emphasis. Value-list is the list of midpoint values for the slices to be exploded. See the MIDPOINTS= option on page 1047 for a description of value-list. The values in the value list must match the existing midpoints exactly, including the case of character midpoints. Any values in the list that do not correspond to existing midpoints are ignored. When you use EXPLODE=, the radius is reduced to allow room for exploded slices. When used with subgroups, the EXPLODE= option is supported only by the ActiveX and Java devices. Featured in: Example 7 on page 1081
FILL=SOLID | X
species the ll pattern for all slices in the chart: SOLID S rotates a solid ll through the color list of the current style as many times as necessary. SOLID is the default. X rotates a single hatch pattern through the list of colors dened in the current style. If the NOGSTYLE option is specied, it rotates the hatch pattern through
1045
the device color list as many times as necessary. If you do not specify the colors= goption, the ll skips the rst color in the color list. FILL= overrides any pattern that is specied in PATTERN statements. By default, the outline color is the color dened by the current style, or the rst color in the devices color list if the NOGSTYLE option is specied. If PATTERN statements are used to specify colors, the slice outline color matches the slice ll color. If any PATTERN statements have been dened, the colors in the PATTERN denitions are used, in order, before the default style color rotation. Style reference: Color attribute of the GraphData1 element. Restriction: Partially supported by Java and ActiveX See also: Controlling Bar Chart Patterns, Colors, and Images on page 1037 and PATTERN Statement on page 238
FREQ=numeric-variable
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. FREQ= is valid with all chart statistics. Because you cannot use TYPE=PERCENT or TYPE=FREQ with the SUMVAR= option, you must use the FREQ= option to calculate percentages and frequencies based on a sum. The statistics are not affected by applying a format to numeric-variable. See also: Calculating Weighted Statistics on page 1001
GROUP=group-variable
organizes the data according to values of group-variable and produces a separate pie (or donut) chart for each unique value of group-variable. Group-variable can be either character or numeric and is always treated as a discrete variable. Missing values for group-variable are treated as a valid group. By default, each group includes only those midpoints with nonzero chart statistic values. By default, the charts are produced in ascending order of group variable value and each is drawn on a separate page or display. Therefore, the effect of the GROUP= option is essentially the same as using a BY statement except that the GROUP= option causes the midpoints with the same value to use the same color and ll pattern. To place more than one pie on a page or display, use the ACROSS= or DOWN= options, or both. Featured in: Example 10 on page 1087 See also: BY Statement on page 214
HTML=variable
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with an area of the chart and point to the data or graph that you want to display when the user drills down on the area. See also: Overview of Enhancing Web Presentations on page 598.
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS statement. These links are associated with a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated. If either subgroups or the DETAIL= option are specied, then the HTML_LEGEND= option is ignored.
1046
Chapter 36
Restriction: Not supported by Java and ActiveX. See also: Overview of Enhancing Web Presentations on page 598. INVISIBLE=value-list
makes the specied slices invisible, as if they had been removed from the pie. Labels are not printed for invisible slices. Value-list is the list of midpoint values for the invisible slices. See the MIDPOINTS= option on page 1047 for a description of value-list. The values in the value list must match the existing midpoints exactly, including the case of character midpoints. Any values in the list that do not correspond to existing midpoints are ignored.
JSTYLE
arranges the midpoints in descending order of the statistic value and draws the slices clockwise starting at the twelve oclock position. The JSTYLE option has the same effect as specifying both the DESCENDING and CLOCKWISE options.
LABEL=(text argument(s)) (DONUT only)
denes the text that is displayed in the donut hole. Text-argument(s) denes the text or the appearance of the label, or both. Text-argument(s) can be one or more of the following: text-string provides the text of the label. Enclose each string in quotation marks. Separate multiple strings with blanks. text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be ANGLE=degrees COLOR=color FONT=font HEIGHT=text-height <units> JUSTIFY=LEFT | CENTER | RIGHT ROTATE=degrees The Java and ActiveX devices do not support all of the suboptions. See Text Description Suboptions for Donut on page 1051 for a complete description. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Featured in:
generates a legend for the slice names (midpoint values) instead of printing them beside the slices. The legend displays each slice name and its associated pattern. This option also suppresses the display of the chart statistic values. To display the chart statistics, use the VALUE= option. If you use the SUBGROUP= option, the legend is automatically generated. However, because patterning is always by midpoint, the legend still describes the midpoint values, not the subgroups. Note: If you request a legend and the slices use hatch patterns, the patterns in the slices are oriented to be visually equivalent to the legend. 4 Specifying LEGEND=LEGENDn assigns the specied LEGEND statement to the legend. The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 223 for more information.
1047
species the number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically. If you specify LEVELS=ALL, then all unique midpoint values are graphed. If your data contains a large number of unique midpoint values (over 200), you can use the XPIXELS and YPIXELS GOPTIONS to enable the device driver to render a larger (and more readable) graph. The LEVELS= option is ignored if any of the following is true: 3 The chart variable is character type.
uses the slice pattern color for all slice labels. MATCHCOLOR overrides the color that is specied in the CTEXT= option.
MIDPOINTS=value-list
species the midpoint values for the slices. The way you specify value-list depends on the type of variable:
3 The highest midpoint consolidates all data points from the median of the
last two midpoints up to innity.
3 All other values in value-list specify the median of a range of values, and
the GCHART procedure calculates the midpoint values. If you include the DISCRETE option, then each value in value-list species a unique numeric value. 3 For character chart variables, value-list is a list of unique character values enclosed in quotation marks and separated by blanks: value-1 <...value-n> If a character variable has an associated format, the specied values must be the formatted values. For a complete description of value-list, see the ORDER= option on page 203 in the AXIS statement. Midpoints that represent small percentages are collected into a generic midpoint named OTHER. See the OTHER= option on page 1048 and the OTHERLABEL= option on page 1049 for more information. Featured in: Example 9 on page 1085
1048
Chapter 36
generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with a missing value are ignored. Missing values are always valid for the group and subgroup variable.
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GCHART. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique name-for example, GCHART1.
NOGROUPHEADING
suppresses the headings that are normally printed above each pie when you use the GROUP= option.
NOHEADING
suppresses the heading that is normally printed at the top of each page or display of output for all devices except Java and ActiveX. For the Java and ActiveX devices, NOHEADING is the default. Featured in: Example 8 on page 1084 Restriction: Not supported by Java and ActiveX
NOLEGEND
suppresses the legend that is automatically generated by the SUBGROUP= option. NOLEGEND is ignored if the SUBGROUP= option is not used.
OTHER=percent-of-total
collects all midpoints with chart statistic values less than or equal to percent-of-total into a generic midpoint named OTHER. The value of percent-of-total can be 0 to 100; the default value is 4. Therefore, any slice that represents 4 percent or less of the total is put in the OTHER category. Note: If you specify a small value for percent-of-total, the GCHART procedure might not be able to label all of the small slices. 4 The OTHER slice is the last slice in the pie, regardless of the order of the slices. (In other words, it is the slice immediately before the starting slice.) If only one midpoint falls into the OTHER category, its slice is displayed in its normal position in the pie and retains its original label. For example, suppose a pie has these slices and percent values: Coal 35%, Gas 15%, Hydro 5%, and Oil 45%. If you specify OTHER=5, Hydro remains the third slice instead of becoming the last slice.
OTHERCOLOR=color
species the color to use for the OTHER slice. If you omit the OTHERCOLOR= option, GCHART searches for a color specication in this order: 1 the CFILL= option 2 the COLOR= option in a PATTERN statement 3 the COLOR= in a GOPTIONS statement 4 the color of the current style, or, the rst color in the devices color list if the NOGSTYLE option is specied
1049
For more information, see Controlling Slice Patterns and Colors on page 1053.
Style reference: Color attribute of the GraphData1 to GraphDataN element,
species a text string up to 16 characters for the label for the OTHER slice. The default label is OTHER.
PERCENT=ARROW | INSIDE | NONE | OUTSIDE
prints the percentage represented by each slice using the specied labeling method. For a description of the option values, see Selecting and Positioning Slice Labels on page 1052. By default, PERCENT=NONE (percentage is not displayed). Whether the slice percent displays with or without decimal places, depends on the range of values across the chart. The only way to control the appearance of these values is to calculate the percentage with a DATA step or statistical procedure and use the resulting data set as input to the GCHART procedure. Assign the variable that contains the calculated percentages to the SUMVAR= option.
Featured in:
PLABEL=(text argument(s))
denes the text that is displayed on the pie slice label. Text-argument(s) denes the text or the appearance of the label, or both. Text-argument(s) can be one or more of the following: text-string provides the text of the label. Enclose each string in quotation marks. Separate multiple strings with blanks. text-description-suboption modies a characteristic such as the font, color, or size of the text string(s) that follows it. Text-description-suboption can be COLOR=color FONT=font HEIGHT=text-height <units> The Java and ActiveX devices do not support all of the suboptions. See Text Description Suboptions for Donut on page 1051 for a complete description. Specify as many text strings and text description suboptions as you want, but enclose them all in one set of parentheses.
Style reference: Font Attributes of the GraphValueText element. RADIUS=value
species the radius of the pie and donut in GCHART. RADIUS=n, where n is the pie radius in character cells.
SLICE=ARROW | INSIDE | NONE | OUTSIDE
controls the position and style of the slice name (midpoint value) for each slice. For a description of the option values, see Selecting and Positioning Slice Labels on page 1052. By default, SLICE=OUTSIDE (the name is outside of the slice).
Featured in:
SUBGROUP=subgroup-variable
divides the chart into concentric rings according to the values of subgroup-variable. For DEVICE=JAVA, subgroups are implemented using drill-down functionality instead of concentric rings. In the resulting graph, you can select a pie slice to display subgroup information. Subgroup-variable can be either character or numeric and is always treated as a discrete variable.
1050
Chapter 36
The width of the rings, which is the same for each subgroup, is determined by the radius of the pie and the size of the donut hole, if any. By default, the subgroup rings are ordered from the outside in, alphabetically (if character) or numerically (if numeric). If the JSTYLE option is also used, the order of the slices within the subgroups is determined by the outermost subgroup. Any inner subgroup that contains a value that is not in the outer subgroup, places the new slice for that value either last or just before the "other" slice, if one is present. That slice order is continued for any remaining subgroups. Each ring is labeled with its subgroup value; labels are placed to the right of the chart. If the GROUP= option is also used and if all groups contain the same subgroups, then only the rst (upper left) chart on each page is labeled. If any group differs in the number of subgroups it contains, then all charts are labeled. By default the subgroups are outlined in the foreground color. To specify an outline color, use the COUTLINE= option. The SUBGROUP= option automatically generates a legend for the midpoint values (not the subgroup values) and suppresses display of the chart statistic. By default the legend appears at the bottom of the chart. To modify the legend, assign a LEGEND denition. To suppress the legend, specify NOLEGEND. To display the chart statistic, use the VALUE= option. If EXPLODE is also used, it is ignored.
Featured in:
See also: Controlling Bar Chart Patterns, Colors, and Images on page 1037 and
species a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of numeric-variable for each midpoint. The resulting statistics are represented by the size of the slice and displayed beside of each slice. When you use SUMVAR=, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM.
Featured in: TYPE=statistic
3 If the SUMVAR= option is not used, statistic can be one of the following:
FREQ frequency (the default) PERCENT PCT percentage
1051
controls the position and style of the slice value (chart statistic) for each slice. For a description of the option values see Selecting and Positioning Slice Labels on page 1052. By default, VALUE=OUTSIDE (the value is outside the slice).
Featured in:
WOUTLINE=slice-outline-width
species the width of the outline in pixels. WOUTLINE= affects both the slice and the subgroup outlines.
Style reference: LineThickness attribute of the GraphOutlines element. Restriction: Not supported by Java and ActiveX
DONUT
COLOR=color species the color for the text string(s). The COLOR= suboption stays in effect until another COLOR= specication is encountered. If you omit COLOR=, LABEL= uses the color dened by the current style. It ignores the CTEXT= graphics option. See Chapter 12, SAS/GRAPH Colors and Images, on page 165 for details on specifying color.
Alias: C=color Valid in:
FONT=font F=font species the font for the text string or strings. If you omit FONT=, LABEL= uses the font that is specied by the FTEXT= graphics option. If no font is specied, it uses the default hardware font, NONE. See Chapter 11, Specifying Fonts in SAS/ GRAPH Programs, on page 153 for details on specifying font. The Java and ActiveX devices do not support all fonts.
Alias: F=font Valid in:
HEIGHT=text-height <units> species the height of the text string or strings. Text-height is the number of units. If you omit HEIGHT=, LABEL= uses the height that is specied by the HTEXT= graphics option. If no text height is specied and if the default text height is too large for the donut hole, the size of the label is reduced to t. Units can be CELLS | CM | IN | PCT | PT. If you omit units, HEIGHT= uses the unit that is specied by the GUNIT= graphics option, or the default unit, CELLS.
1052
Chapter 36
H=text-height <units> Valid in: DONUT, PIE, PIE3D Restriction: Not supported by Java and ActiveX
Alias:
JUSTIFY=LEFT | CENTER | RIGHT species the alignment of the text string or strings. By default, JUSTIFY=CENTER.
Alias:
J=LEFT
ROTATE=degrees species the angle at which each character is rotated with respect to the baseline of the text string. The angle is measured from the current text baseline angle specied by the ANGLE= suboption. A positive value for degrees rotates the character counterclockwise; a negative value rotates it clockwise. By default, ROTATE=0 (parallel to the baseline). Valid in: DONUT Restriction: Not supported by Java
1053
Figure 36.14
The SLICE= and VALUE= options are dependent on each other. If you specify only VALUE= or only SLICE=, the other option automatically uses the same labeling method. PERCENT= is independent of these two. Be careful about the combinations that you specify. For example, if you specify PERCENT=ARROW and VALUE=OUTSIDE, the line that connects the percentage information to each slice might overlay the statistic value. If your pie has many slices, the labels might overlap, particularly if there are several small slices together. You can correct the overlapping labels by using any of the following options: 3 the HTEXT= graphics option to decrease the size of the labels. 3 the GRSEG Graphics Editor to adjust the labels by moving or resizing the text. 3 the ANGLE= option to change the orientation of the pie. 3 the MIDPOINTS= option to rearrange slices so that small slices are not together. 3 the OTHER= option to group more midpoints into the OTHER category. 3 the HPOS= and VPOS= graphics options to increase the number of cells in your display. ( See The Graphics Output and Device Display Areas on page 59 for details.)
1054
Chapter 36
If you use the default style colors and the rst color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, the procedure uses all the colors in the list to generate the patterns.
3 outlines slices and subgroup segments using the color dened by the style. To
change the outline color, use the COUTLINE= option. See About Patterns on page 1002 for more information on how the GCHART procedure assigns default patterns and outlines.
Controlling patterns
You can control slice patterns and their outlines in several ways.
3 To select a different ll for the slices, such as empty or hatched, you can do the
following:
3 request a single hatched ll pattern for all slices by specifying the FILL=X
option on the PIE or DONUT statement. The pattern specied by FILL=X uses the colors in the color list as many times as needed to generate all of the patterns that are required by the chart. If you specify a single color with either CFILL= or the graphics option, CPATTERN=, all slices use the same color as well as the same pattern.
3 specify a pattern with the VALUE= option in the PATTERN statement. Only
pie patterns are valid; all other pattern specications are ignored. For a complete description of all pie patterns, see the VALUE= option on page 243 in the PATTERN Statement. If no color options are specied, the procedure rotates each specied ll once through the list of colors available in the current style. Otherwise the PATTERN statement generates one pattern denition for the specied pattern and color. When all of the specied patterns are exhausted, the procedure starts rotating through the default pie patterns, beginning with PSOLID.
3 To select colors for the slices, you can do the following: 3 specify a single pattern color with the CFILL= option, or with the
CPATTERN= graphics option, or with a COLORS= list of one color. For the PIE and DONUT statements, CFILL= starts with the default solid color and uses the foreground color for outlines, whereas the CPATTERN= graphics option and a COLORS= list of one color skip the solid pattern and, beginning with P2N0, use each pie hatch pattern with the specied color, and use the ll color for the outline color.
3 specify only COLOR= in one or more PATTERN statements. In this case, the
procedure creates a solid pattern for each specied color. When it runs out of PATTERN statements, it returns to the default patterns, beginning with PSOLID, and rotates them each through the color list. Whenever you specify a PATTERN statement, the default outline color is SAME.
3 To dene specic patterns and colors for the slices, use PATTERN statements and
specify both the VALUE= and COLOR= options. If you provide fewer PATTERN denitions than the chart requires, the GCHART procedure uses the default pattern rotation for the slices that are drawn after all of the dened patterns are exhausted. See About Patterns on page 1002 for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement on page 238 for a description of default pie patterns.
STAR Statement
1055
Because the AXIS statement cannot be used by the PIE, PIE3D, and DONUT statements, you should use the FTEXT= and HTEXT= graphics options to control the font and height of text on the chart. Increasing the value of the HTEXT= graphics option decreases the size of the pie if any slice labels are positioned outside.
STAR Statement
Creates star charts in which the length of the spines represents the value of the chart statistic for each category of data or midpoint. At least one chart variable is required. Global statements: FOOTNOTE, PATTERN, TITLE, Supports: Drill-down functionality (slices only) Restriction: Not supported by Java and ActiveX
Requirements:
Description
The STAR statement species the variable or variables that dene the categories of data to chart. This statement automatically does the following: 3 determines the midpoints. 3 calculates the chart statistic for each midpoint (the default is FREQ). 3 scales each spine or slice to represent the chart statistic. Slices or spines are drawn for all midpoints where the value of the chart statistic is greater than the value that is specied in the STARMIN= option. 3 arranges the spines or slice counterclockwise around the star in ascending order of midpoint value, starting at the three oclock position. 3 prints the midpoint value and chart statistic beside each spine or slice. 3 assigns patterns to the slices. If all the data to be charted with the STAR statement are positive, the center of the star represents 0 and the outside circle represents the maximum value. If negative values are calculated for the chart statistic, the center represents the minimum value in the data. You can specify other values for the center and outside of the circle with the STARMIN= and STARMAX= options. You can also use statement options to select or order the midpoints, to change the type of chart statistic, and to modify the appearance of the chart, including the content
1056
STAR Statement
Chapter 36
and position of the spine or slice labels, and patterns that ll the slice. You can specify additional variables by which to group or sum the data. Star charts allow grouping, which creates two or more separate charts that display in rows or columns on one graph. In addition, you can use global statements to modify patterns as well as add titles, footnotes, and notes to the chart. You can also use an Annotate data set to enhance the chart.
Syntax
STAR chart-variable(s) </ option(s)>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ANGLE=degrees ANNOTATE=Annotate-data-set ASCENDINGAnnotate-data-set CFILL=ll-color COUTLINE=star-outline-color | SAME DESCENDING FILL=SOLID | X LEGEND=LEGEND<1...99> NOCONNECT NOLEGEND NOSPINE STARMAX=max-value STARMIN=min-value WOUTLINE=slice-outline-width
3 statistic options
FREQ=numeric-variable SUMVAR=summary-variable TYPE=statistic 3 midpoint options DISCRETE LEVELS=number-of-midpoints MIDPOINTS=value-list MIDPOINTS=OLD MISSING 3 grouping options ACROSS=number-of-columns DOWN=number-of-rows GROUP=group-variable 3 labeling options CTEXT=text-color MATCHCOLOR NOGROUPHEADING NOHEADING
STAR Statement
1057
PERCENT=ARROW | INSIDE | NONE | OUTSIDE SLICE=ARROW | INSIDE | NONE | OUTSIDE VALUE=ARROW | INSIDE | NONE | OUTSIDE
3 ODS options
HTML=variable HTML_LEGEND=variable
Required Arguments
chart-variable(s)
species one or more variables that dene the categories of data to chart. Each chart variable draws a separate chart. All variables must be in the input data set. Separate multiple chart variables with blanks.
See also: About Chart Variables on page 997
Options
Options in a STAR statement affect all of the graphs that are produced by that statement. You can specify as many options as you want and list them in any order. For details on specifying colors, see Chapter 12, SAS/GRAPH Colors and Images, on page 165.
ACROSS=number-of-columns
draws number-of-columns stars across the procedure output area. ACROSS= is ignored unless you also use the GROUP= option. If number-of-columns calls for more stars than t horizontally in the graphics area of the output device, no stars are drawn and an error message is written to the SAS log. If you also use the DOWN= option, the star charts are drawn in left-to-right and top-to-bottom order.
ANGLE=degrees
starts the rst slice at the specied angle. A value of 0 for degrees corresponds to the three oclock position. Degrees can be either positive or negative. Positive values move the starting position counterclockwise; negative values move the starting position clockwise. If the star chart uses spines instead of slices, degrees species the angle of the position halfway between the rst spine and the last spine. By default, ANGLE=0, which places the rst spine or the center of the rst slice of the star at the 0 degree position. Successive star spines or slices are drawn counterclockwise from the starting position.
ANNOTATE=Annotate-data-set
species a data set to annotate charts that are produced by the STAR statement. Note: Annotate coordinate systems 1, 2, 7, and 8 (data system coordinates) are not valid with star charts. 4
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643
1058
STAR Statement
Chapter 36
ASCENDING
arranges the bars in ascending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. ASCENDING reorders the bars from shortest to longest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints might be different for each group. The ASCENDING option overrides any midpoint order specied with the MIDPOINTS= option or specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
CFILL=ll-color
species one color for all slices in the chart, regardless of whether the ll is solid or hatch. If no pattern is specied in the pattern statement or with the FILL= option, the procedure starts with the default solid ll and then, beginning with P2N0, uses each default star hatch pattern with the specied color. For the outline color, the procedure uses the default color, which is retrieved from the current style, or, if the NOGSTYLE option is specied, it uses the rst color in the devices color list. Use the COUTLINE= option to specify a different outline color. The CFILL= option overrides any other pattern color specication and controls the color of all slices.
Style reference: Color attribute of the GraphData1 element. COUTLINE=star-outline-color | SAME
species the color for the circle that surrounds the star chart and for the slice outlines or spines. SAME species that the outline color of a slice is the same as the interior pattern color. Specifying COUTLINE=SAME affects only slice outlines and has no effect on the color of the circle. The default circle and outline color are both specied in the current style. However, if the NOGSTYLE option is specied, then the default circle color is the rst color in the devices color list (the foreground color), and the default slice outline color is determined as follows:
3 If you do not specify a PATTERN statement, the default outline color is the
color dened in the current style.
3 If you specify the NOGSTYLE option and no PATTERN statement, the default
outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the ll color.
Style reference: Color attribute of the GraphOutlines element. Featured in:
See also: Selecting Patterns for the Star Charts on page 1064 and About
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GCHART procedure looks for the text color in the following order:
1 colors specied for labels and values on assigned AXIS and LEGEND
statements, which override the CTEXT= option specied in the STAR statement
2 the color specied by the CTEXT= option in the STAR statement 3 the color specied by the CTEXT= option in a GOPTIONS statement
STAR Statement
1059
4 the color specied in the current style or, if the NOGSTYLE option is specied,
then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4
Style reference:
elements.
DESCENDING
arranges the bars in descending order of the value of the chart statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. DESCENDING reorders the bars from longest to shortest. In horizontal bar charts the ordering is top to bottom; in vertical bar charts the ordering is left to right. If you also use the GROUP= option, the reordering is performed separately for each group, so the order of the midpoints might be different for each group. The DESCENDING option overrides any midpoint order that is specied with the MIDPOINTS= option or that is specied in the ORDER= option in an AXIS statement assigned to the midpoint axis.
DESCRIPTION=descriptionn
species the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. The description does not appear on the chart. By default, the GCHART procedure assigns a description of the form STAR CHART OF variable, where variable is the name of the chart variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. Refer to Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following:
3 3 3 3
the description portion of the Results window the catalog-entry properties that you can view from the Explorer window the Description eld of the PROC GREPLAY window the data tip text for Web output (depending on the device driver you are using). See Data Tips for Web Presentations on page 600 for details. DES=
Alias:
DISCRETE
treats a numeric chart variable as a discrete variable rather than as a continuous variable. The GCHART procedure creates a separate midpoint and, hence, a separate star slice for each unique value of the chart variable. If the variable has a format associated with it, each format value is treated as a separate value. The LEVELS= option is ignored when you use the DISCRETE option. The MIDPOINTS= option overrides the DISCRETE option.
Featured in:
1060
STAR Statement
Chapter 36
DOWN=number-of-rows
draws number-of-rows stars vertically in the procedure output area. The DOWN= option is ignored unless you also use the GROUP= option. If number-of-rows calls for more stars than t vertically in the graphics area of the output device, no stars are drawn and an error message is written to the SAS log. If you also use the ACROSS= option, the stars are drawn in left-to-right and top-to-bottom order.
FILL=SOLID | X
species the ll pattern for all slices in the star chart: SOLID S rotates a solid ll through the list of colors available in the default style as many times as necessary. SOLID is the default. X rotates a single hatch pattern through the list of colors dened in the current style. If the NOGSTYLE option is specied, it rotates the hatch pattern through the device color list as many times as necessary. If you do not specify the colors= goption, the ll skips the rst color in the color list. FILL= overrides any pattern that is specied in PATTERN statements. By default, the outline color is the color dened by the current style, or the rst color in the devices color list if the NOGSTYLE option is specied. If PATTERN statements are used to specify colors, the slice outline color matches the slice ll color. If any PATTERN statements have been dened, the colors in the PATTERN denitions are used, in order, before the default style color rotation.
Style reference: Color attribute of the GraphData1 element. Featured in:
FREQ=numeric-variable
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times that are specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The FREQ= option is valid with all chart statistics. Because you cannot use TYPE=PERCENT or TYPE=FREQ with the SUMVAR= option, you must use FREQ= to calculate percentages and frequencies based on a sum. The statistics are not affected by applying a format to numeric-variable.
See also: Calculating Weighted Statistics on page 1001 GROUP=variable
organizes the data according to values of group-variable and produces a separate star chart for each unique value of group-variable. Group-variable can be either character or numeric and is always treated as a discrete variable. Missing values for group-variable are treated as a valid group. By default, the charts are produced in ascending order of group variable value and each is drawn on a separate page or display. Therefore, the effect of GROUP= is essentially the same as using a BY statement except that GROUP= causes the midpoints with the same value to use the same color and ll pattern. To place more than one star chart on a page or display, use the ACROSS= or DOWN= options, or both.
STAR Statement
1061
HTML=variable
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with a legend value and point to the data or graph that you want to display when the user drills down on the value. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.
See also: Overview of Enhancing Web Presentations on page 598. HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le that is created by the ODS statement. These links are associated with an area of the chart and point to the data or graph that you want to display when the user drills down on the area. Only star charts with slices support drill-down functionality. There is no limit on the length of the variable. See also: Overview of Enhancing Web Presentations on page 598.
LEGEND=LEGEND<1...99>
assigns the specied LEGEND denition to the legend generated by the SUBGROUP= option. The LEGEND= option itself does not generate a legend. The LEGEND= option is ignored if any of the following are true:
3 3 3 3
The SUBGROUP= option is not used. The specied LEGEND denition is not in effect. The NOLEGEND option is used. The PATTERNID= option is set to any value other than SUBGROUP; that is, the value of PATTERNID= is BY or GROUP or MIDPOINT.
To create a legend based on the chart midpoints instead of the subgroups, use the chart variable as the subgroup variable:
block city / subgroup=city;
The Java and ActiveX devices do not support all LEGEND statement options. See LEGEND Statement on page 223 for more information.
Featured in:
Restriction: Partially supported by Java ActiveX See also: SUBGROUP= on page 1013 and LEGEND Statement on page 223 LEVELS=number-of-midpoints
species number of midpoints for a numeric chart variable. The range for each midpoint is calculated automatically using the algorithm described by Terrell and Scott (1985). The LEVELS= option is ignored if any of the following are true:
3 The chart variable is character type. 3 The DISCRETE option is used. 3 The MIDPOINTS= option is used.
MATCHCOLOR
uses the slice pattern color for all slice labels. MATCHCOLOR overrides the color that is specied in the CTEXT= option. If the chart uses spines instead of slices, the spine color is used for the slice label and value text.
1062
STAR Statement
Chapter 36
MIDPOINTS=value-list
species the midpoint values for the slices. The way you specify value-list depends on the type of variable:
3 The lowest midpoint consolidates all data points from negative innity to
the median of the rst two midpoints.
3 The highest midpoint consolidates all data points from the median of the
last two midpoints up to innity.
3 All other values in value-list specify the median of a range of values, and
the GCHART procedure calculates the midpoint values. If you include the DISCRETE option, each value in value-list species a unique numeric value.
generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). The MIDPOINTS=OLD option is ignored unless the chart variable is numeric
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with a missing value are ignored. Missing values are always valid for the group variable.
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GCHART. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GCHART1.
NOCONNECT
draws only star spines without connecting lines. By default, the spines are connected to form slices.
Featured in:
STAR Statement
1063
NOGROUPHEADING
suppresses the headings normally printed above each star when you use the GROUP= option.
NOHEADING
suppresses the heading normally printed at the top of each page or display of star chart output. Featured in: Example 12 on page 1090
NOLEGEND
suppresses the legend automatically generated by the SUBGROUP= option. The NOLEGEND option is ignored if the SUBGROUP= option is not used.
PERCENT=ARROW | INSIDE | NONE | OUTSIDE
prints the percentage represented by each slice using the specied labeling method. For a description of the option values see Selecting and Positioning Spine and Slice Labels on page 1064. By default, PERCENT=NONE (percentage is not displayed).
SLICE=ARROW | INSIDE | NONE | OUTSIDE
controls the position and style of the slice name (midpoint value) for each slice. For a description of the option values, see Selecting and Positioning Spine and Slice Labels on page 1064. By default, SLICE=OUTSIDE (the name is outside the slice).
STARMAX=max-value
scales the chart so that the outside (or edge) of the circle represents the value that is specied by max-value. By default, the value for STARMAX= is the maximum chart statistic value.
STARMIN=min-value
scales the chart so that the center of the circle represents the value that is specied by min-value. By default, STARMIN=0. If the chart statistic has negative values, by default the value for the STARMIN= option is the minimum chart statistic value.
SUMVAR=summary-variable
species a numeric variable for sum or mean calculations. The GCHART procedure calculates the sum or, if requested, the mean of the value of numeric-variable for each midpoint. The resulting statistics are represented by the size of the slice and displayed beside each slice. When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With SUMVAR=, the default is TYPE=SUM. Featured in: Example 11 on page 1089
TYPE=statistic
species the chart statistic. 3 If the SUMVAR= option is not used, statistic can be one of the following: FREQ frequency (the default) PERCENT PCT percentage If the SUMVAR= option is used, statistic can be one of the following: SUM sum (the default) MEAN mean Because you cannot use TYPE=FREQ or TYPE=PERCENT with the SUMVAR= option, you must use FREQ= to calculate percentages or frequencies based on a sum.
1064
STAR Statement
Chapter 36
See also: About Chart Statistics on page 1000 and Calculating Weighted
controls the position and style of the slice value (chart statistic) for each slice. For a description of the option values, see Selecting and Positioning Spine and Slice Labels on page 1064. By default, VALUE=OUTSIDE (the value is outside of the slice).
WOUTLINE=slice-outline-width
species the width of the outline in pixels. The WOUTLINE= option affects the slice outlines.
Style reference: LineThickness attribute of the GraphOutlines element.
3 lls the slices with star patterns, beginning with the default ll, PSOLID, and
rotates it through the list of colors available in the default style. When these colors are exhausted, the procedure rotates through a slightly modied version of
STAR Statement
1065
the original list of colors. It continues in this fashion until all of the chart variables have been assigned a unique pattern. If you use the default style colors and the rst color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, the procedure uses all of the colors in the list to generate the patterns. 3 outlines slices using the color dened by the style. To change the outline color, use the COUTLINE= option. See About Patterns on page 1002 for more information on how the GCHART procedure assigns default patterns and outlines.
Controlling patterns
You can control slice patterns and their outlines in several ways. 3 To select a different ll for the slices, such as empty or hatched, you can do the following: 3 request a single hatched ll pattern for all slices by specifying the FILL=X option in the STAR statement. The pattern that is specied by FILL=X rotates through the list of colors available in the current style as many times as needed to generate all the patterns required by the chart. If you specify a single color with either CFILL= or the graphics option, CPATTERN=, all slices use the same color as well as the same pattern. 3 specify a pattern with the VALUE= option in the PATTERN statement. Only star patterns are valid; all other pattern specications are ignored. For a complete description of all star patterns, see the VALUE= option on page 243 in PATTERN Statement on page 238. If no color options are specied, the procedure rotates each specied ll once through the list of colors available in the current style. Otherwise the PATTERN statement generates one pattern denition for the specied pattern and color. When all of the specied patterns are exhausted, the procedure starts rotating through the default star patterns, beginning with PSOLID.
3 To select colors for the slices, you can do the following: 3 specify a single pattern color with the CFILL= option, or with the
CPATTERN= graphics option, or with a COLORS= list of one color. If you use the CFILL= option, the procedure starts with the default solid color and uses the foreground color for outlines. If you use CPATTERN= or a COLORS= list of one color, the procedure skips the default solid ll and, beginning with P2N0, uses each default star hatch pattern with the specied color, and uses the ll color for the outline color. 3 specify only the COLOR= option in one or more PATTERN statements. In this case, the procedure creates a solid pattern for each specied color. When it runs out of PATTERN statements, it returns to the default patterns, beginning with PSOLID, and rotates them each through the list of colors available in the current style. Whenever you specify a PATTERN statement, the default outline color is SAME.
3 To dene specic patterns and colors for the slices, use PATTERN statements and
specify both the VALUE= and COLOR= options. If you provide fewer PATTERN denitions than the chart requires, the GCHART procedure uses the default pattern rotation for the slices that are drawn after all dened patterns are exhausted. See About Patterns on page 1002 for more information on how the GCHART procedure uses patterns and outlines. See PATTERN Statement on page 238 for a description of default star patterns.
1066
Examples
Chapter 36
Because the AXIS statement cannot be used by the STAR statement, you should use the FTEXT= and HTEXT= graphics options to control the font and height of text on the chart. Increasing the value of HTEXT= decreases the size of the star if any slice labels are positioned outside. For a description of these graphics options, see Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329.
Examples
Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
FORMAT statement GOPTIONS statement option: BORDER Sample library member: GCHBKSUM
1067
This example produces a block chart of total sales for three sites by charting the values of the character variable SITE and calculating the sum of the variable SALES for each site. It prints formatted values of the sales statistics below the blocks. All the blocks use the same pattern because by default patterns change for subgroups and in this example subgroups are not specied.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Parts Paris 1 5543.97 Tools Sydney 4 1775.74 Tools Atlanta 4 3424.19 Tools Paris 4 6914.25 ;
1068
Chapter 36
Produce the block chart. The BLOCK statement produces a block chart. SUMVAR= calculates the sum of SALES for each value of the chart variable SITE. With SUMVAR= the default statistic is SUM. The summary variable SALES is assigned a dollar format.
proc gchart data=totals; format sales dollar8.; block site / sumvar=sales; run; quit;
BLOCK statement options: CAXIS= GROUP= LEGEND= MIDPOINTS= NOHEADING SUBGROUP= TYPE=
Other features:
GOPTION statement option: BORDER LABEL statement LEGEND statement Default pattern rotation
Sample library member: GCHBKGRP
1069
This example shows average quarterly sales for each department at two of the three manufacturing sites in the TOTALS data set; it excludes the Paris site from the chart. The program groups the chart data (sites) by department, and subgroups department sales data by quarter. Each site is a midpoint. Because the sites are grouped by department, each midpoint has a separate square for each department and the height of the block represents total sales for that department. The blocks are subgrouped to show how quarterly sales contribute to total sales; each segment represents sales for a quarter. A legend explaining the subgroup patterns appears below the midpoint grid. The subgroups use four default patterns and colors which are retrieved from the current style. The patterns are created by rotating the default ll, solid, through the color list that is dened in the current style.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for two of the three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 3043.97 Parts Sydney 3 5142.63 Parts Atlanta 1 5225.26 Parts Atlanta 2 3529.06 Tools Sydney 4 1775.74 Tools Atlanta 4 3424.19 Repairs Sydney 2 5543.97 Repairs Atlanta 1 3788.93
1070
Chapter 36
Dene legend characteristics. LABEL= assigns new text to the legend label. CBORDER= draws a black frame around the legend.
legend1 cborder=black label=("Quarter:") position=(bottom right outside) mode=protect across=1;
Produce the block chart. The LABEL statement suppresses the midpoint and group labels by assigning a null hexadecimal string to each variable name.
proc gchart data=totals; format quarter roman.; format sales dollar8.; label site="00"x dept="00"x;
The TYPE= option species the chart statistic as the mean value of the summary variable SALES for each site. The MIDPOINTS= option selects the two sites and the order in which they appear. The GROUP= option creates a separate row of blocks for each different value of DEPT. The SUBGROUP= option divides each block into separate segments for the four quarters. The LEGEND= option assigns the LEGEND1 statement to the graph. NOHEADING suppresses the default heading that would otherwise appear above the chart.
block site / sumvar=sales type=mean midpoints="Sydney" "Atlanta" group=dept subgroup=quarter legend=legend1 noheading; run; quit;
1071
FORMAT statement GOPTIONS statement option: BORDER RUN-group processing Sample library member: GCHBRSUM
This example produces two bar charts that show the total sales for three sites by charting the values of the character variable SITE and calculating the sum of the variable SALES for each site. In the horizontal bar chart shown above, the summary statistics are printed by default to the right of the bars and display the formatted values of SALES. The output also shows the frame that is drawn by default around the axis area. The second bar chart is a three-dimensional vertical bar chart, shown in the following output. Vertical bar charts do not generate a table of statistics and by default do not print any chart statistics.
1072
Chapter 36
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Parts Paris 1 5543.97 Tools Sydney 4 1775.74 Tools Atlanta 4 3424.19 Tools Paris 4 6914.25 ;
1073
Produce the horizontal bar chart. The HBAR statement produces a two-dimensional bar chart. SUMVAR= calculates the sum of SALES for each value of the chart variable SITE. The default statistic for SUMVAR= is SUM. The summary variable SALES is assigned a dollar format.
proc gchart data=totals; format sales dollar8.; hbar site / sumvar=sales; run;
Produce the vertical bar chart. Because the procedure supports RUN-group processing, you do not have to repeat the PROC GCHART statement to generate the second chart. The VBAR3D statement produces a three-dimensional vertical bar chart. The FOOTNOTE1 statement replaces the previous footnote.
vbar3d site / sumvar=sales; footnote1 j=r "GCHBRSUM(b)"; run; quit;
VBAR statement options: CFRAME= INSIDE=SUBPCT LEGEND= MAXIS= OUTSIDE=SUM RAXIS= SPACE= SUBGROUP= WIDTH=
Other features:
AXIS statement FORMAT statement GOPTIONS statement option: BORDER LEGEND statement Sample library member: GCHBRGRP
1074
Chapter 36
This example subgroups by department the three-dimensional vertical bar chart of total sales for each site that is shown in Example 3 on page 1070. In addition to subdividing the bars to show the amount of sales for each department for each site, the chart displays statistics both inside and outside of the bars. OUTSIDE=SUM prints the total sales for the site above each bar. INSIDE=SUBPCT prints the percent each department contributed to the total sales for its site inside of each subgroup segment. Both the LEGEND statement and the AXIS statement use the ORIGIN= option to line up the legend and the chart by explicitly positioning their lower left corners.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Tools Paris 4 1775.74 Tools Atlanta 4 3424.19 Repairs Sydney 2 5543.97 Repairs Paris 3 6914.25 ;
1075
Modify the midpoint axis. The LABEL= option suppresses the axis label. The ORIGIN= option positions the left end of the horizontal axis at a point that is 25% of the width of the graphics output area.
axis1 label=none origin=(24,);
Modify the response axis. The ORDER= option species the major tick values for the response axis. The OFFSET= option moves the top tick mark to the end of the axis line.
axis2 label=none order=(0 to 30000 by 5000) minor=(number=1) offset=(,0);
Modify the legend. The LABEL= option suppresses the legend label. The SHAPE= option denes the size of the legend values. The CBORDER= option draws a black frame around the legend. The ORIGIN= option species the same position as in the AXIS1 statement.
legend1 label=none shape=bar(3,3) cborder=black origin=(24,);
Produce the vertical bar chart. The SUBGROUP= option creates a separate bar segment for each department. The INSIDE= option prints the subgroup percent statistic inside each bar segment. The OUTSIDE= option prints the sum statistic above each bar. The WIDTH= option makes the bars wide enough to display the statistics. The SPACE= option controls the space between the bars. The MAXIS= option assigns the AXIS1 statement to the midpoint axis. The RAXIS= option assigns the AXIS2 statement to the response axis. The LEGEND= option assigns the LEGEND1 statement to the subgroup legend. The CFRAME= option species the color for the three-dimensional planes.
proc gchart data=totals; format quarter roman.; format sales dollar8.; vbar3d site / sumvar=sales subgroup=dept inside=subpct outside=sum width=9 space=4 maxis=axis1 raxis=axis2
1076
Chapter 36
HBAR statement options: AUTOREF COUTLINE= CLIPREF SUBGROUP= HBAR3D statement options: FREQ FREQLABEL= MIDPOINTS=
Other features:
GOPTIONS statement option: BORDER AXIS statement LEGEND statement RUN-group processing
Sample library member: GCHBRMID
This example uses the FITNESS data set to produce a horizontal bar chart that shows the number of people in each age group in a tness program.
1077
It charts the numeric variable AGE with the frequency statistic. Because the values of AGE are continuous, the procedure automatically divides the ages into ranges and displays the midpoint of each age range. The frequency statistic calculates the number of observations in each range. The chart statistic defaults to FREQ because the SUMVAR= and TYPE= options are omitted. The table of statistics displays all the statistic values. The second part of this example modies the midpoint axis and the table of statistics, and uses RUN-group processing to produce the following chart. This part of the program species the midpoint value for each bar and requests only the FREQ statistic for the table.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create the data set FITNESS. The BORDER option draws a black border around the graph.
data fitness; input age sex $ heart exer aero; datalines; 28 M 86 2 36.6 41 M 76 3 26.7 30 M 78 2 33.8 29 M 54 3 44.8 48 F 66 2 28.9 36 F 66 2 33.2 ;
1078
Chapter 36
Modify the response axis. The OFFSET= option moves the rst and last tick marks to the ends of the axis line. The ORDER= option places major tick marks on the response axis from 1 to 14.
axis1 label=("Number of People") minor=(number=1) offset=(0,0);
Modify the legend. The VALUE= option species the text that describes the values.
legend1 label=none value=("Women" "Men");
Modify the width, color, and type of reference lines. The REF= option denes which reference lines will be highlighted using the type, color and width options. The WREF= option species the width of the reference line. The LREF= option species the type of reference line. The FREQ option requests that only the frequency statistic appears in the table. The FREQLABEL= option species the text for the column header in the table of statistics.
wref=(5 5); lref=(2 1);
Produce the rst horizontal bar chart. Because neither the MIDPOINTS= option nor the DISCRETE option is used, the procedure automatically selects the midpoints. The SUBGROUP= option divides the bars according to the values of SEX and automatically generates a legend. The AUTOREF option adds reference lines to the chart at each major tick mark. The CLIPREF option positions the reference lines behind the bars.
proc gchart data=fitness; hbar age / subgroup=sex legend=legend1 autoref clipref raxis=axis1; run;
Modify the response axis for the second chart. The ORDER= option places major tick marks on the response axis at intervals of 1.
axis1 order=(0 to 4 by 1) label=("Number of People") minor=(number=1) offset=(0,0);
1079
Produce the second horizontal bar chart with modied midpoints. The MIDPOINTS= option species the middle value of the range of values represented by each bar. The FREQ option requests that only the frequency statistic appears in the table. The FREQLABEL= option species the text for the column header in the table of statistics.
hbar3d age / midpoints=(30 40 50) freq freqlabel="Total in Group" subgroup=sex autoref maxis=axis2 raxis=axis1 legend=legend1 coutline=black ; run; quit;
HBAR statement options: CLM= ERRORBAR= FREQLABEL= MEANLABEL= NOFRAME SUMVAR= TYPE=
Other features:
GOPTIONS statement option: BORDER AXIS statement Sample library member: GCHERRBR
1080
Chapter 36
This example uses the FITNESS data set to chart the mean heart rate for each age group with error bars showing the condence limits for the average. The response axis label describes the condence limit for the error bars. To make the error bars easier to read, the program suppresses the frame that the procedure draws around the axis area. Descriptive column head labels in the table of statistics replace the statistic names that appear by default.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create the data set FITNESS. The BORDER option draws a black border around the graph.
data fitness; input age sex $ heart exer aero; datalines; 28 M 86 2 36.6 41 M 76 3 26.7 30 M 78 2 33.8 29 M 54 3 44.8 48 F 66 2 28.9 36 F 66 2 33.2 ;
1081
Modify the axis labels. AXIS1 is assigned to the response axis and AXIS2 is assigned to the midpoint axis.
axis1 label=("Heart Rate" j=c "Error Bar Confidence Limits: 95%") minor=(number=1); axis2 label=("Age" j=r "Group");
Produce the horizontal bar chart.The SUMVAR= option calculates the mean of the variable HEART for all the observations in each midpoint group. The TYPE= option species the mean statistic for the summary variable, HEART. The FREQLABEL= and MEANLABEL= options specify new column labels for the frequency and mean statistics. The ERRORBAR= option draws the error bars as empty bars and CLM= species the condence level. The NOFRAME option suppresses the axis area frame.
proc gchart data=fitness; hbar age / type=mean sumvar=heart freqlabel="Number in Group" meanlabel="Mean Heart Rate" errorbar=bars clm=95 midpoints=(30 40 50) raxis=axis1 maxis=axis2 noframe; run; quit;
GCHPISUM
1082
Chapter 36
This example produces two pie charts that show total sales for three sites by charting the values of the character variable SITE and calculating the sum of the variable SALES for each site. It represents the statistics as slices of the pie. By default, the midpoint value and the summary statistic are printed beside each slice. The pie slices use the default pattern ll, which is solid. Each slice displays a different color because, by default, pie charts are patterned by midpoint. The second pie chart is a three-dimensional pie chart with an exploded slice, as shown in the following output.
1083
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Parts Paris 1 5543.97 Tools Sydney 4 1775.74 Tools Atlanta 4 3424.19 Tools Paris 4 6914.25 ;
Produce the rst pie chart. The pie statement produces a two dimensional pie chart. The SUMVAR= option calculates the sum of SALES for each value of the chart variable SITE. The default statistic for the SUMVAR= option is SUM. The summary variable SALES is assigned a dollar format.
proc gchart data=totals; format sales dollar8.; pie site / sumvar=sales; run;
Produce the second pie chart. The PIE3D statement produces a three-dimensional pie chart. The EXPLODE= option separates the slice for PARIS from the rest of the pie.
pie3d site / sumvar=sales explode="Paris"; run; quit;
1084
Chapter 36
GOPTIONS statement option: BORDER LEGEND Statement Sample library member: GCHSBGRP
This example produces a donut chart that is similar to the pie chart in Example 7 on page 1081 in that each slice represents total sales for a site and each slice is a different color. However, in this donut chart the sites are subgrouped by department, so that each department is represented as a concentric ring with slices. Subgrouping suppresses the chart statistic and the midpoint labels. Instead it automatically labels the rings with the subgroup values and generates a legend that shows how the patterns are associated with the midpoint values. Subgrouping a pie chart produces the same results but without the hole in the center. To make the donut chart as large as possible, the program suppresses the default heading and moves the legend into the space at the left of the chart.
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department .
data totals; length dept $ 7 site $ 8;
1085
input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Parts Paris 1 5543.97 Tools Sydney 4 1775.74 Tools Atlanta 4 3424.19 Tools Paris 4 6914.25 ;
Modify the subgroup legend.The LABEL= options suppresses the legend label. The POSITION=, the OFFSET=, and the ACROSS= options arrange the legend entries in a column to the left of the pie chart.
legend1 label=none position=(middle left) offset=(5,) across=1;
Produce the donut chart. The SUBGROUP= option divides the donut into rings. Each ring represents a value of the subgroup variable, DEPT. The DONUTPCT= option controls the size of the donut hole, which contains the text specied by the LABEL= option. The NOHEADING option suppresses the default heading that contains the name of the chart variable and the type of statistic. The LEGEND= option assigns the LEGEND1 statement to the chart.
proc gchart data=totals; format sales dollar8.; donut site / sumvar=sales subgroup=dept donutpct=30 label=("All" justify=center "Quarters") noheading legend=legend1; run; quit;
1086
Chapter 36
SLICE=ARROW VALUE=NONE
Other features:
This example produces a pie chart of the types of vehicles produced worldwide. The labeled slices represent the percent of total production for each source. Instead of the sum statistic, each slice displays the percent each midpoint contributes to the whole pie. Arrows connect the midpoint labels to the slices, which are arranged by the MIDPOINTS= option so that similar types of vehicles are shown next to each other in the pie chart.
Set the graphics environment.
goptions reset=all border;
1087
Produce the pie chart.This graph uses the data set entitled CARS found in the SASHELP library. OTHER=0 species that all midpoints, no matter how small, display a slice. The MIDPOINTS= option assigns the order of the slices. Each slice displays the percent contribution to total production and the slice name. VALUE=NONE suppresses the chart statistic. Both the SLICE= and PERCENT= options specify the ARROW labeling method to point to the slice, but only one arrow line is displayed.
proc gchart data=sashelp.cars; pie type / other=0 midpoints="Truck" "SUV" "Sedan" "Wagon" "Sports" "Hybrid" value=none percent=arrow slice=arrow noheading; run; quit;
1088
Chapter 36
This example produces two pie charts that show the production of trucks worldwide. Both charts are displayed on one page and are arranged two across. The program uses the CLOCKWISE option to arrange the slices, which begin at the 12 oclock position and proceed clockwise in alphabetic order of the midpoint. The chart statistic is suppressed and the midpoint label and the percent of the chart statistic are displayed outside of the slice.
Set the graphics environment.
goptions reset=all border;
Produce the pie charts. This graph uses the data set entitled CARS found in the SASHELP library. The GROUP= option creates a separate pie for each model. In combination with the GROUP= option, the ACROSS= option draws two charts across one page. The OTHER= option collects all the midpoints with statistic values less than or equal to 5 percent of the total into one slice. CLOCKWISE begins drawing the slices at the 12 oclock position in alphabetic order of the midpoint. The PERCENT=OUTSIDE and SLICE=OUTSIDE display the labels outside the slices.
proc gchart data=sashelp.cars(where=(type="SUV" or type="Truck")); pie make / group=type across=2 other=5 otherlabel="Other Makes" clockwise value=none slice=outside percent=outside; run; quit;
1089
STAR statement options: SUMVAR= Other features: FORMAT statement Sample library member: GCHSTSUM
This example produces a star chart of total sales for three sites by charting the values of the character variable SITE and calculating the sum of the variable SALES for each site. It represents the statistics as slices of the star. The center of the circle represents 0 and the edge of the circle represents the largest value, in this case Paris sales. By default, the spines are joined and lled with a solid pattern to form slices, and the midpoint value and the formatted values of the sales statistics are printed beside each slice.
Set the graphics environment.
goptions reset=all border;
Create data set TOTALS. TOTALS contains quarterly sales data for three manufacturing sites for one year. Sales gures are broken down by department.
data totals; length dept $ 7 site $ 8; input dept site quarter sales; datalines; Parts Sydney 1 7043.97 Parts Atlanta 1 8225.26 Parts Paris 1 5543.97 Tools Sydney 4 1775.74
1090
Chapter 36
Produce the star chart. The SUMVAR= option calculates the sum of SALES for each value of the chart variable SITE. Because the TYPE= option is omitted, the default statistic is sum. The FORMAT statement assigns a format to the summary variable SALES.
proc gchart data=totals; format sales dollar8.; star site / sumvar=sales; run; quit;
1091
This example produces two star charts that show the total number of parts that were rejected each month for a year. The STAR statement uses the DISCRETE option so that each unique value of the numeric variable DATE is a separate midpoint and has a separate spine. Each slice displays the formatted midpoint value and the chart statistic. Specifying FILL=S rotates the solid pattern through all the colors in the styles list of colors as many times as necessary to provide patterns for all the slices. The second chart uses the NOCONNECT option so that the chart uses spines instead of slices.
Set the graphics environment. The BORDER option in the GOPTIONS statement draws a black border around the graph.
goptions reset=all border;
1092
Chapter 36
Create the data set REJECTS. REJECTS contains data on the number of defective parts produced at each of three sites for 12 months. BADPARTS is the number of parts that were rejected at each site for each month.
data rejects; informat date date9.; input site $ date badparts; datalines; Sydney 01JAN1997 8 Sydney 01FEB1997 11 Sydney 28JUN1997 13 Sydney 31OCT1997 6 Paris 11APR1997 12 Paris 04MAY1997 12 Paris 30AUG1997 14 Paris 01DEC1997 7 Atlanta 15MAR1997 7 Atlanta 18JUL1997 12 Atlanta 03SEP1997 10 Atlanta 12NOV1997 9 ;
Produce the rst star chart. DISCRETE must be specied because the numeric chart variable, DATE is assigned the WORDDATE3. Using FILL=S lls all the slices with solid patterns.
proc gchart data=rejects; format date worddate3.; star date / discrete sumvar=badparts noheading fill=s; run;
Produce the second star chart with slices and a solid ll.The NOHEADING option suppresses the default heading for the star chart. The NOCONNECT option suppresses the lines that by default join the ends of the spines.
star date / discrete sumvar=badparts noheading
1093
This example produces a normal pie chart with a detail pie overlay. The pie chart shows the percentage of vehicle types produced worldwide. The detail pie overlay shows the percentage of DRIVETRAINS for each vehicle TYPE.
Set the graphics environment.
goptions reset=all border;
1094
References
Chapter 36
Produce the detail pie chart.This graph uses the data set entitled CARS found in the SASHELP library. The DETAIL= option produces a inner pie overlay showing the percentage that each DRIVETRAIN contributes toward each type of vehicle. The DETAIL_PERCENT= option and the DETAIL_SLICE= option control the positioning of the detail slice labels. The DETAIL_VALUE= option turns off the display of the number of DRIVETRAINS for each detail slice. The DETAIL_THRESHOLD= option shows all detail slices that contribute more than two percent of the entire pie.
proc gchart data=sashelp.cars; pie type / detail=drivetrain detail_percent=best detail_value=none detail_slice=best detail_threshold=2 legend ; run; quit;
References
Nelder, J. A. (1976), A Simple Algorithm for Scaling Graphs, Applied Statistics, Volume 25, Number 1, London: The Royal Statistical Society. Terrell, G. R. and Scott, D. W. (1985), Oversmoothed Nonparametric Density Estimates, Journal of the American Statistical Association, 80.
1095
CHAPTER
37
The GCONTOUR Procedure
Overview 1095 Concepts 1097 CONTOUR Plot 1097 Input Data 1097 Data Ranges 1097 Missing Values 1098 Interpolating Data 1098 Procedure Syntax 1098 PROC GCONTOUR Statement 1098 PLOT Statement 1099 Examples 1115 Example 1: Simple Contour 1115 Example 2: Labeling Contour Lines, Modifying the Horizontal Axis, Modifying the Legend Example 3: Specifying Contour Levels 1118 Example 4: Using Patterns and Joins 1120 References 1123
1116
Overview
The GCONTOUR procedure enables you to generate two-dimensional plots representing three-dimensional relationships. For example, the following contour plot Display 37.1 on page 1096 displays various depths of a lake. The dimensions of the lake are plotted on the x and y axes. The z variable is plotted as the third dimension, and is displayed as uniquely colored contour lines.
1096
Overview
Chapter 37
Display 37.1
3 3 3 3
use AXIS statements to customize the axes use line styles and patterns to emphasize the contour levels use reference lines to see how (x,y) combinations align to z values use SYMBOL statements to customize labels or highlight data trends
Data Ranges
1097
Concepts
CONTOUR Plot
Figure 37.1
axis label (y variable)
axis
major tick mark axis label (x variable) legend label (z variable) minor tick mark
legend value
Input Data
The GCONTOUR procedure requires three numeric variables to produce a plot. The input data set forms a rectangular grid from the values of x and y. The z variable is plotted on the grid as the third dimension. Only one value of z is required for each (x,y) grid location. If multiple observations have the same z value for any (x,y) combination, only the last observation is plotted.
Data Ranges
PROC GCONTOUR produces a rectangular grid with axes scaled to include the minimum data values and maximum data values of x and y. Each axis is labeled with the variable name or label. The contour lines represent the levels of magnitude by grouping the common values of the z variable. The level of each contour line is displayed in the legend. The legend label is the z variables name or label.
1098
Missing Values
Chapter 37
Missing Values
PROC GCONTOUR requires data values for at least fty percent of the z variable, for each unique combination of (x,y). The INCOMPLETE option can be used to override this requirement. The G3GRID procedure can also be used to create data for missing values. (See Chapter 54, The G3GRID Procedure, on page 1563).
Interpolating Data
The G3GRID procedure enables you to produce a data set with nonmissing values for z for every unique (x,y) combination. The output data set from the G3GRID procedure can be used as the input data set for the GCONTOUR procedure. The G3GRID procedure also enables you to smooth data for use with GCONTOUR. For details see Chapter 54, The G3GRID Procedure, on page 1563. For an interpolation example see Example 1 on page 1573 .
Procedure Syntax
Requirements: Global statements:
At least one PLOT statement is required. AXIS, FOOTNOTE, GOPTIONS, LEGEND, PATTERN, SYMBOL,
TITLE
Reminder: The procedure can include the BY, FORMAT, LABEL, NOTE, and WHERE statements.
PROC GCONTOUR <DATA=input-data-set> <ANNOTATE=Annotate-data-set> <GOUT=< libref.>output-catalog> <INCOMPLETE>; PLOT y*x=z </option(s)>;
Syntax
PROC GCONTOUR <DATA= input-data-set> <ANNOTATE=Annotate-data-set > <GOUT=< libref.>output-catalog>
PLOT Statement
1099
<INCOMPLETE>;
Options
PROC GCONTOUR statement options affect all graphs produced by the procedure.
ANNOTATE=Annotate-data-set ANNO=Annotate-data-set
species a data set to annotate all graphs produced by the GCONTOUR procedure. To annotate individual graphs, use the ANNOTATE= option in the action statement.
Restriction: Partially supported by Java and ActiveX See also: Chapter 29, Using Annotate Data Sets, on page 643 DATA=input-data-set
species the SAS data set that contains the variables to plot. The procedure uses the most recently created SAS data set if none is specied.
See also: SAS Data Sets on page 54 and Concepts on page 1097 GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output that is produced by the GCONTOUR procedure. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary library called WORK and creates the output catalog if it does not exist.
INCOMPLETE
allows the plotting of data when values are missing for more than half of the z variable in the input data set.
Restriction: Not supported by Java and ActiveX
PLOT Statement
Creates contour plots using the values of three numeric variables from the input data set as the source of the contour coordinates.
Requirements:
Global statements: AXIS, FOOTNOTE, GOPTIONS, LEGEND, NOTES, PATTERN, SYMBOL, TITLE
Description
The PLOT statement species the three variables to plot. It can also control the contour levels, label the plot lines, and modify the axes as well as the general appearance of the graph. Only one plot request can be specied in a PLOT statement. To specify multiple plots for a single PROC GCONTOUR statement, use multiple PLOT statements. If a global statement is specied more than once, the last occurrence is applied to all PLOT statements in that PROC step. The PLOT statement does the following actions:
3 plots the contour lines as levels using the values of the z variable 3 scales the axes to include the minimum data values and the maximum values of x
and y
3 labels the x and y axes 3 generates a labeled legend representing the values of the z variables contour levels
1100
PLOT Statement
Chapter 37
Global statements enable you to modify the axes, the legend, the contour lines and contour line labels, the ll patterns and pattern colors for contour areas. You can also add titles, footnotes, and notes to the plot. You can use an Annotate data set and set GOPTIONS to enhance the appearance of the plot. Additionally, you can lter your data with a WHERE clause, format your data values, add labels to the variables, and generate multiple plots with a BY statement or multiple plot statements.
Syntax
PLOT y*x=z </option(s)>; option(s) can be one or more options in the following categories: 3 appearance options: ANNOTATE=Annotate-data-set CAXIS=axis-color CFRAME=background-color COUTLINE=outline-color CTEXT=text-color GRID NOAXIS | NOAXES NOFRAME
PLOT Statement
1101
WVREF= reference-line-width|(reference-line-width)|reference-line-width list YTICKNUM=number-of-major-tick-marks 3 contour options: CLEVELS=color(s) JOIN LEGEND=LEGEND<1...99> LEVELS=value-list LJOIN LLEVELS=line-type-list NLEVELS=number-of-levels NOLEGEND PATTERN SMOOTH 3 labeling options: AUTOLABEL | AUTOLABEL=(autolabel-suboptions) where autolabel-suboptions can be one or more of these: CHECK=checking-factor | NONE MAXHIDE=amount<units> REVEAL TOLANGLE=angle 3 catalog entry description options: DESCRIPTION="description" NAME="name"
Required Arguments
y*x=z
species three numeric variables from the input data set: y x z is the variable that is plotted on the vertical axis. is the variable that is plotted on the horizontal axis. is the variable that is plotted as contour lines.
Options
Options in a PLOT statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order. If you use a BY statement on the procedure, the options in each PLOT statement affect all graphs produced by that BY statement.
ANNOTATE= Annotate-data-set
species an Annotate data set to enhance the charts produced by the PLOT statement. Alias: ANNO= Restriction: Partially supported by Java and ActiveX See also: Chapter 33, The GANNO Procedure, on page 913 and Chapter 30, Annotate Dictionary, on page 669
1102
PLOT Statement
Chapter 37
AUTOHREF
displays reference lines originating at the major tick marks on the horizontal axis. Restriction: Not supported by Java
AUTOLABEL | AUTOLABEL=(autolabel_suboptions)
labels the contour lines. Autolabel suboptions enable you to control the appearance of these labels. The label for each contour line is the value of the z variable for that contour level. The labels are displayed in BEST format. The FORMAT statement enables you to change the display format. You can also use the SYMBOL statement to control the appearance and text of contour labels and lines. When AUTOLABEL is used with the LLEVELS= option, LLEVELS is ignored. When AUTOLABEL is used with the CLEVELS= option, AUTOLABEL is ignored. Featured in: Example 2 on page 1116 Restriction: Not supported by Java and ActiveX
See also: Autolabel Suboptions on page 1109 AUTOVREF
displays reference lines originating at the major tick marks on the vertical axis. Restriction: Not supported by Java
CAUTOHREF=reference-line-color
species a color for all the reference lines displayed by the AUTOHREF option. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. Style reference: Color attribute of the GraphGridLines element Restriction: Not supported by Java
CAUTOVREF=reference-line-color
species a color for all the reference lines displayed by the AUTOVREF option. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied Restriction: Not supported by Java
CAXIS=axis-color
species a color for axis lines, axis tick marks, and the frame around the plot. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. Style reference: Color attribute of GraphAxisLines element Restriction: Partially supported by Java
CFRAME=background-color
lls the axis area with the specied color. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. Alias: CFR= Style reference: Color attribute of the GraphWalls element
CHREF=reference-line-color |(reference-line-color) | reference-line-color list
species a color or colors for reference lines drawn with the HREF= option and the AUTOHREF option as follows: 3 specifying a single color without parentheses applies that color to all reference lines drawn with the HREF= option and the AUTOHREF option
3 specifying a single color within parentheses applies the color to the rst
reference line drawn with the HREF= option only
PLOT Statement
1103
CH=
Style reference: ContrastColor attribute of the GraphReference element Restriction: Not supported by Java CLEVELS=color(s)
species a color or list of colors for the contour levels. GCONTOUR substitutes user-dened colors in the ODS style. If more colors are needed, GCONTOUR uses the next color in the ODS style until all lines have an associated color. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. Style reference: Color attribute of the GraphData element
Restriction: Not supported by Java and partially supported by ActiveX COUTLINE=outline-color
species a color for outlining lled areas. This option is ignored unless the PATTERN option is also used. COUTLINE=SAME creates a plot with outlines that are the same color as the adjacent ll color. Note: The outline color is the only distinction between empty patterns. Use of this option makes the patterns look the same when VALUE=EMPTY in PATTERN denitions. 4
Restriction: Not supported by Java and ActiveX Featured in:
CTEXT=text-color
species a color for the axis labels, axis tick mark values, legend labels, and legend value descriptions. GCONTOUR uses the rst color it nds from the following list:
1 colors specied for labels and values on assigned AXIS and LEGEND
statements.
2 the color specied by the CTEXT= option in the PLOT statement. 3 the color specied by the CTEXT= option in a GOPTIONS statement. 4 the color specied in the current style, or if the NOGSTYLE system option is
specied, the default color is the rst color in the color list for each device. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. However, if the AXIS statement species only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variables labels is controlled by the CBY= option in the GOPTIONS statement. 4
Featured in:
species a color or colors for reference lines drawn with the VREF= option and the AUTOVREF option as follows:
3 specifying a single color without parentheses applies that color to all reference
lines drawn with the VREF= option and the AUTOVREF option
1104
PLOT Statement
Chapter 37
3 specifying a single color within parentheses applies the color to the rst
reference line drawn with the VREF= option only 3 specifying a list of colors within parentheses applies the colors sequentially to the reference lines drawn with the VREF= option only
Alias:
CV=
Style reference: ContrastColor attribute of the GraphReference element Restriction: Not supported by Java DESCRIPTION=entry-description
species the description of the catalog entry for the chart. The maximum length for entry-description is 256 characters. This description does not appear on the chart. The GCONTOUR procedure assigns a description of the form PLOT OF y*x=z, where y*x=z is the request specied in the PLOT statement. Alias: DES=
GRID
draws reference lines at all major tick marks on both axes. This is the same as specifying both the AUTOHREF and AUTOVREF options. Restriction: Not supported by Java
HAXIS=AXIS<1...99>
assigns axis characteristics from the corresponding axis denition to the horizontal x axis. If the AXIS statement species the REFLABEL= option, labels are applied in sequence to all reference lines generated with the HREF= option. Featured in: Example 2 on page 1116 Restriction: Partially supported by Java and ActiveX See also: AXIS Statement on page 196
HMINOR=number-of-minor-tick marks
species the number of minor tick marks to draw between each major tick mark on the horizontal x axis. The HMINOR= option overrides the MINOR= option in an AXIS denition assigned to the horizontal axis. Alias: HM= Featured in: Example 3 on page 1118
HREF=value-list
displays up to 100 reference lines originating on the horizontal x axis at specied values within the x axis range. Any values specied beyond the axis range are not drawn, and a warning is issued to the log. To specify labels for this option, use the HAXIS= option. The value-listcan be an explicit list of values, a starting value and an ending value with an interval increment, or a combination of both forms: 3 n <... n>. 3 n TO n <BY increment >. 3 n <... n > TO n <BY increment > n <... n >.
Restriction: Not supported by Java HREVERSE
species that the order of the values on the horizontal x axis be reversed. Restriction: Not supported by Java
JOIN
combines adjacent grid cells with the same pattern to form a single pattern area. This option is ignored unless the PATTERN option is also used. Note: Java and ActiveX support the JOIN option without the pattern option.
PLOT Statement
1105
LAUTOHREF=reference-line-type
species a line type for reference lines specied by the AUTOHREF option. The reference-line-type value is any integer from 1 to 46. 1 species a solid line; values 2 through 46 specify dashed lines.
Default: 1 (solid) Style reference: LineStyle attribute of the GraphGridLines element Restriction: Not supported by Java See also:
LAUTOVREF=reference-line-type
species a line type for reference lines specied by the AUTOVREF option. The reference-line-type value is any integer from 1 to 46. 1 species a solid line; values 2 through 46 specify dashed lines.
Style reference: LineStyle attribute of the GraphGridLines element Restriction: Not supported by Java See also:
LEGEND=LEGEND<1...99>
assigns legend characteristics from the corresponding legend denition to the plots legend. To suppress the legend, use the NOLEGEND option. The LEGEND= option is ignored if the specied LEGEND denition is not currently in effect. If you use the SHAPE= option in a LEGEND statement, the value LINE is valid. If you use the PATTERN option, SHAPE=BAR is also valid.
Restriction: Partially supported by Java (always displayed on the right side of plot)
and ActiveX
See also: LEGEND Statement on page 223 Featured in:
LEVELS=value-list
species up to 100 values for the z variable. Because GCONTOUR uses the z variable to calculate plot contour levels, you can use the LEVELS= option to change the number of contour levels plotted. The value-list can be an explicit list of values, a starting and an ending value with an interval increment, or a combination of both forms:
3 n <... n>. 3 n TO n <BY increment >. 3 n <... n > TO n <BY increment > n <... n >.
If a variable has an associated format, the specied values must be the unformatted values. The contour lines on the plot represent the intersection of a plane formed by the (x,y) variables, and the surface that is formed by the values of the z variable.
LHREF=reference-line-type | (reference-line-type) | reference-line-type list
species line types for reference lines originating on the horizontal axis. The reference-line-type value is any integer from 1 to 46. 1 species a solid line; values 2 through 46 specify dashed lines. When using this option, the following is true:
3 specifying a single line type without parentheses applies that line type to all
reference lines drawn with the HREF= option and the AUTOHREF option
3 specifying a single line type within parentheses applies the line type to the rst
reference line drawn with the HREF= option only
3 specifying a list of line types within parentheses applies the line types
sequentially to the reference lines drawn with the HREF= option only
1106
PLOT Statement
Chapter 37
LH=
Style reference: LineStyle attribute of the GraphReference element Restriction: Not supported by Java and partially supported by ActiveX See also: Specifying Line Types on page 275 for available line types LJOIN
lists line types for plot contour lines. Each line type represents one contour level. If fewer line types are specied than the number of levels in the plot, GCONTOUR provides additional line types. Valid values for line-type-list are integers from 1 to 46. 1 species a solid line; values 2 through 46 specify dashed lines.
Default: 1 (solid) Restriction: Not supported by Java and partially supported by ActiveX See also:
Specifying Line Types on page 275 for the line types represented by each number. Example 3 on page 1118.
Featured in:
species line types for reference lines originating on the vertical axis. Valid values for line-type-list are integers from 1 to 46. 1 species a solid line; values 2 through 46 specify dashed lines. When using this option the following is true:
3 specifying a single line type without parentheses applies that line type to all
reference lines drawn with the VREF= option and the AUTOVREF option
3 specifying a single line type within parentheses applies the line type to the rst
reference line drawn with the VREF= option only
3 specifying a list of line types within parentheses applies the line types
sequentially to the reference lines drawn with the VREF= option only
LV=
Style reference: LineStyle attribute of the GraphReference element Restriction: Partially supported by Java and ActiveX See also:
Specifying Line Types on page 275 for the line types represented by each number
NAME="name"
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase. Periods are converted to underscores. If you specify DEVICE=ACTIXIMG or DEVICE=JAVAIMG, then the name that you specify is used for the graphics output le even if the le exists. If the name duplicates an existing GRSEG name, then SAS/GRAPH adds a number to the name to create a unique entry namefor example, GCONTOU1.
Default: GCONTOUR Featured in:
PLOT Statement
1107
NLEVELS=number-of-levels
species the number of contour levels to plot. Valid values are integers from 1 to 100.
Restriction Partially supported by Java and ActiveX Featured in: NOAXIS
species that a plot have no axis values, axis labels, or axis tick marks. The frame is displayed around the plot unless you use the NOFRAME option. Alias: NOAXES
Restriction Partially supported by Java NOFRAME
suppresses the legend that describes the plot by displaying the z variable name or label, the legend values, and legend value descriptions.
Default: LEGEND PATTERN
species that the plot contour levels are represented by rectangles lled with patterns. The pattern for each rectangle is determined by calculating the mean of the values of the z variable for the four corners of the rectangle and assigning the pattern for the level closest to the mean. To explicitly dene patterns, use PATTERN denitions for map or plot patterns.
Featured in:
assigns axis characteristics from the corresponding axis denition to the vertical yaxis. If the AXIS statement species the REFLABEL= option, labels are applied in sequence to all reference lines generated with the VREF= option. Restriction: Partially supported by Java and ActiveX
See also: AXIS Statement on page 196 Featured in:
VMINOR=number-of-minor-tick marks
species the number of minor tick marks located between each major tick mark on the vertical y axis. Value labels are not displayed for minor tick marks. The VMINOR= option overrides the MINOR= option in an AXIS denition that is assigned to the vertical axis.
Alias:
Featured in:
1108
PLOT Statement
Chapter 37
VREF=value-list
displays up to 100 reference lines originating on the vertical y axis at specied values within the y axis range. Any values specied beyond the axis range are not drawn, and a warning is issued to the log. To specify labels for these reference lines, use the VAXIS= option. The value-listcan be an explicit list of values, a starting value and an ending value with an interval increment, or a combination of both forms:
3 n <... n>. 3 n TO n <BY increment >. 3 n <... n > TO n <BY increment > n <... n >.
Restriction: Not supported by Java VREVERSE
species that the order of the values on the vertical axis be reversed.
Restriction Not supported by Java WAUTOHREF=reference-line-width
species a line width for reference lines specied by the AUTOHREF option. The reference-line-width can be any number greater than zero, and does not need to be an integer.
Default: Current style setting, 1 if NOGSTYLE Style reference: LineThickness attribute of the GraphGridLines element Restriction: Not supported by Java and ActiveX WAUTOVREF=reference-line-width
species a line width for reference lines specied by the AUTOVREF option. The reference-line-widthcan be any number greater than zero, and does not need to be an integer.
Default: Current style setting, 1 if NOGSTYLE Style reference: LineThickness attribute of the GraphGridLines element Restriction: Not supported by Java and ActiveX WHREF=reference-line-width
species a line width for reference lines specied by the HREF= option. The reference-line-width can be any number greater than zero, and does not need to be an integer.
Default: Current style setting, 1 if NOGSTYLE Style reference: LineThickness attribute of the GraphReference element Restriction: Not supported by Java and ActiveX WVREF=reference-line-width
species a line width for reference lines specied by the VREF= option. The reference-line-width can be any number greater than zero, and does not need to be an integer.
Default: Current style setting, 1 if NOGSTYLE Style reference: LineThickness attribute of the GraphReference element Restrictions:
XTICKNUM=number-of-major-tick-marks
species the number of major tick marks on the horizontal x axis. The value of number-of-major-tickmarks must be greater than or equal to 2. The MAJOR= and ORDER= options in an AXIS denition that is assigned to the horizontal x axis overrides the XTICKNUM= option.
PLOT Statement
1109
YTICKNUM= number-of-major-tick-marks
species the number of major tick marks on the vertical y axis. The value of number-of-major-tick-marks must be greater than or equal to 2. The MAJOR= and ORDER= options in an AXIS denition that is assigned to the vertical y axis overrides the YTICKNUM= option.
Autolabel Suboptions
The AUTOLABEL= option accepts the following autolabel suboptions. CHECK=checking-factor | NONE species a collision checking factor that controls collisions between contour label text and other contour lines or other labels. Values can be integers from 0 to 100, inclusive, where 0 provides minimal collision checking and 100 provides maximal collision checking. Fractional values are permitted. CHECK=NONE suppresses contour label collision checking and can lessen the time needed to compute the contour plot. Default: 75 MAXHIDE=amount <units> species the maximum amount of the contour line that can be hidden by contour labels. The value of amountmust be greater than zero. Valid units are CELLS (horizontal character cell positions), CM (centimeters), IN (inches), or PCT (percentage of the width of the graphics output area). If you omit units , a unit specication is searched for in this order: 1 The GUNIT= option in a GOPTIONS statement. 2 The default unit, CELLS. For units that you specify as PCT or CELLS, the MAXHIDE= suboption calculates the amount of contour line that can be hidden based on the width of the graphics output area. For example, if you specify MAXHIDE=50 PCT, and if the graphics output area is 9 inches wide, the maximum amount of the contour line that can be hidden by labels is 4.5 inches. This option maintains data integrity. It provides a check for overly small increments in the STEP= option in the SYMBOL statement. Additionally, the MAXHIDE= option can prevent small contours from being signicantly hidden even when the value of the STEP= option is sufciently large. Default: MAXHIDE=100 REVEAL species that the contour lines are visible through the label text as dashed lines. Line style 33 is used. This option provides a simple way to see all portions of labeled contours, and can be used to inspect the label positions with respect to the contour lines. The REVEAL option is primarily used for debugging. Occasionally, single-character contour labels can be placed off center from the clipped portion of the contour line when the contour line is irregular or jagged. TOLANGLE=angle species the maximum angle (the tolerance angle) between any two adjacent characters of a contour label. The value of angle must be between 1 and 85 degrees. To force contour labels to fall on very smooth sections, specify a small tolerance angle. Default: 30
1110
PLOT Statement
Chapter 37
The LEVELS= option represents the z variable values as a third dimension, using uniquely colored contour lines.
Figure 37.2
Using the PATTERN option with the LEVELS= option generates a plot with contour levels that are displayed as solid lled rectangles. The rectangles are formed by points in the (x, y)grid. The contour pattern of a rectangle, or grid cell, is determined by average value of the z variable for the four corners of the rectangle. The grid cell is assigned the pattern for the level closest to the calculated mean. For example, if you have specied contour levels of 0, 5, and 10, and the plot contains a grid cell with a mean of 100, it is assigned the pattern for the nearest level: 10. A grid cell with a mean of 7.6 is also assigned the pattern for the 10 level. The same data used with the following PLOT statement in the GCONTOUR procedure produces a similar contour plot:
plot y*x=z / levels=-7.5 to 7.5 by 2.5/ pattern; run;
The following contour plot with the PATTERN option uses the same data and contour levels as Example 4 on page 1120. Contour plots using the same contour levels can present your data differently, if one plot uses a pattern and the other does not. The contour pattern boundaries do not correspond to the contour lines shown in Example 4 on page 1120.
PLOT Statement
1111
Figure 37.3
Using the data to create a surface plot with the G3D procedure, the contour lines in a GCONTOUR procedure plot represent the intersection of the plane and the surface. For example, suppose that you use the G3D procedure, and your data produces a surface plot like the one shown below. The contour lines represent the intersection of the surface lines with the plane parallel to the plane formed by the variables x and y and located at z values of 7.5, 5.0, 2.5, and so on.
Figure 37.4
1112
PLOT Statement
Chapter 37
Suppose also that the horizontal axis variable has these values: 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5. Depending on the data, contours could extend through the full range of the ORDER= list rather than from 2 to 2, which are the actual values of the variable assigned to the horizontal (x) axis. In this case, values are interpolated for the x variable at any point where the y variable intersects the minimum axis value (2.5) or the maximum axis value (2.5). Data values that are outside of the axis range (in this case, 5, 4, 3, 3, 4, and 5) are clipped from the plot. When ORDER= lists cause data clipping, internal plotting grids are modied according to these rules: 3 If an ORDER= list causes data clipping on a single axis, linear interpolation generates the z values of the starting or ending column, or both columns of the plotting grid. For example, in the previous example, the value of z is interpolated for 2.5 and 2.5 on the horizontal (x) axis.
3 If ORDER= lists cause data clipping on both axes, the response variable values of
the new corners are derived by tting the new x, y location on a plane formed by three of the original four points of the corresponding grid square.
3 When assigning the following AXIS denition to a plot of the same data, the
contour levels on the plot do not extend beyond the range of the data:
axis1 order=-10 to 10 by 1;
PLOT Statement
1113
Figure 37.5
The ORDER= option, values match the range of the data values
Figure 37.6
1114
PLOT Statement
Chapter 37
The ORDER= option, values extend beyond the range of the data
SYMBOL Statement Option LINE=line-type WIDTH=n CI=line-color or COLOR=color FONT=font HEIGHT=height CV=color or COLOR=color STEP=distance<units> VALUE=text VALUE=NONE
1115
The SYMBOL statement option INTERPOL= is not supported by the GCONTOUR procedure. The STEP= option species the minimum distance between contour labels. The lower the value, the more labels the procedure uses. A STEP= value of less than 10 percent is ignored by the GCONTOUR procedure and a value of 10 percent is substituted. For more information, see SYMBOL Statement on page 250.
You must specify both FONT= and VALUE= options or the text is not used. For an example, see Example 2 on page 1116.
Examples
This simple contour plot displays the various depths of a lake. The dimensions of the lake are plotted on the x and y axes. The z variable is plotted as the third dimension, as
1116
Example 2: Labeling Contour Lines, Modifying the Horizontal Axis, Modifying the Legend
Chapter 37
levels represented by contour lines. The contour line levels are displayed and labeled in the legend.
Set the graphics environment. Draw a BORDER around the graphics output area.
goptions reset=all border;
Dene titles and footnotes. Add TITLE content. Add FOOTNOTE content and placement.
title "Lake Data"; footnote j=r "GCTLAKE";
Generate contour plot. Generate a simple contour plot using SASHELP.LAKE. Use one PLOT statement to dene the grid and the contour lines.
proc gcontour data=sashelp.lake; plot length*width=depth; run; quit;
Example 2: Labeling Contour Lines, Modifying the Horizontal Axis, Modifying the Legend
AUTOLABEL, HAXIS, LEGEND SASHELP.LAKE Sample library member: GCTLABEL
Procedure features: Data Set
Example 2: Labeling Contour Lines, Modifying the Horizontal Axis, Modifying the Legend
1117
This example modies Example 1 on page 1115 to label contour levels with the AUTOLABEL option. The SYMBOL statement used with the AUTOLABEL option enables you to customize the attributes of the contour lines and labels. In this example, SYMBOL1 and SYMBOL7 assign text labels, text fonts, text height, and text and line color for the rst and seventh contour level lines. SYMBOL2SYMBOL6 dene the text height, and the text and line color for contour level lines 26. Additionally, the LEGEND statement attributes are modied to reposition the legend closer to the data.
Set the graphics environment. Draw a BORDER around the graphics output area.
goptions reset=all border;
Dene title and footnote. Add TITLE content . Add FOOTNOTE content and placement.
title1 "Lake Data"; footnote1 j=r "GCTLABEL";
Dene symbol statements. SYMBOL statements dene the characteristics of the lines and labels for the contour lines. Each SYMBOL statement is associated to an individual contour level starting with the rst level displayed in the LEGEND.
symbol1 value="DEEP" color=red font="Arial Rounded MT Bold" height=.6; symbol2 color=green height=.45; symbol3 color=blue height=.45; symbol4 color=orange height=.45; symbol5 color=purple height=.45; symbol6 color=magenta height=.45; symbol7 value="Shallow" color=navy font="Arial Rounded MT Bold" height=.7;
Dene legend characteristics. The LEGEND statement controls the location and appearance of the legend. The POSITION= option species the position of the legend relative to the plot; RIGHT species the horizontal position; MIDDLE species the vertical position. The LABEL= option modies the legend label; POSITION=TOP places the legend label relative to the legend entries; the ACROSS= option denes the number of columns in the legend.
legend1 position=(right middle) label=(position=top) across=1;
1118
Chapter 37
Dene axis characteristics. The ORDER= option species the order in which the data values appear on the axis; the ORDER= values will be displayed as the major tick marks values; MINOR=NONE suppresses all minor tick marks.
axis1 order=(0 to 10 by 2) minor=none;
Generate the contour plot. The AUTOLABEL= option labels the contour lines; (CHECK=NONE) suppresses contour label collision checking, and might lessen the time needed to compute the plot. HAXIS=AXIS1 assigns the AXIS1 denition to the horizontal axis. LEGEND=LEGEND1 assigns the LEGEND1 denition to the LEGEND. The NAME= option species the name of the catalog entry for the graph.
proc gcontour data=sashelp.lake; plot length*width=depth/ autolabel=(check=none) haxis=axis1 legend=legend1 name="GCTLABEL"; run; quit;
POLLEN
1119
This contour plot shows the amount of pollen in the air for ve work days (xaxis) in a four week series (y-axis). The PLOT statement uses the NLEVELS= option to specify the number of contour levels to plot for the z variable. The NLEVELS= option enables you to specify up to 100 levels in your plot.
Set the graphics environment. Draw a border around the graphics output area.
goptions reset=all border;
Add titles and footnotes. Add TITLE content. Add FOOTNOTE content and placement
title1 "The Amount of Pollen Particles in a Cubic Meter of Air"; footnote1 j=r "GCTNLVEL";
Dene an axis statement for the vertical axis. Dene an AXIS statement to order and increment the axis values.
axis1 order=(1 to 4 by 1);
Generate the contour plot. HMINOR=0 sets the number of minor tick marks on the horizontal axis to 0. The LLEVELS= option lists a line type for each contour line. The number of line types listed correspond to the number of contour levels specied in the NLEVELS= option. NLEVELS=6 species the number of levels to compute for z. The NAME= option species the name of the catalog entry for the plot. The VAXIS= option assigns the AXIS1 statement to the vertical axis. VMINOR=0 sets the number of minor tick marks on the vertical axis to 0.
proc gcontour data=pollen; plot week*workdays=pollen/ hminor=0 llevels= 2 20 21 33 25 41 name="GCTNLVEL" nlevels=6 vaxis=axis1 vminor=0; run; quit;
1120
Chapter 37
SWIRL
This example demonstrates the differences between using lines and patterns to represent contour levels. The rst PLOT statement generates a plot with lines representing contour levels.
Figure 37.8
The second PLOT statement species the PATTERN option to ll and color contour levels. Additional PLOT statement options outline lled areas in gray and specify green text for all text on the axes and in the legend.
1121
Figure 37.9
The third PLOT statement uses the JOIN option to combine adjacent grid cells with the same pattern to form a single pattern area. Additional options enhance the plot by modifying the axes and framing the legend.
Figure 37.10
Set the graphics environment.Draw a border around the graphics output area.
goptions reset=all border;
1122
Chapter 37
Crate the data set. The data set SWIRL is generated data that produces a symmetric contour pattern, which is useful for illustrating the pattern option.
data swirl; do x= -5 to 5 by 0.25; do y= -5 to 5 by 0.25; if x+y=0 then z=0; else z=(x*y)*((x*x-y*y)/(x*x+y*y)); output; end; end; run;
Dene the title and the footnote. Add TITLE content. Add FOOTNOTE content, and placement.
title1 "Line Contour Levels"; footnote1 j=r "GCTPATR1";
Dene the title and footnote for the second plot. Add TITLE content for the second plot. Add FOOTNOTE content and placement for the second plot.
title1 "Pattern Contour Levels"; footnote j=r "GCTPATR2";
Generate the second contour plot. CTEXT=green species green for all text on the axes and legend. COUTLINE=gray species gray outlining of lled areas. The PATTERN option species the ll pattern and colors for the contour levels.
proc gcontour data=swirl; plot y*x=z / ctext=green coutline=gray pattern; run; quit;
References
1123
Dene the title and footnote for the third plot. Add TITLE content for the third plot. Add FOOTNOTE content and placement for the third plot.
title "Contour Plot with Joined Cells"; footnote j=r "GCTPATR3";
Dene the axis characteristics. Blanks are used to suppress tick mark labels at positions -2.5 and 2.5.
axis1 label=none value=("-5" "0" "5") color=red width=3; axis2 label=none value=("-5" "0" "5") color=red width=3;
Generate the third contour plot. The HAXIS=AXIS1 option assigns an axis denition to the horizontal axis. The JOIN= option combines adjacent grid cells with the same pattern to form a single pattern area. LEGEND=LEGEND1 assigns the legend denition. The PATTERN option species the ll pattern and colors for the contour levels. VAXIS=AXIS2 assigns an axis denition to the vertical axis.
proc gcontour data=swirl; plot y*x=z / haxis=axis1 join legend=legend1 pattern vaxis=axis2; run; quit;
References
Snyder, W.V. (1978), Contour Plotting [J6] , ACM Transactions on Mathematical Software, 4, 290294.
1124
1125
CHAPTER
38
The GDEVICE Procedure
Overview 1126 Concepts 1126 Device Catalogs 1126 The Current Catalog 1126 Search Order of Device Catalogs 1127 Ways to Use the GDEVICE Procedure 1127 Running the GDEVICE Procedure In A Windowing Environment Running the GDEVICE Procedure In Program Mode 1128 Procedure Syntax 1128 PROC GDEVICE Statement 1129 ADD Statement 1129 COPY Statement 1132 DELETE Statement 1133 FS Statement 1134 LIST Statement 1134 MODIFY Statement 1135 QUIT Statement 1135 RENAME Statement 1136 Using the GDEVICE Procedure 1136 Using the GDEVICE Windows 1136 GDEVICE Window Commands 1137 DIRECTORY Window 1137 Detail window 1138 Parameters window 1138 Gcolors window 1139 Chartype window 1139 Colormap window 1139 Metagraphics window 1140 Gprolog window 1140 Gepilog window 1140 Gstart window 1141 Gend window 1141 Host File Options window 1141 Host Commands window 1141 Creating or Modifying Device Entries 1142 Creating a New Device Entry 1142 Modifying an Existing Device Entry 1142 Changing Device Parameters Temporarily 1143 Examples 1143 Example 1: Creating a Custom Device Entry with Program Statements
1127
1143
1126
Overview
Chapter 38
Overview
The GDEVICE procedure is a tool for examining and changing the parameters of the graphics device driver catalog entries used with SAS/GRAPH software. With the GDEVICE procedure, you can use either the GDEVICE windows or GDEVICE procedure statements to:
3 3 3 3
list the device entries stored in any DEVICES catalog view the parameters for any device entry create and modify new device entries copy, modify, rename, or delete existing device entries.
See Chapter 6, Using Graphics Devices, on page 67 for a discussion of device drivers and device entries, as well as directions for selecting device drivers, and changing the settings of device parameters. For a complete list of SAS supplied device entries that are supported by your operating environment, see the SASHELP.DEVICES catalog.
Concepts
Device Catalogs
Device entries are stored in SAS catalogs that are named libref.DEVICES. Device entries for your operating environment that SAS supplies with SAS/GRAPH software are stored in the SASHELP.DEVICES. Custom device entries are typically stored in a catalog named GDEVICEn.DEVICES (where n can be any number from 0 to 9). However, device entries that have been created or modied by a system administrator specically for your site also might be stored in SASHELP.DEVICES. (On multi-user systems, the administrator is usually the person who has write access to the SASHELP.DEVICES catalog.)
statement
2 the catalog associated with the GDEVICE0 libref, if the libref has been assigned 3 the catalog SAS supplies, SASHELP.DEVICES. (SASHELP.DEVICES is usually
write-protected and is opened in browse mode.) The rst catalog SAS encounters is the current catalog. Specify the current catalog by;
3 using the CATALOG= option in the PROC GDEVICE statement (this is required
to open a driver entry in update mode)
1127
3 browse or edit the elds in the GDEVICE procedure windows (windowing mode).
See Running the GDEVICE Procedure In A Windowing Environment on page 1127 3 submit GDEVICE procedure statements in a SAS program (program mode). See Running the GDEVICE Procedure In Program Mode on page 1128 If you run SAS in a windowing environment, you can use either the GDEVICE procedure windows or the GDEVICE procedure statements. In a windowing environment, the GDEVICE procedure automatically opens the GDEVICE procedure windows If you run SAS in line mode or batch mode, you can use only GDEVICE procedure statements. In a non-windowing environment, the GDEVICE procedure automatically uses line mode. Both methods provide identical functionality and allow you to display or modify device parameters or create new device entries.
This opens the DIRECTORY window in browse mode. This window lists all of the device entries in the current catalog. (See The Current Catalog on page 1126.) To open the DIRECTORY window in edit mode, or to specify a different catalog, include the CATALOG= option in the PROC GDEVICE statement.
1128
Procedure Syntax
Chapter 38
From the DIRECTORY window, you can select the device entry that you want to work with and open other GDEVICE windows in which you can view or modify device parameters. For more information, see Using the GDEVICE Windows on page 1136. In a windowing environment, you can switch between the GDEVICE windows and program statements while you are running the procedure. See FS Statement on page 1134 and the NOFS option in PROC GDEVICE Statement on page 1129. To exit the GDEVICE windows, submit the End command or close the window.
By default, the GDEVICE procedure accesses the current catalog in browse mode and prompts you in the LOG to enter additional program statements. (See The Current Catalog on page 1126.) To specify the current catalog, include the CATALOG= option in the PROC GDEVICE statement. Once you start the GDEVICE procedure, you can enter and run additional statements without resubmitting the PROC GDEVICE statement. You can exit the GDEVICE procedure in these three ways:
3 submit the END, QUIT, or STOP statement 3 submit another PROC statement or DATA step 3 exit your SAS session
PROC GDEVICE procedure output is displayed in the Output window.
Procedure Syntax
Requirements: Statements other than the PROC GDEVICE statement can be used only in a non-windowing or batch environment. In these environments, at least one statement is required to give GDEVICE an action to perform. In a windowing environment, the PROC GDEVICE statement is required. In program mode, at least one statement is required. Note: You must have write access to the device catalog in order to modify, add, or delete entries.
PROC GDEVICE <CATALOG=<libref.>SAS-catalog> <BROWSE> <NOFS>; ADD new-device-entry required-parameters <optional-parameters>; COPY device-entry <FROM=< libref.>SAS-catalog> <NEWNAME=new-device-entry>; DELETE device-entry; FS;
ADD Statement
1129
LIST device-entry | _ALL_ | _NEXT_ | _PREV_ | DUMP>; MODIFY device-entry parameter(s) QUIT | END | STOP; RENAME device-entry NEWNAME=entry-name;
Options
Options used in the PROC GDEVICE statement affect the way you use the procedure. They specify how to open the catalog.
BROWSE
opens a catalog in browse mode. You cannot modify a catalog when you open it with the BROWSE option. If you are running in program mode when you use BROWSE, you can use only the FS, LIST, QUIT, END, or STOP statements.
CATALOG=<libref.>SAS-catalog CAT=<libref.>SAS-catalog C=<libref.>SAS-catalog
species the catalog containing device information. If you do not specify a catalog, the procedure opens the rst catalog found in the search order of catalogs in browse mode. For search order of source catalogs, see Search Order of Device Catalogs on page 1127. To edit the device entries in a catalog, you must specify the CATALOG= option.
NOFS
species that you are using program mode. In windowing environments, the GDEVICE windows are the default, and you must specify NOFS to start GDEVICE in program mode.
ADD Statement
Adds a new device entry to the catalog selected by the CATALOG= option in the PROC GDEVICE statement. The device entry is initialized with NULL values for most parameters.
Requirements: You must have write access to the device catalog in order to add entries, and use CATALOG= in the PROC GDEVICE statement. Restriction: Not valid in browse mode.
1130
ADD Statement
Chapter 38
required-parameters are all of these parameters: MODULE=driver-module XMAX=width <IN | CM> YMAX=height <IN | CM> XPIXELS=width-in-pixels YPIXELS=height-in-pixels plus one or both of these parameter pairs: LCOLS=landscape-columns LROWS=landscape-rows or PCOLS=portrait-columns PROWS=portrait-rows optional-parameters can be one or more of these options: ASPECT=scaling-factor AUTOCOPY=Y | N AUTOFEED=Y | N CBACK=background-color CELL=Y | N CHARACTERS=Y | N CHARREC=(charrec-list(s)) CHARTYPE=hardware-font-chartype CIRCLEARC=Y | N CMAP=(from-color : to-color <...,from-color-n : to-color-n>) COLORS=(<colors-list>) COLORTYPE=NAME | RGB | HLS | GRAY | CMY | CMYK | HSV | HSB DASH=Y | N DASHLINE=dashed-line-hex-stringX DESCRIPTION=text-string DEVMAP=device-map-name | NONE DEVOPTS=hardware-capabilities-hex-stringX DEVTYPE=device-type DRVINIT1=system-command(s) DRVINIT2=system-command(s) DRVQRY | NODRVQRY DRVTERM1=system-command(s) DRVTERM2=system-command(s) ERASE=Y | N FILECLOSE=DRIVERTERM | GRAPHEND FILL=Y | N FILLINC=0...9999
ADD Statement
1131
FORMAT=CHARACTER | BINARY GACCESS=output-format | output-format > destination GCOPIES=current-copies GEND=string <...string-n> GEPILOG=string <...string-n> GPROLOG=string <...string-n> GPROTOCOL=module-name GSFLEN=record-length GSFMODE=APPEND | REPLACE | PORT GSFNAME=leref GSIZE=lines GSTART=string <...string-n> HANDSHAKE=HARDWARE | NONE | SOFTWARE | XONXOFF HEADER=command HEADERFILE=leref HORIGIN=horizontal-offset <IN | CM> HOSTSPEC=text string HSIZE=horizontal-size <IN | CM> ID=description INTERACTIVE=USER | GRAPH | PROC LFACTOR=line-thickness-factor MAXCOLORS=number-of-colors MAXPOLY=number-of-vertices MODEL=model-number NAK=negative-handshake-responseX PAPERFEED=feed-increment <IN | CM> PATH=angle-increment PENSORT=Y | N PIEFILL=Y | N POLYGONFILL=Y | N POSTGRAPH1=system-command(s) POSTGRAPH2=system-command(s) PREGRAPH1=system-command(s) PREGRAPH2=system-command(s) PROCESS=command PROCESSINPUT=leref PROCESSOUTPUT=leref PROMPT=0...7 PROMPTCHARS=prompt-chars-hex-stringX QMSG | NOQMSG RECTFILL=rectangle-ll-hex-stringX REPAINT=redraw-factor ROTATE=LANDSCAPE | PORTRAIT ROTATION=angle-increment pen-speed
1132
COPY Statement
Chapter 38
SWAP=Y | N SYMBOL=Y | N SYMBOLS=hardware-symbols-hex-stringX TRAILER=command TRAILERFILE=leref TRANTAB=table | user-dened-table TYPE= CAMERA | CRT | EXPORT | PLOTTER | PRINTER UCC=control-characters-hex-stringX VORIGIN=vertical-offset <IN | CM> VSIZE=vertical-size <IN | CM>
Required Arguments
new-device-entry
species the one-level name of the new device entry. New-device-entry must be a valid name for a SAS catalog entry for your operating environment and cannot already exist in the current catalog.
required-parameters
specify the required parameters for the device. All of the required parameters for the ADD statement correspond to device parameters of the same name. Refer to Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a description of each parameter.
Options
All optional parameters for the ADD statement correspond to device parameters of the same name. Refer to Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a description of each parameter. Note: The COLORS= device parameter is not required; the device entry is created even if you do not specify it. However, the GDEVICE procedure issues an error message if you do not specfy at least one color for the COLORS= option. 4
Best Practice
The best way to add a new driver is to copy an existing driver and modify the parameters. The ADD statement initializes all the parameter values to NULL, and you have to set values for all of the parameters to something other than NULL.
COPY Statement
Copies a device entry and places the copy in the current catalog. The original device entry can be either in the current catalog or in a different catalog.
Requirements:
You must have write access to the catalog where the device entry is being
copied. Not valid in browse mode. See also: Creating or Modifying Device Entries on page 1142 Featured in: Example 1 on page 1143
Restriction:
DELETE Statement
1133
Where where must be one or both of these options: FROM=<libref.>SAS catalog NEWNAME=new-device-entry
Required Arguments
device-entry
species a name for the copy of the device entry that is placed in the current catalog. New-device-entry must be a valid name for a SAS catalog entry and cannot already exist in the current catalog. If you copy device entries across catalogs and you do not specify a new name, the GDEVICE procedure uses the original name for the new device entry.
DELETE Statement
Deletes the device entry from the current catalog.
Requirements: You must have write access to the current catalog to delete a device entry. You must specify the CATALOG= option in the PROC GDEVICE statement to have write access to the current catalog. Restriction:
Caution: A device entry cannot be restored once it has been deleted. Depending on the environment in which you are using the GDEVICE procedure, you might be asked to verify that you really want to delete the entry.
DELETE device-entry;
Required Arguments
device-entry
1134
FS Statement
Chapter 38
FS Statement
Switches from program mode to the GDEVICE windows.
Requirements:
FS;
Options
No options.
LIST Statement
Lists all of the parameters of the specied device entry in the Output window.
Default:
_ALL_
See also: Running the GDEVICE Procedure In Program Mode on page 1128
Options
device-entry
species the one-level name of the device entry whose contents you want to list. Restriction: The entry must exist in the current catalog.
_ALL_
lists only the name, description, and creation date of all device entries in the current catalog. If no entries exist in the catalog, the GDEVICE procedure issues a message.
_NEXT_
lists the contents of the next device entry. The GDEVICE procedure lists the rst entry in the catalog if no entries have been previously listed.
_PREV_
lists the contents of the previous device entry. If you have not previously listed the contents of a device entry, the GDEVICE procedure issues this message:
No objects preceding current object.
DUMP
lists detailed information on all device entries in the current catalog. Depending on the number of device entries in the catalog, the DUMP option can create a large amount of output.
QUIT Statement
1135
MODIFY Statement
Changes the values in a device entry.
Requirements: You must have write access to the current catalog to modify a device entry. You must specify the CATALOG= option in the PROC GDEVICE statement to have write access to the current catalog. Restriction: Not valid in browse mode. See also: Creating or Modifying Device Entries on page 1142 Featured in: Example 1 on page 1143
Required Arguments
device-entry
species the one-level name of the device entry that you want to modify. Restriction: The entry must exist in the current catalog.
parameter(s)
are the parameters you want to modify. These can be any of the parameters listed in the ADD statement, whether listed as required or optional for ADD. See ADD Statement on page 1129 for a complete list. Refer to Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a description of each parameter.
Details
To modify a device entry, create your own catalog and then copy the device entries you need into it. You can then change your personal copies of the device entries without affecting the original drivers in SASHELP.DEVICES. (To copy device entries, use the COPY statement, the COPY command available after you choose Import Device Entry from the DIRECTORY windows File menu, or the CATALOG procedure, which is part of Base SAS.) CAUTION:
Be careful when modifying device entries in program mode. In program mode, you cannot cancel any modications you have just made. To change a value you have modied, you must use another MODIFY statement to replace the original value or reset it to its default. (In the GDEVICE windows, you can type the CANCEL command in the command line to cancel changes you have made to the elds.) 4
QUIT Statement
Saves all modications made to device entries during the procedure. Exits the GDEVICE procedure.
1136
RENAME Statement
Chapter 38
Options
No options.
RENAME Statement
Changes the name of the device entry to the name specied in the statement.
Requirements: You must have write access to the current catalog to rename a device entry. You must specify the CATALOG= option in the PROC GDEVICE statement to have write access to the current catalog. Restriction:
Required Arguments
device-entry
species the one-level name of the device entry that you want to rename.
Restriction: The entry must exist in the current catalog. NEWNAME=entry-name
species the new entry name. Entry-name must be a valid name for a SAS catalog entry and cannot already exist in the current catalog. If the name already exists, the GDEVICE procedure issues an error message.
3 3 3 3 3 3
Directory Window Detail Window Parameters Window Gcolors Window Chartype Window Colormap Window
1137
3 3 3 3 3 3 3
Metagraphics Window Gprolog Window Gepilog Window Gstart Window Gend Window Host File Options Window Host Commands Window
The elds in these windows represent device entry parameters. The GDEVICE windows group the device parameters by topic. When you open a device entry in edit mode, you can modify the elds directly. For a description of each eld, see the corresponding parameter in Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329. For a complete list of device parameters, see ADD Statement on page 1129. Note: The parameters are sometimes an abbreviation of the eld names. For example, in the Detail window, the Driver query eld corresponds to the DRVQRY parameter, and the Queued messages eld corresponds to the QMSG parameter. 4
DIRECTORY Window
This window is displayed when you start the GDEVICE procedure in window mode. It lists all the device entries in the default catalog or the catalog you specied in the PROC GDEVICE statement. You can use it to
3 copy, rename, or delete device entries in the catalog 3 select a device entry whose parameters you want to browse or edit.
You can enter these commands in the Directory window selection eld: B|S open the Detail window and browse (B) or, if you are in edit mode, edit (S) the selected device entry. D delete the selected device entry. You cannot restore a device entry once it has been deleted. E open the Detail window and edit the selected device entry. R rename the device entry or the description, or both. You cannot edit the TYPE and UPDATED elds in the Directory Window.
1138
Chapter 38
Figure 38.1
After the Directory window opens, you can navigate through the GDEVICE windows by selecting the View I Next Screen.
Detail window
This window contains device parameters that control basic characteristics of the device, for example, the size of the graphics output area.
Figure 38.2
Parameters window
This window includes additional device parameters that affect the way graphs are drawn. For example, you can dene the following parameters: 3 whether certain graphics primitives are drawn by your hardware or by SAS/GRAPH 3 whether to feed paper to printers or plotters automatically 3 whether to have SAS/GRAPH prompt you with messages under certain conditions. Note: If the device does not support a hardware characteristic, the catalog entry cannot enable the support. 4
1139
Figure 38.3
Gcolors window
This window lists the colors that the device driver uses by default when the NOGSTYLE option is in effect. When you do not explicitly specify the color of a graphics feature in your program or in a GOPTIONS statement, SAS/GRAPH uses this list to determine what color to use.
Figure 38.4
Chartype window
This window lists the device-resident fonts that the device can use, along with information about the size of the characters. The Chartype value is the value to reference a font in another window. For example, you can enter a Chartype number in the Parameters windows Chartype eld.
Figure 38.5
Colormap window
This window enables you to specify a color map for the device. The FROM eld species the name to assign to the color designated by the color value. The TO eld
1140
Chapter 38
species a predened SAS/GRAPH color name. Once you have dened the color mapping, the new color name is available for use in any color option. For example, map the color name DAFFODIL to the SAS color value PAOY. Specify COLOR=DAFFODIL anywhere the COLOR= option is supported. The driver substitutes the color value PAOY. Contact SAS Technical Support for assistance in determining predened SAS color names.
Figure 38.6 The Colormap Window (partial view)
Metagraphics window
This window is used by all drivers that support multiple color spaces, for example, RGB or CMYK. It is also used if the device entry is a Metagraphics (user-written) driver. Metagraphics drivers are created when a device entry that was provided by SAS cannot be adapted to support your graphics device. For information about Metagraphics drivers, contact SAS Technical Support. CAUTION:
Do not alter the elds in the Metagraphics window unless you are changing the color scheme (colortype) or building a Metagraphics driver. 4
Figure 38.7
Gprolog window
This window enables you to specify one or more hexadecimal strings sent to the device before graphics commands are sent. Additional commands can be sent with the PREGPROLOG= and POSTGPROLOG= graphics options. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for details.
Gepilog window
This window enables you to specify one or more hexadecimal strings that are sent to the device after graphics commands are sent. Additional commands can be sent with
1141
the PREGEPILOG= and POSTGEPILOG= graphics options. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for details.
Gstart window
This window enables you to specify one or more hexadecimal strings that are placed at the beginning of each record of graphics data.
Gend window
This window enables you to specify one or more hexadecimal strings that are placed at the end of each record of graphics data.
Figure 38.8
Figure 38.9
1142
Chapter 38
1143
personal catalog. Change the parameters in the new device entry. See Example 1 on page 1143 for an example of creating a custom device entry.
Examples
Figure 38.10
This example shows how to use GDEVICE procedure statements to modify a device entry by copying the original entry into a personal catalog and changing the device parameters. This example permanently changes the default color list for the WIN device entry.
1144
Chapter 38
Assign the libref GDEVICE0. The LIBNAME statement assigns the libref to the aggregate le storage location that contains (or will contain) the DEVICES catalog.
libname gdevice0 "SAS-data-library";
Start the GDEVICE procedure. NOFS causes GDEVICE to use program mode. CATALOG= assigns GDEVICE0.DEVICES as the current catalog. If the DEVICES catalog does not already exist in the library, it is automatically created.
proc gdevice nofs catalog=gdevice0.devices;
Copy the original device entry from SASHELP.DEVICES to the current catalog. The NEWNAME= option species a name for the copy of WIN that is placed in GDEVICE0.DEVICES. The name of a catalog entry cannot exceed eight characters.
copy win from=sashelp.devices newname=mypscol;
Modify the new entry. The DESCRIPTION= option species a new device description that appears in the catalog listing. The COLORS= option denes a new color list.
modify mypscol description="WIN with new color list" colors=(black cx95c051 cxA359B2 cxD65259 cx69D6D2 cxFFB74F cx929cff);
Test the new device entry. The TARGET= option species the new device. The GDEVICE0 libref is already dened, so SAS/GRAPH searches GDEVICE0 for the specied device entry. The GHART procedure generates a pie chart with the new color list.
goptions target=mypscol; proc gchart data=sashelp.class; pie age/discrete noheading; run; quit;
1145
Figure 38.11
1146
1147
CHAPTER
39
The GEOCODE Procedure
Overview 1147 Concepts 1149 Output Data Sets 1149 The SASHELP.ZIPCODE Data Set 1149 Alternate Lookup Data Sets 1150 U.S. Military ZIP Codes 1151 Data Sets for Range Geocoding 1151 %GCDMEL9 Autocall Macro 1151 Overview of the %GCDMEL9 Autocall Macro 1151 Usage Example for the %GCDMEL9 Autocall Macro 1152 %MAXMIND Autocall Macro 1152 Overview of the %MAXMIND Autocall Macro 1152 Usage Example for the %MAXMIND Autocall Macro 1153 Optimizing Performance 1153 Overview of Enhancing Performance 1153 Indexing your Lookup Data Sets 1153 Loading Data Sets Into Memory 1154 Procedure Syntax 1154 PROC GEOCODE Statement 1154 Examples 1161 Example 1: Geocoding Using Default Values 1161 Example 2: Adding Additional Variables to the Output Data Set 1162
Overview
Geocoding is the process of adding geographic coordinates (latitude and longitude values) to an address. The coordinates typically represent the center of a ZIP code, a city, an address, or any geographic region. After geocoding, the coordinates can be used to display a point on a map or to calculate distances. Geocoding also enables you to add attributes values such as census blocks to an address. The GEOCODE procedure requires two SAS data sets:
3 An input address data set that contains a variable relating to specic geographic
locations. For example, mailing address variables such as ZIP codes and cities, or custom geographic variables such as sales regions.
3 A lookup data set that associates geographic coordinates with the geocoding
variables in the input data set. By default, the SASHELP.ZIPCODE data set is used when you perform ZIP code or city geocoding. When you perform ZIP+4 geocoding, you must specify an alternate lookup data set.
1148
Overview
Chapter 39
For the RANGE geocoding method, an additional SAS data set is required that identies ranges of IP addresses. A key variable in both the range and lookup data sets is used to associate IP ranges with geographic coordinates. When the GEOCODE procedure nds a match in the lookup data set, it adds the associated coordinates to the observation in the output data set. Longitude is stored as the X variable, and latitude is stored as the Y variable. The following image shows how the GEOCODE procedure obtains coordinates for the output data set by matching the ZIP code in the input data set:
Figure 39.1
The GEOCODE procedure also adds a variable named _MATCHED_ that indicates how the coordinates were found. Possible values for the _MATCHED_ variable are as follows: ZIP ZIP+4 ZIP mean City City mean variable-name None A match was found for the ZIP code. A match was found for the ZIP code and ZIP+4 extension. Multiple observations in the lookup data set matched the ZIP code, and the coordinate values were averaged. A match was found for the city and state. Multiple observations in the lookup data set matched the city and state, and the coordinate values were averaged. For CUSTOM and RANGE geocoding, a variable name indicates that a match was found for that variable. No match was found for the address.
For each observation in the input data set, the GEOCODE procedure attempts to match the address variable value to a value in the lookup data set. For most geocoding methods, the lookup data set is expected to contain only one matching observation. For example, SASHELP.ZIPCODE contains only one observation for each ZIP code. If the lookup data set contains multiple matches, then the rst matching observation is returned, except as noted in the following paragraph. Some geocoding methods do process multiple matches. For example, if you are using ZIP code geocoding and no match is found, then the GEOCODE procedure attempts to nd a matching city-and-state pair. SASHELP.ZIPCODE contains multiple observations for many city-and-state pairs. When a ZIP code is not found in this lookup data set, a matching city-and-state pair is searched for. If one match is found, then the coordinates for the matching pair are used. However, if multiple matches are found, then the
1149
coordinate values for those matches are averaged. If you are using the PLUS4 geocoding option and no match is found for the combined ZIP code and ZIP+4 values, then the GEOCODE procedure searches for the ve-digit ZIP code only. In the RANGE geocoding method, the GEOCODE procedure performs the following two steps to retrieve coordinates for each observation:
1 For each value of the address variable, the GEOCODE procedure attempts to nd
Concepts
CITY
1150
Chapter 39
STATE STATECODE STATENAME COUNTY COUNTYNM MSA AREACODE AREACODES ALIAS_CITY TIMEZONE GMTOFFSET DST PONAME
Two-digit number (FIPS code) for the state or territory Two-letter abbreviation for the state name Full name of the state or territory FIPS county code. Blank for APO/FPO. Name of county or parish. No county for the APO/FPO. Metropolitan Service Area code by common population; no MSA for rural areas Area code for the ZIP code. None for the APO/FPO. Multiple area codes for the ZIP code. None for the APO/FPO. Alternate names for the city. Each name is separated by ||. Time zone for the ZIP code. None for the APO/FPO. Difference (hours) between GMT and time zone for the ZIP code. ZIP code observes Daylight Savings Time: Y is Yes N is No USPS Post Ofce name
When you use ZIP+4 geocoding, you must specify an alternative lookup data set because SASHELP.ZIPCODE does not contain any ZIP+4 values. This data set must contain the following variables: Default Name: ZIP PLUS4 X Y Description: Five-digit ZIP code Four-digit ZIP+4 extension Longitude of the central coordinate Latitude of the central coordinate
You can specify different names for the variables by using options on the PROC GEOCODE statement. For example, the LOOKUPPLUS4 option species the name of the ZIP+4 extension variable in the lookup data set. The ZIP and PLUS4 variables can contain either character data or numeric data. The data type must match the type of the corresponding variable in your input data set.
1151
Note: The character values in your input and lookup data sets do not need to be a case-sensitive match. Character value matching in the GEOCODE procedure is not case sensitive. 4 Additional attribute variables can also be in the alternate lookup data set. You can add these variables to the output data set by using the ATTRIBUTEVAR= option on the PROC GEOCODE statement. You can obtain a lookup data set for ZIP+4 geocoding from the SAS Maps Online Web site at www.sas.com/mapsonline. On the Downloads page, select Geocoding to access the downloads that are related to geocoding. An alternative source for ZIP+4 lookup data is the Geo*Data product from Melissa Data. You can use the %GCDMEL9 autocall macro to convert Geo*Data les to SAS data sets. For more information, see %GCDMEL9 Autocall Macro on page 1151.
For Range geocoding, a lookup data set and a range data set are required. The range data set identies ranges of IP addresses. The lookup data set contains geographic coordinates. Both the range data set and the lookup data set must contain a key variable that identies locations for each IP range. The lookup data set must contain the following variables: 3 a key variable that corresponds to a key variable in the range data set. 3 an X variable that contains the longitude value of the center coordinate. The default variable name is X. 3 a Y variable that contains the latitude value of the center coordinate. The default variable name is Y. The range data set must contain the following variables:
3 a variable that species the beginning value of a range of IP addresses 3 a variable that species the ending value of a range of IP addresses 3 a key variable that corresponds to a key variable in the lookup data set
You can obtain lookup and range data from third-party vendors. One vendor is MaxMind, Inc. at www.maxmind.com. You can use the %MAXMIND autocall macro to convert comma-separated value (CSV) les from MaxMind into SAS data sets. For more information, see %MAXMIND Autocall Macro on page 1152.
1152
Chapter 39
Geo*Data les are available for each state. The les are provided as text les within compressed (ZIP) archives. Melissa Data also provides the PKUNZIP utility to extract the text les. The %GCDMEL9 macro uses the following macro variables: DATASETNAME species the name of the output data set. DATASETPATH species the location where the output data set is created. DATASETLABEL (optional) species a label for the output data set. LIBNAME species the name for a new library that is assigned for the location that you specied in the DATASETPATH macro variable. UNZIPPEDPATH species the location of the extracted Geo*Data les that you want to import. The %GCDMEL9 macro attempts to read all of the text (.txt) les in this directory. WORKPATH (Optional) species the path where temporary les are written. The default path is the path for the WORK library.
the libref ZIP4. The resulting data set is named ZIP4.DELAWARE. The following code imports the data:
/* Define macro variables */ %let UNZIPPEDPATH=C:\Mydata; %let DATASETPATH=C:\Geocode; %let DATASETNAME=Delaware; %let LIBNAME=ZIP4; %let DATASETLABEL=ZIP+4 lookup data for Delaware; /* Submit autocall macro */ %GCDMEL9;
The %MAXMIND macro uses the following macro variables: CSVPATH species the path where the MaxMind CSV les are located. You must extract the les from the ZIP archive before using the %MAXMIND autocall macro.
Optimizing Performance
1153
IPDATAPATH species the path where the output SAS data sets are created. You must have write permissions for this path. CSVBLOCKSFILE species the lename for the CSV le that contains IP address range values. The le that you specify must contain the startIpNum and endIpNum variables. CSVLOCATIONFILE species the lename for the CSV le that contains longitude and latitude values. CSVCOUNTRYFILE (Optional) species the name of the optional MaxMind CSV le that contains country names. WORKPATH (Optional) species the path where temporary les are written. The default path is the path for the WORK library. The %MAXMIND macro creates the CITYBLOCKS and CITYLOCATION data sets in the path that you specied for the IPDATAPATH variable. The libref IPDATA is created automatically for this path.
Optimizing Performance
Overview of Enhancing Performance
Geocoding often requires very large lookup data sets, which can affect the performance of the GEOCODE procedure. You can optimize your geocoding performance by performing the following actions: 3 Index your lookup data sets by using the appropriate variables. 3 Load the lookup data sets into memory by using the SASFILE statement.
1154
Procedure Syntax
Chapter 39
that you convert by using the %GCDMEL9 and %MAXMIND autocall macros are indexed automatically. No modications are needed for any of these data sets. 4 For ZIP+4 geocoding, you should create a simple index on the ZIP variable and a compound index on the ZIP and ZIP+4 variables. For RANGE geocoding, you should sort your lookup data set by the key variable, and then create a simple index with the key variable. You should sort the range data set by the beginning IP address variable, and then create two simple indexes for the beginning and ending IP address variables. For more information, see "Understanding SAS Indexes" in the SAS Language Reference: Concepts.
Procedure Syntax
PROC GEOCODE <option(s)>;
Syntax
PROC GEOCODE <option(s)>; option(s) can be one or more of the following: DATA= address-data-set ZIP | PLUS4 | CITY | RANGE | CUSTOM ADDRESSCITYVAR= character-variable ADDRESSPLUS4VAR= variable ADDRESSSTATEVAR= character-variable ADDRESSVAR= variable ADDRESSZIPVAR= variable ATTRIBUTEVAR= variable-list BEGINRANGEVAR= numeric-variable
1155
ENDRANGEVAR= numeric-variable LOOKUP= lookup-data-set LOOKUPCITYVAR= character-variable LOOKUPKEYVAR= variable LOOKUPPLUS4VAR= variable LOOKUPSTATEVAR= character-variable LOOKUPVAR= variable LOOKUPXVAR= numeric-variable LOOKUPYVAR= numeric-variable LOOKUPZIPVAR= variable NOCITY NOZIP NOSTIMER OUT=output-data-set RANGEDATA= data-set RANGEDECIMAL RANGEKEYVAR= variable
Options
To facilitate converting existing SAS/GIS batch geocoding programs that use the %GCBATCH autocall macro to the GEOCODE procedure, the option name from the %GCBATCH autocall macro is an acceptable alias for most options. For more information, see the SAS/GIS: Spatial Data and Procedure Guide.
DATA= address-data-set
species the SAS data set that contains address observations that you want to geocode. If you do not specify this option, then the most recently created SAS data set is used. Note: The character variables in your input address data set must be left-aligned. That is, the values must not contain leading spaces. You can use the LEFT function in a DATA step to align your data if necessary. 4
ZIP | PLUS4 | CITY | RANGE | CUSTOM
species the geocoding method. This parameter is optional. Specify one of the following: ZIP species the ZIP code geocoding method. The GEOCODE procedure attempts to match the ve-digit ZIP code from the address data set with the lookup data set. If no match is found, then the CITY method is used instead. If multiple CITY matches are found, then the coordinates of the matches are averaged.
Interaction: You can disable the secondary matching by using
1156
Chapter 39
LOOKUPSTATEVAR= LOOKUPZIPVAR= LOOKUPXVAR= LOOKUPYVAR= If your data does not use the default variable names for any of these options, then you must specify the options that do not use the default. The following options are not required if you specify the NOCITY option: ADDRESSCITYVAR= ADDRESSSTATEVAR= LOOKUPCITYVAR= LOOKUPSTATEVAR= PLUS4 species the PLUS4 geocoding method. The GEOCODE procedure attempts to match the ve-digit ZIP code and ZIP+4 extension from the address data set with the lookup data set. If no match is found, then the ZIP method is used instead. If multiple ZIP matches are found, then the coordinates of the matches are averaged.
Interaction: You can disable the secondary matching by using
PLUS4 geocoding also uses the following options: ADDRESSPLUS4VAR= ADDRESSZIPVAR= LOOKUPPLUS4VAR= LOOKUPZIPVAR= LOOKUPXVAR= LOOKUPYVAR= If your data does not use the default variable names for any of these options, then you must specify the options that do not use the default. CITY species the CITY geocoding method. The GEOCODE procedure attempts to match the city and state from the address data set with the lookup data set. Separate city and state variables are required in the address and lookup data sets. If multiple matches are found, then the coordinates of the matches are averaged.
1157
LOOKUPCITYVAR= LOOKUPSTATEVAR= LOOKUPXVAR= LOOKUPYVAR= If your data does not use the default variable names for any of these options, then you must specify the options that do not use the default. RANGE species the RANGE geocoding method. The GEOCODE procedure attempts to match an IP address from the address data set to a range of IP addresses from the range data set. If a match is found, then a key variable is used to match the IP address to a set of coordinates in the lookup data set. Note: This feature is for SAS 9.2 Phase 2 and later.
ADDRESSVAR= BEGINRANGEVAR= ENDRANGEVAR= LOOKUP= LOOKUPKEYVAR= RANGEKEYVAR= If your lookup data set does not use the default variable names for X and Y, then the LOOKUPXVAR= and LOOKUPYVAR= options are required. CUSTOM species the CUSTOM geocoding method. The GEOCODE procedure attempts to match custom variables that you specify by using the LOOKUPVAR= and ADDRESSVAR= variables. Examples include internal sales territories and Metropolitan Statistical Areas (MSA). Requirements: CUSTOM geocoding requires the following options: ADDRESSVAR= LOOKUP= LOOKUPVAR= If your lookup data set does not use the default variable names for X and Y, then the LOOKUPXVAR= and LOOKUPYVAR= options are required.
Default: ZIP Interaction: If you specify more than one method, then the last method that you
specify is used.
ADDRESSCITYVAR= character-variable
species the character variable in the input address data set that contains the city names. Default: CITY
ADDRESSPLUS4VAR= variable
species the variable in the input address data set that contains ZIP+4 extensions. The variable can be either numeric or character, but it must be the same type as the ZIP+4 variable in the lookup data set (LOOKUPPLUS4VAR=).
1158
Chapter 39
species the character variable in the input address data set. This variable contains the two-character postal abbreviation for state (for example, NY).
Default: STATE ADDRESSVAR= variable
species the variable in the address data set that contains non-address input values for CUSTOM and RANGE geocoding. The variable can be character or numeric. This is used together with the LOOKUPVAR option to geocode with unconventional values. Examples include internal sales territories, Metropolitan Statistical Areas (MSA), and Internet IP addresses.
ADDRESSZIPVAR= variable
species the variable in the input address data set that contains the 5-digit ZIP code values. The variable can be either numeric or character, but it must be the same type as the ZIP code variable in the lookup data set (specied by the LOOKUPZIPVAR= option). Note: The values for the ZIP code variable must be ve digits. You can use the Z5. format to prepend leading zeros to any ZIP code values that have fewer than ve digits. 4
Default: ZIP ATTRIBUTEVAR= (variable-1, variable-2, ...variable-n)
lists non-geocoding variables in the lookup data set that are to be added to the output data set. Examples include county, census block, and time zone. Variable names can be separated by commas or spaces. Note: The values for additional attribute variables are not added to observations in output data set where the match type is City mean or ZIP mean. 4 Note: If an attribute variable has the same name as a variable in the address data set, then that variable is not added to the output data set. 4
Example:
ATTRIBUTEVAR=(STATENAME, COUNTYNM)
BEGINRANGEVAR= variable
species the numeric variable in the your range data set that contains the beginning IP address for each range of addresses.
ENDRANGEVAR= variable
species the numeric variable in the your range data set that contains the ending IP address for each range of addresses.
LOOKUP= lookup-data-set
species a SAS data set that associates coordinates with addresses. The data set is searched for observations that match the address observations. The variables that are required for your lookup data set depend on your geocoding method. See Alternate Lookup Data Sets on page 1150. The data set can also include other attribute variables (such as COUNTY, TIME ZONE, AREA CODE) that can be added to the address observation by using the ATTRIBUTEVAR= option. Note: The character variables in your lookup data set must be left-aligned. That is, the values must not contain leading spaces. You can use the LEFT function in a DATA step to align your data if necessary. 4
Default: For the ZIP geocoding method, the SASHELP.ZIPCODE data set is the
default. For other methods, you must specify the LOOKUP= option.
1159
LOOKUPCITYVAR= character-variable
species the character variable in the lookup data set that contain the city names.
Default: CITY LOOKUPKEYVAR= variable
species the key variable for the lookup data set. The values of the key variable correspond to values in the variable that you specify for the RANGEKEYVAR= option. The data type of the key variable must match the variable that you specify for the RANGEKEYVAR= option.
LOOKUPPLUS4VAR= variable
species the variable in the lookup address data set that contains ZIP+4 extensions. The variable can be either numeric or character, but it must be the same type as the ZIP+4 variable in the input address data set (ADDRESSPLUS4VAR=).
Default: PLUS4 LOOKUPSTATEVAR= character-variable
species the character variable in the lookup data set that contains the two-character postal abbreviation for state.
Default: STATECODE LOOKUPVAR= variable
species the variable in the lookup data set that contains non-address values. The variable can be character or numeric. This is used together with the ADDRESSVAR= option to geocode with unconventional values. Examples include internal sales territories, Metropolitan Statistical Areas (MSA), and Internet IP addresses.
LOOKUPXVAR= numeric-variable
species the numeric variable in the lookup data set that contains the longitude of the geocoding location.
Default: X LOOKUPYVAR= numeric-variable
species the numeric variable in the lookup data set that contains the latitude of the geocoding location.
Default: Y LOOKUPZIPVAR= variable
species the variable in the lookup data set that contains the ve-digit ZIP code values. The variable can be either character or numeric, but it must be the same type as ZIP code variable in the input address data set(ADDRESSZIPVAR=). Note: The values for a character ZIP code variable must be ve digits. You can use the Z5. format to prepend leading zeros to any ZIP code values that have fewer than ve digits. 4 Default: ZIP
NOCITY
disables the secondary matching attempt by city and state if ZIP code geocoding does not nd a match. By default, if ZIP code geocoding does not nd a match, then the GEOCODE procedure attempts to match the city and state values and then averages the results.
Interaction: Cannot be used with the CITY geocoding method. NOSTIMER
disables the informational messages sent to the SAS log that tracks the progress of the geocoding operation. If the input data set includes 1,000 or more observations, then the GEOCODE procedure writes periodic messages to the SAS log showing the
1160
Chapter 39
percentage completed and estimated time remaining. This option disables those messages. Note: If you do not specify this option (because you want the status messages) and your input data set has 1,000 or more observations, and you are still not receiving periodic status messages, then check the setting of the LOGPARM system parameter. Set LOGPARM=WRITE=IMMEDIATE to cause messages to be written immediately to the SAS log rather than buffered for later output. 4
NOZIP
disables the secondary matching attempt by ZIP code when PLUS4 geocoding does not nd a match. By default, if PLUS4 geocoding does not nd a match, then the GEOCODE procedure attempts to match the ve-digit ZIP code and average each matching ZIP code coordinate. Note: If your data set contains many missing ZIP+4 values, then the NOZIP option might improve performance. 4 Interaction: Cannot be used with the ZIP geocoding method.
OUT= output-data-set
species a data set for the geocoded addresses. All of the variables in the input address data set are copied to the output data set. Also added to the output data set are the following:
3 X and Y variables for the location of the match 3 optional variables specied by the ATTRIBUTEVAR option 3 a variable named _MATCHED_ indicating how the match was made (by ZIP
code, by city and state, by averaging coordinates, or no match) If the output data set that you specify already exists, then it is replaced without warning. If the output data set is the same as the input data set, then the input data set is updated by the geocoding operation. If you omit the OUT= option, then the name of the output data set is DATAn, where n is the smallest integer that produces a unique name. For example, if the DATA1 data set exists, then the default name for the output data set is DATA2.
RANGEDATA= data-set
species a data set that associates ranges of IP addresses with locations. The data set should contain variables that identify the starting IP number, ending IP number, and location ID for each range of IP addresses.
RANGEDECIMAL
species that the values of the ADDRESSVAR= variable are in decimal form. By default, the IP addresses in the ADDRESSVAR= variable are in dotted quad notation. For example, the IP address 192.168.0.1 is represented as 3232235521 in decimal form.
RANGEKEYVAR= variable
species the key variable for the lookup data set. The values of the key variable correspond to values in the variable that you specify for the LOOKUPKEYVAR= option. The data type of the key variable must match the variable that you specify for the LOOKUPKEYVAR= option.
1161
Examples
The following sample shows the simplest form of the GEOCODE procedure specifying only the OUT= option to geocode by ve-digit ZIP code. The default lookup data set, SASHELP.ZIPCODE, is used.
Generate the input data set of addresses to geocode.
data CUSTOMERS (label="Customer data for geocoding"); infile datalines dlm=#; length address $ 24 city $ 24 state $ 2; input address /* House number and street name */ zip /* Customer ZIP code (numeric) */ city /* City name */ state /* State abbreviation */ ; cust_ID = _n_; /* Assign customer ID number */ datalines; 555 Junk Street # 99999 # Beverly Hills # CA 115 E. Water St # 19901 # Dover # 760 Moose Lodge Road # 19934 # Camden # 200 S. Madison Str # 19801 # Wilmington # DE 4701 Limestone Road # 19808 # Wilmington # 2117 N 4th St # 19363 # Oxford # PA 1313 Mockingbird Lane # . # Delray # CC 133 Silver Lake Dr # 19971 # Rehoboth Beach # DE 11 SE Front Street # 19963 # Milford # DE 402 Nylon Boulevard # . # Seaford # DE 363 E Commerce St # . # Smyrna # DE 5595 Polly Branch Rd # 19975 # Selbyville # DE 1209 Coastal Highway # 19944 # Fenwick Island # DE 2899 Arthursville Rd # 19953 # Hartly # DE 41 Bramhall St # . # # 9320 Old Racetrack Rd # . # Delmar # DE 281 W Commerce Str # 19955 # Kenton # 211 Blue Ball Road # 21921 # Elkton # MD 3893 Turkey Point Rd # 19980 # Woodside # DE ; run;
Run the GEOCODE procedure, and then print the output data set.
proc geocode out=geocoded_customers; run;
1162
Chapter 39
The result of using all of the default values is that the following is true:
3 The input address data set is the most recently created SAS data set (this example
assumes that you have just created WORK.CUSTOMERS).
3 The ZIP code geocoding method is used. 3 The lookup data set is SASHELP.ZIPCODE. 3 No variables are added to the output data set other than the X and Y coordinates,
and a _MATCHED_ variable indicating whether and how the match was made. The following output from PROC PRINT shows the output data set after running the GEOCODE procedure. Notice that the following geocoding variables have been added:
34.0695 -118.398 City mean 555 Junk Street 39.1500 -75.532 ZIP 115 E. Water St 39.0953 -75.570 ZIP 760 Moose Lodge Road 39.7366 -75.549 ZIP 200 S. Madison Str 39.7317 -75.669 ZIP 4701 Limestone Road 39.7877 -75.961 ZIP 2117 N 4th St . . None 1313 Mockingbird Lane 38.7265 -75.081 ZIP 133 Silver Lake Dr 38.9035 -75.432 ZIP 11 SE Front Street 38.6387 -75.611 City 402 Nylon Boulevard 39.2912 -75.606 City 363 E Commerce St 38.4663 -75.150 ZIP 5595 Polly Branch Rd 38.4593 -75.053 ZIP 1209 Coastal Highway 39.1509 -75.693 ZIP 2899 Arthursville Rd . . None 41 Bramhall St 38.4557 -75.574 City 9320 Old Racetrack Rd 39.2282 -75.666 ZIP 281 W Commerce Str 39.6264 -75.850 ZIP 211 Blue Ball Road 39.0695 -75.567 ZIP 3893 Turkey Point Rd
DE PA CC DE DE DE DE DE DE DE DE MD DE
The following example illustrates using the ATTRIBUTEVAR= option to add additional variables (from the lookup data set) to the output data set. The example also illustrates using the DATA= option to specify an input address data set.
1163
Geocode the data, and then print the output data set.
proc geocode ZIP data=customers out=geocoded_customers attributevar=(statename, countynm); run; /* /* /* /* Geocoding method Address data Output data set Include these variables */ */ */ */
proc print data=geocoded_customers noobs; var x y _matched_ statename countynm address zip; run;
The following output from PROC PRINT shows the output data set after running the GEOCODE procedure. Notice that the following variables have been added to the output data set:
1164
Chapter 39
3 a variable named STATENAME from the lookup data set (that contains the full
name of the state or territory)
3 a variable named COUNTYNM from the lookup data set (that contains the name
of the county or parish) The attribute variables STATENAME and COUNTYNM are missing where the value for _MATCHED_ is None. The attribute variables are also missing where _MATCHED_ is City meanthese observations were matched with multiple city-and-state observations in the lookup data set, so the correct values for the attribute variables cannot be determined.
Output 39.2
X -118.398 -75.532 -75.570 -75.549 -75.669 -75.961 . -75.081 -75.432 -75.611 -75.606 -75.150 -75.053 -75.693 . -75.574 -75.666 -75.850 -75.567
Kent Kent New Castle New Castle Chester Sussex Sussex Sussex Kent Sussex Sussex Kent Sussex Kent Cecil Kent
1165
CHAPTER
40
The GFONT Procedure
Overview 1165 About the GFONT Procedure 1165 Displaying Fonts 1165 About Creating Fonts 1166 Concepts 1166 Font Terminology and Characteristics 1166 Storing User-Created Fonts: GFONT0 Libref 1167 Procedure Syntax 1168 PROC GFONT Statement 1168 Creating Fonts 1177 The Font Data Set 1177 Font Data Set Variables 1179 Creating a Font Data Set 1185 The Kern Data Set 1186 Kern Data Set Variables 1186 Creating a Kern Data Set 1186 The Space Data Set 1187 Space Data Set Variables 1188 Creating a Space Data Set 1188 Examples 1189 Example 1: Displaying Fonts with Character Codes 1189 Example 2: Creating Figures for a Symbol Font 1191
Overview
About the GFONT Procedure
The GFONT procedure displays fonts and creates SAS/GRAPH fonts for use in SAS/GRAPH programs. These fonts can contain standard Roman alphabet characters, foreign language characters, symbols, logos, or gures.
Displaying Fonts
You can use the GFONT procedure output when you want to do the following tasks: 3 review the characters that are available in SAS/GRAPH fonts
3 examine the default device-resident font for your device 3 see the character codes associated with font characters
1166
Chapter 40
3 view the hexadecimal values associated with font characters 3 modify the color and height of font characters 3 draw reference lines around font characters
See Example 1 on page 1189.
Concepts
3 The capline is the highest point of a normal uppercase letter. 3 The baseline is the line upon which the characters rest. 3 The font maximum is the highest vertical coordinate. 3 The font minimum is the lowest vertical coordinate.
Figure 40.1
3 A uniform font is a font in which all of the characters occupy exactly the same
amount of space. Each character in a uniform font is placed in the center of its space, and a xed amount of space is added between characters.
3 A stroked font is drawn with discrete line segments or circular arcs. This is a
stroked font with several characters from the Simplex font.
1167
Figure 40.2
3 A polygon font is drawn with one or more line segments or circular arcs. 3 A lled font is a polygon font in which the areas between the lines are solid. 3 An outline font is a polygon font in which the areas between the lines are empty.
Here are examples of a lled font and an outline font.
Figure 40.3
In the GFONT procedure, the term line segment means a continuous line that can change direction. All font characters are drawn with line segments. The letter C is drawn with one line segment, while the letter A can be drawn with two. Polygon characters can be drawn with one or more line segments. In a polygon font the following is true:
3 A character can include holes. The letter A is a polygon with a hole in it. It is
drawn with one line segment that is broken to form the outer boundary of the gure and the boundary of the hole.
The GFONT0 library is the rst place that SAS/GRAPH software searches for fonts. Always assign GFONT0 to the library that contains your personal SAS/GRAPH fonts. If you have personal SAS/GRAPH fonts in more than one SAS library, assign them
1168
Procedure Syntax
Chapter 40
librefs in the sequence GFONT0, GFONT1, GFONT2, and so on. The search for entries terminates if there is a break in the numbering sequence. If the libref GFONT0 is not dened, by default SAS/GRAPH software begins searching for fonts in SASHELP.FONTS. To cancel or redene the libref GFONTn, submit the following statement:
LIBNAME GFONTn;
Procedure Syntax
Requirements: One font name is required. To display a font, include NOBUILD. To create a font, include DATA=. Global statements: FOOTNOTE, NOTE, TITLE
PROC GFONT NAME=SAS/GRAPH font| device-resident font | system font mode <display-option(s)> <creation-option(s)>;
Syntax
PROC GFONT NAME=SAS/GRAPH font| device resident font | system font mode <display-option(s)> <creation-option(s)>;
1169
REFLINES ROMCOL=code-color ROMFONT=font ROMHEX ROMHT=height<units> SHOWALL SHOWROMAN 3 creation-option(s) can be one or more of the following: BASELINE=y CAPLINE=y CHARSPACETYPE=DATA | FIXED | NONE | UNIFORM CODELEN=1 | 2 FILLED KERNDATA=kern-data-set MWIDTH=character-width NODISPLAY NOKEYMAP RESOL=1...4 ROMHEX SHOWROMAN SPACEDATA=space-data-set UNIFORM For more detail on using the GFONT syntax, see Displaying Fonts: Required Arguments and Options on page 1169 and Creating Fonts: Required Arguments and Options on page 1173.
species of theSAS/GRAPH font to be displayed. Name can be any of the following values: 3 the name of a SAS/GRAPH font stored in the SASHELP.FONTS catalog, and fonts created by the user and stored in a GFONTn catalog. These fonts can be used only by SAS/GRAPH procedures or other procedures that generate SAS/GRAPH output les. 3 the name of a system font that can be used by any SAS procedure and by other software, such as Microsoft Word. SAS/GRAPH installs and registers a set of TrueType fonts, and it is recommended that you use these fonts whenever possible. 3 the name of a device-resident font that is burned into the chips in a devices hardware. These fonts are specic to the device being used and are not portable between devices. Some device resident fonts such as Helvetica can also be present as system fonts.
1170
Chapter 40
Alias: Note:
NOBUILD
species that the GFONT procedure is to display an existing font. The NOBUILD argument tells the GFONT procedure that no font is being created and not to look for an input data set.
Alias:
Featured in:
If you omit units, a unit specication is searched for in the following order:
1 the value of GUNIT= in a GOPTIONS statement 2 the default unit, CELLS
CTEXT=text-color
species a color for the body of the characters. If you do not use the CTEXT= option, a color specication is searched for in the following order:
1 the CTEXT= option in the procedure statement 2 the CTEXT= option in a GOPTIONS statement 3 the color specied in the ODS style 4 the rst color in the color list
Alias: Note:
CT= Example 2 on page 1191. The CTEXT= value is not stored as part of the font.
Featured in:
GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output generated by the display of the font. You can use the GREPLAY procedure to view the output that is stored in the catalog. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary WORK library, and creates the catalog if it does not exist.
See also: Specifying the Catalog Name and Entry Name for Your GRSEGs on
page 100
1171
HEIGHT=character-height<units>
species the height of the font characters in number of units, n. Height is measured from the minimum font measurement to the capline.
Alias:
species that the current key map is ignored when displaying the font and its character codes or hexadecimal values. If you do not use the NOKEYMAP option when you display a font, the current key map remains in effect. If any characters in the font are not available through the current key map, they are not displayed and a warning is issued in the SAS log. This happens when not all characters in the font are mapped into the current key map. Displaying a font using the NOKEYMAP option enables you to see all of the characters in the font, including those that are not mapped into your current key map.
Note:
Only the characters that are mapped into your current key map are available.
NOROMAN
turns off the automatic display of character codes that are created when you use the SHOWROMAN option during font creation.
Alias:
NR
NOROMHEX
turns off the automatic display of hexadecimal values for single-byte characters that are created when you use the ROMHEX option during font creation.
Alias:
NOHEX
REFCOL=reference-line-color
species a color for reference lines. If you do not use the REFCOL= option, a color specication is searched for in the following order:
1 the CTEXT= option in a GOPTIONS statement 2 the color specied in the ODS style 3 the rst color in the color list
REFLINES
draws reference lines around each displayed character. Vertical reference lines show the width of the character. Horizontal reference lines show the font maximum and the font minimum, as well as the baseline and the capline.
See:
ROMCOL=code-color
species the color of the character codes or hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options. If you do not use the ROMCOL= option, a color specication is searched for in the following order:
1 the color specied by the CTEXT= option in a GOPTIONS statement 2 the color specied in the current style or, if the NOGSTYLE option is specied,
then the default color is black for the Java and Activex devices and the rst color in the color list for all the other devices
Alias: Note:
RC= Example 1 on page 1189. The ROMCOL= value is not stored as part of the font.
Featured in:
1172
Chapter 40
ROMFONT=font
species the font for character codes and hexadecimal values that are displayed by the SHOWROMAN and ROMHEX options. If you do not use the ROMFONT= option, a font specication is searched for in the following order:
1 the value of the ODS STYLE variable 2 the FTEXT= option in a GOPTIONS statement 3 SAS-supplied fonts 4 the device-resident font
Alias:
displays hexadecimal values below the font characters. If you use both the ROMHEX and SHOWROMAN options, both the character codes and the hexadecimal values are displayed. You can also use the ROMHEX option when you create a font.
Alias:
HEX
species the height of the character codes and the hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options in number of units, n. If you do not use the ROMHT= option, a height specication is searched for in the following order:
1 the HEIGHT specied in the ODS STYLE 2 the HTEXT= option in a GOPTIONS statement
Alias:
displays the font with a space for every possible character position whether a font character exists for that position. The characters that are displayed are those available under your current key map, unless you use the NOKEYMAP option. The SHOWALL option usually is used in conjunction with the ROMHEX option, to display all possible hexadecimal values. If, under your current key map, a font character is available for a position, it displays above the hexadecimal value. If no character is available for a position, the space above the hexadecimal value is blank. You can use the SHOWALL option to show where undened character positions fall in the font.
SHOWROMAN
displays character codes below the font characters even if they are not displayed automatically with the font. If you use both the SHOWROMAN option, and the ROMHEX option, both the character codes, and the hexadecimal values are displayed. You can also use the SHOWROMAN option when you create a font.
Alias:
Featured in:
Details
proc gfont name=weather nobuild romfont=albany; run;
1173
assigns a name to the font that you create. Font name is the name of a catalog entry, and must be a valid SAS name of no more than eight characters. You cannot specify NONE, or the name of a SAS/GRAPH font that is shipped with SAS/GRAPH software. Alias: N= Featured in: Example 2 on page 1191.
DATA=font-data-set
species the SAS data set that the GFONT procedure uses to build the font. The data set must be sorted by the variables CHAR and SEGMENT. Default: The GFONT procedure uses the most recently created data set. See also: SAS Data Sets on page 54. Featured in: Example 2 on page 1191. When you create a font, dene the libref GFONT0. See Storing User-Created Fonts: GFONT0 Libref on page 1167. Note: If a user-created SAS/GRAPH font has the same name as a font supplied by SAS, and if the libref GFONT0 has been dened, then the user-created SAS/GRAPH font is used, because GFONT0 is rst in the search order. 4
BASELINE=y
species the vertical coordinate in the font data set that is the baseline of the characters. The baseline is the line upon which the letters rest. If you do not use the
1174
Chapter 40
BASELINE= option, the GFONT procedure uses the lowest vertical coordinate of the rst character in the font data set. B=
CAPLINE=y
species the vertical coordinate in the font data set that is the capline of the characters. The capline is the highest point of normal that case the capline, and the font maximum are the same. See Figure 40.1 on page 1166 for an illustration of capline, and font maximum. If you use the CAPLINE= option, when the height of a character is calculated, any part of the character that is above the capline is ignored in the calculation. You can use this option to prevent an accented capital like A from being shortened to accommodate the accent. If you do not use the CAPLINE= option, the capline and the font maximum are the same. The A is shortened to make room for the accent below the capline. However, if the CAPLINE= option is used, the top of the letter A is at the capline, and the accent is drawn above the capline, and below the font maximum.
Alias:
C=
species the type of intercharacter spacing. The following are valid values: DATA species that the rst observation for each character sets the width of that character. When CHARSPACETYPE=DATA, the PTYPE variable is required, and the observation that species the width of the character must have a PTYPE value of W. See The Font Data Set on page 1177 for details on the PTYPE variable. Intercharacter spacing is included in the characters width. If the rst observation for the letter A species a character width of 10 units, and the A occupies 8 units, the remaining 2 units serve as intercharacter spacing. Note: The character can extend beyond the width that you specied in the rst observation if desired. 4 FIXED adds a xed amount of space between characters based on the font size. The width of the individual character is determined by the data that generates the character. NONE species that no space is added between characters. The width of the individual character is determined by the data that generates the character. This type of spacing is useful for script fonts in which the characters should appear connected. UNIFORM species that the amount of space that is used for each character is uniform, not proportional. Each character occupies the same amount of space. In uniform spacing the letters m and i occupy the same amount of space, in proportional spacing m occupies more space than i. In uniform spacing, the character is always centered in the space, and a xed space is added between characters. When UNIFORM is specied, the amount of space that is used for each character is one of the following:
Alias: CSP= Default: CHARSPACETYPE=FIXED Note: Specifying CHARSPACETYPE=UNIFORM is the same as using the
UNIFORM option.
1175
CODELEN=1 | 2
species the length in bytes of the CHAR variable. To specify double-byte character sets for languages such as Chinese, Japanese, or Korean, use CODELEN=2.
FILLED
species that the characters in a polygon font are lled. Alias: F Default: 1 Featured in: Example 2 on page 1191. Restriction: If you specify a double-byte character set, the KERNDATA= option and SPACEDATA= option are ignored.
KERNDATA=kern-data-set
species the data set that contains kerning information. When the KERNDATA= option is used during font creation, the data that is contained in the kern data set is applied and stored with the font. Alias: KERN= See also: The Kern Data Set on page 1186 Restriction: If you specify kerning for a double-byte character set that is created by using the option CODELEN=2, then the KERNDATA= option is ignored.
MWIDTH=character-width
species the width of a character in a uniform font, where character-width is the number of font units. The MWIDTH= option is valid when you specify uniform spacing by using the UNIFORM option or when you specify CHARSPACETYPE=UNIFORM. If you omit the MWIDTH= option, the default is the width of the widest character in the font (usually the letter m). The MWIDTH= option is typically used to tighten the spacing between characters. To do this, specify a smaller value for character-width. Figure 40.4 on page 1175 shows the effect of decreasing the space that is allowed for uniformly spaced characters.
Figure 40.4
See also: the CHARSPACETYPE= option on page 1174 and the UNIFORM option
on page 1177
NODISPLAY
species that the GFONT procedure is not to display the font that it is creating. Alias: ND
NOKEYMAP
species that the current key map is ignored when you create and then use the font that is created. The character codes you enter are not mapped in any way before
1176
Chapter 40
being displayed. As a result, the created font is never affected by any setting of the KEYMAP= graphics option. CAUTION:
Fonts created with the NOKEYMAP option are never affected by any setting of the KEYMAP= graphics option. 4
By default, the NOKEYMAP option is not used; in that case, when you build a font, the current key map is applied to the values in the CHAR variable. However, your current key map might not be symmetrical; two or more input character codes might be mapped to the same output character. For example, if A is mapped to B, then both A and B map to B, but nothing maps to A. In this case, more than one code in your input data set can map to the same character in the resulting font. For example, if A and B are values of CHAR, both map to B. If this happens, a message that indicates the problem characters is displayed in the SAS log. To solve this problem, do one of the following tasks: 3 change the character code of one of the characters 3 eliminate one of the characters 3 use the NOKEYMAP option The NOKEYMAP option works correctly only if the end users host or controller encoding is the same as the encoding used to create the input data set. See also: the NOKEYMAP= option on page 1171 for Displaying Fonts.
RESOL=1...4
controls the resolution of the fonts by specifying the number of bytes (1 through 4) for storing coordinates in the font. The GFONT procedure provides three resolution levels (RESOL=3 produces the same resolution level as RESOL=4). By default, RESOL=1. The higher the number, the closer together the points that dene the character can be spaced. A high value species a denser set of points for each character so that the characters approximate smooth curved lines at very large sizes. RESOL=2 works well for most applications; RESOL=3 or 4 might be too dense to be practical. The table below shows the resolution number and the maximum number of distinct points that can be dened horizontally or vertically.
Resolution 2 3 4 Number of Distinct Points 32,766 2,147,483,646 2,147,483,646
Alias:
species that hexadecimal values display automatically below the font characters when the GFONT procedure displays the font. If you use the ROMHEX option for a font that you create, you can later use the NOROMHEX option to suppress display of the hexadecimal values. Alias: HEX See also: the SHOWROMAN option on page 1177, the ROMHEX option on page 1172 for Displaying Fonts, and the NOROMHEX option on page 1171.
1177
SHOWROMAN
species that character codes display automatically below the font characters when the GFONT procedure displays the font. If you use the SHOWROMAN option for a font you create, you can later use the NOROMAN option to suppress display of the character codes.
Alias:
SR
See also: the ROMHEX option on page 1172, the SHOWROMAN option for
species the SAS data set that contains font spacing information. When you use the SPACEDATA= option during font creation, the data contained in the space data set is applied to the font and stored with it.
Alias:
SPACE=
See also: The Space Data Set on page 1187. Restriction: If you specify the SPACEDATA= option for a double-byte character set
that is created by using the option CODELEN=2, then the SPACEDATA= option is ignored.
UNIFORM
species that characters are spaced uniformly rather than proportionately. Using the UNIFORM option is the same as specifying CHARSPACETYPE=UNIFORM. Alias: U
See also: the CHARSPACETYPE= option on page 1174 and the MWIDTH= option
on page 1175.
Creating Fonts
To create a font, you must create a data set that contains font information. Typically you use a DATA step to create a SAS data set from which the GFONT procedure generates the font. The data set is referred to as the font data set and you can specify it with the DATA= argument. To produce the font, invoke the GFONT procedure and specify the data set that contains the font information. In addition you can include options to modify the design and appearance of the font. For example, the following statement uses the data set FONTDATA to generate the font MYLOG:
proc gfont data=fontdata name=mylogo;
For a demonstration of the font creation process, see Example 2 on page 1191. The GFONT procedure uses three types of data sets: the font data set, the kern data set, and the space data set. Each type of data set must contain certain variables and meet certain requirements. The following sections explain what each data set contains, how it is built, and what the requirements of the variables are. See Example 2 on page 1191.
1178
Chapter 40
or polygon. A font data set that generates a polygon font produces an outline font by default. You can use the FILLED option with the same data set to generate a lled font. The variables in the font data set must be assigned certain names and types. The table below summarizes the characteristics of the variables which are described further in Font Data Set Variables on page 1179
data sashelp. fontdata; proc gfont data=fontdata name=mylogo; run;
Specify the font data set with the DATA= argument. The font data set consists of a series of observations that include detailed characteristics of the variables described in Font Data Set Variables on page 1179.
Table 40.1 Font Data Set Variables
With Stroked Fonts required With Polygon Fonts required
Variable CHAR
Description the character code associated with the font character the type of line segment being drawn, either a line or a polygon the type of data in the observation the number of the line segment or polygon being drawn the horizontal coordinate the vertical coordinate
Type character
LP
character
optional
required
PTYPE
character
V or C or W
optional
optional
SEGMENT
numeric
number
required
required
numeric
number
required
required
numeric
number
required
required
1179
Using reserved or undened hexadecimal codes as CHAR values might require the use of the NOKEYMAP option. 4
The CHAR variable takes any character as its value, including keyboard characters and hexadecimal values from 00x to FFx. (If you use hexadecimal values as CHAR values, your font might not work correctly under a key map that is different from the one under which the font wax created. Positions that are not dened in one key map might be dened in another.) When you specify the code for the character in a text string, the associated font character is drawn. For example, if you create a Roman alphabet font, typically the characters you specify for CHAR are keyboard characters that match the character in the font. All of the observations that build the letter A have a CHAR value of A. When you specify A in a text string, this creates an A in the output. However, If you build a symbol font, the symbols might not have corresponding keyboard characters. In that case, you select a character or hexadecimal value to represent each symbol in the font and assign it to CHAR. For example in the Special font, the letter G is assigned as the code for the eur-de-lis symbol. When you specify the code in a text string, the associated symbol displays. Note: If the CODELEN= option is set to 2, the values for CHAR represent two characters, such as AA, or a four- digit hexadecimal value, such as 00A5x. 4 LP tells the GFONT procedure whether the coordinates of each segment form a line or a polygon. LP is a character variable with a length of 1. Assign the LP variable either of the following values: L lines
Featured in: Figure 40.5 on page 1180. Note: Optional for stroked fonts. Note: Observations that do not contain an LP variable create a
shape like the one in Figure 40.5 on page 1180. P polygons. If the observations do not draw a completely closed gure then the gure is closed by the GFONT procedure. Note: Required for polygons.
Featured in: An LP variable with a value of P for all
1180
Chapter 40
OBS 1 2 3 4
CHAR b b b b
SEG 1 1 1 1
X 1 1 3 3
Y 1 3 3 1
Figure 40.5
LP Value of L
LP (continued) .
OBS 1 2 3 4 CHAR b b b b SEG 1 1 1 1 X 1 1 3 3 Y 1 3 3 1 LP P P P P
Figure 40.6
LP Value of P
LP (continued) The LP variable enables you to mix lines and polygons. These observations create the gure consisting of a polygon and a line segment as shown in Figure 40.7 on page 1181:
OBS 1 2 3 CHAR b b b SEG 1 1 1 X 1 1 3 Y 1 3 3 LP P P P
4
Y 1 0 4 0
1181
OBS 4 5 6 7
CHAR b b b b
SEG 1 2 2 2
X 3 0 2 4
LP P L L L
Figure 40.7
PTYPE tells the GFONT procedure what type of data is in the observation. PTYPE is a character variable of length 1 that is optional. For each observation, the PTYPE variable assigns a characteristic to the point that is determined by the X and Y values. You can assign the PTYPE variable to any of these values: V normal point in the line segment
Note: If a PTYPE variable is not specied then all points are
in consecutive observations, it draws an arc that connects the two V points and has its center at the C point. If a circle cannot be centered at C, and pass through both V points, the results can be unpredictable. C center of a circular arc joining two V points
Restriction: Arcs are limited to 106 degrees or less. Featured in: Figure 40.8 on page 1182. Note: After the gure was created, a grid was overlaid, to show
the location of the points. W width value for CHARSPACETYPE=DATA. An observation with a PTYPE value of W, must always be the rst observation for a character. The observation gives the minimum and maximum X values for the character. The Y variable observation contains the maximum X value. Usually, these values include a little extra space for intercharacter spacing.
1182
Chapter 40
45
40
45
50
45
40
55
40
Figure 40.8
PTYPE (continued)
3 The font that contains the gure of the arc was created with a similar PROC
GFONT statement:
proc gfont data=arc name=arcfig charspacetype=data filled ;
1183
The GFONT procedure CHARSPACETYPE= DATA species that the rst observation sets the width of the character. The FILLED option lls the area of the arc. SEGMENT numbers the line segments that compose a character or symbol. SEGMENT is a required numeric variable. All observations for a given line segment have the same segment number. To start a new line segment, change the segment number. The GFONT procedure requires special instructions to do the following:
3 create a stroked character with more than one line segment (an E) 3 create a polygon character with an opening (A)
To indicate when one line stops and where the next line begins you can do either of the following:
1 Change the segment number when a new line begins. If the value of LP is L
3 The last point in line segment 1 ends the line. 3 The rst point in line segment 2 starts a new line.
1184
Chapter 40
3 The last point in line segment 1 joins the rst point in line segment 1,
which closes the polygon.
3 A new polygon starts. If the value of CHAR has not changed, the new
polygon is part of the same character. Use this method for characters that consist of two polygons such as a question mark. This method is preferred, unless you are creating a polygon character with a hole in it. 2 Keep the same segment number for all lines. Insert an observation with missing values for X and Y. Insert the new observation between the observation that marks the end of the rst line, and the observation that begins the next line. The second method is preferred when creating a polygon with a character with a hole in it. In this case, you should separate the lines with a missing value and keep the same segment numbers. If you use separate line segments when you create a polygon with a hole, the results can be unpredictable. These observations from a data set called BOXES were used to draw the hollow square in Figure 40.9 on page 1185. The data points that form the gure are laid out on a grid shown next to the square.
OBS 1 2 3 4 5 6 7 8 9
CHAR b b b b b b b b b
SEG 1 1 1 1 1 1 1 1 1
X 1 1 3 3 0 0 4 4
Y 1 3 3 1 0 4 4 0
LP P P P P P P P P P
Note observation 5 has missing values for X and Y. This separates the observations that draw the inner box from those that draw the outer box. The segment number is the same for all the observations. Figure 40.9 on page 1185 was created with a similar GFONT statement:
proc gfont data=boxes name=boxes filled;
Note: The FILLED option is included, and only the space between the two squares is lled. 4
1185
Figure 40.9
X and Y specify the horizontal and vertical coordinates of the points for each character. Their values describe the position of the points on the character. These variables have the following characteristics:
3 They must be numeric. 3 They must be named X and Y for the horizontal and vertical coordinates,
respectively.
3 The values specied by them can be in any range. 3 They both must describe the character in the same scale or font units. 3 Vertical (Y) coordinates for all characters should be dened on the same
baseline. Note: When you specify PTYPE=W, both X and Y contain horizontal coordinate values. 4
on a grid.
2 Lay out the observations for each character. Each observation describes a move
from one point to another along a line segment. For each line segment, enter the coordinate points in the order in which they are drawn. For a stroked font, when you start a new line segment, change the segment number. For a polygon font, when you start a new polygon, change the line segment number. If the polygon has a hole in it, as in the letter O, keep the line segment number and separate the lines with a missing value. Use the same value for CHAR for all of the observations that describe one character.
3 Create a SAS data set that contains the variables CHAR, SEGMENT, X, and Y,
and read in the data for each observation. Include the variables LP and PTYPE if necessary.
4 Sort the data set by CHAR and SEGMENT. 5 Assign the font data set with the DATA= argument.
1186
Chapter 40
dene one observation for each pair of characters and the corresponding space adjustment as follows:
1187
3 Assign the kern data set with the KERNDATA= option as follows:
proc gfont data=fontdata name=font2 charspacetype=data kerndata=kern1 nodisplay; run;
Creating a Kern Data Set on page 1186 illustrates how to use the KERNDATA= option to create a font in which the space between specied pairs of letters is reduced. The characters A, D, and T are shown as the word DATA. The rst line uses the unkerned font, FONT1, and the second line uses the kerned font, FONT2. Note that the characters in FONT2 are spaced more closely than the characters in FONT1. These statements specify the kerned and unkerned fonts, and are used with the GSLIDE procedure to create the fonts:
title2 lspace=6 f=font1 h=10 j=l "DATA"; title3 lspace=4 f=font2 h=10 j=l "DATA";
Figure 40.10
1188
Chapter 40
intercharacter spacing that is specied by the CHARSPACETYPE= option. Spacing is applied uniformly to all characters. Values that are specied in the space data set are added to the normal intercharacter spacing and any kerning data. Normal intercharacter spacing is determined by the CHARSPACETYPE= option.
3 Assign the space data set with the SPACEDATA= option as follows:
proc gfont data=fontdata name=font3 charspacetype=data spacedata=space1 nodisplay; run;
Figure 40.11 on page 1189 illustrates how to use the SPACEDATA= option to create a font in which intercharacter spacing is adjusted according to the height of the characters. The characters A, D, and T are shown as the word DATA. Each pair of lines
1189
displays the word DATA and at the same size uses rst the font with spacing adjustment (FONT3) and then the original font (FONT1). Note that as the size of the characters increases, the space between them decreases. The following title statements are used with the GSLIDE procedure to produce Figure 40.11 on page 1189:
title2; title3 f=font3 h=.25in j=l "DATA"; /* 18 points */ title4 f=font1 h=.25in j=l "DATA"; title5; title6 f=font3 h=.50in j=l "DATA"; /* 36 points */ title7 f=font1 h=.50in j=l "DATA"; title8; title9 f=font3 h=1.0in j=l "DATA"; /* 72 points */ title10 f=font1 h=1.0in j=l "DATA";
Figure 40.11
Examples
These examples illustrate the major features of the GFONT procedure.
1190
Chapter 40
This illustrates the SHOWROMAN option, which displays the character codes that are associated with the font characters that are being displayed. This display shows which keyboard character you enter to produce the Greek character you want displayed. The example also illustrates how to modify the appearance of both the font characters, and the character codes.
Set the graphics environment.
goptions reset=all border;
Dene title.
title "The GREEK Font with Character Codes";
Display the GREEK font with character codes. NOBUILD indicates that the font specied in the NAME= argument is an existing font. HEIGHT= species the height of the Greek characters. ROMCOL=, ROMFONT=, and ROMHT= assign the color, type style, and height of the character codes. SHOWROMAN displays the character codes.
proc gfont name=greek nobuild height=3.7 romcol=red romfont=swissl romht=2.7 showroman;
1191
run; quit;
Create three simple gures for a symbol font. Each gure is laid out on a grid that is 64 font units square. The third gure is a circle with a slash through it. Figure 40.12 on page 1192 shows the gure and some of its coordinate points laid out on a grid.
1192
Chapter 40
Figure 40.12
Assign the librefs and set the graphics environment. The LIBNAME statement associates the libref GFONT0 with the SAS data library in which the font catalog is stored.
LIBNAME gfont0 "SAS-data-library"; goptions reset=all border;
Create the font data set FIGURES for a triangle, a heart, and a circle with slash. The rst gure, a right-pointing triangle that is assigned the character code A, is a polygon drawn with three straight lines.
data figures; input char $ ptype $ x y segment lp $; datalines; A W 0 64 0 P /* triangle pointing right */ A V 4 4 1 P A V 60 32 1 P A V 4 60 1 P A V 4 4 1 P
The second gure, a heart that is assigned the character code B, uses the PTYPE variable combination V-C-V to draw the arcs that make up the top of the heart. Each side requires two arcs. Because the arcs are continuous, the observation that marks the end of one arc is also the beginning of the next arc. The heart drawing begins at the bottom point and continues counterclockwise.
B B B B B B B B B W V V V C V C V C 0 32 44 58 46 56 46 32 18 64 2 17 40 47 58 47 52 47 0 1 1 1 1 1 1 1 1 P P P P P P P P P /* heart */
1193
B B B B B
V C V V V
8 18 6 20 32
58 47 40 17 2
1 1 1 1 1
P P P P P
The third gure, a circle with a slash through it, assigned the character code C, consists of three polygons: a circle and two empty arcs. An observation with missing values separates the observations dening each of the three polygons. The outer circle is dened by the rst group of observations. The empty arcs are drawn with three continuous arcs using the PTYPE variable pattern V-C-V-C-V-C-V. The straight line that closes the arc is drawn automatically by the GFONT procedure in order to complete the polygon. Because all the polygons are part of one character, the continuous space they dene is lled.
C C C C C C C C C C C C C C C C C C C C C C C C C C ; W V C V C V C V C V V V C V C V C V V V C V C V C V 0 32 32 64 32 32 32 0 32 32 . 12.4 32 8 32 32 32 45.9 . 51.6 32 56 32 32 32 18.1 64 64 32 32 32 0 32 32 32 64 . 18.1 32 32 32 56 32 51.6 . 45.9 32 32 32 8 32 12.4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 P P P P P P P P P P P P P P P P P P P P P P P P P P /* circle with slash */
1194
Chapter 40
Create and display the font FIGURES. DATA= argument names the input data set. The NAME= the font that the procedure creates. FILLED species a lled polygon. HEIGHT= font height. CTEXT=red the color of the gures. RESOL= 2 improves the resolution of the lines.
proc gfont data=figures name=figures filled height=.75in ctext=red showroman romht=.5in resol=2; run; quit;
1195
CHAPTER
41
The GINSIDE Procedure
Overview 1195 Procedure Syntax 1195 PROC GINSIDE Statement 1196 ID Statement 1197 Examples 1197 Example 1: Determining Values by Using the GINSIDE Procedure 1197 Example 2: Mapping and Annotating Values from the GINSIDE Procedure
1198
Overview
The GINSIDE procedure compares a data set of X and Y coordinates to a map dataset containing map polygons. The procedure determines whether the X and Y coordinates for each point fall inside of or outside of the map polygons. If the point falls inside of a polygon, then the ID variable is set to the ID value of that polygon. For example, if a map contains states, then the ID variable of the output data set is set to the state that contains the point. The GINSIDE procedure can be used with the SAS/GRAPH map data sets and the results can be used to annotate onto a map with the GMAP procedure. Note: Points that fall on the border of a polygon might give unpredictable results.
Procedure Syntax
Requirements:
1196
Chapter 41
Required Argument
DATA=points-data-set
species an input data set that contains the X and Y coordinates of the individual points that are being compared to the map polygons. Note: If this data set contains the same ID variable (or variables) as does the map, the value should be set to MISSING so that the points are not considered to be part of the boundary of the polygon. 4
MAP=map-data-set
species the map data set that contains the polygons that you want to compare the points in the input data set to. This data must conform to the rules for a map data set and contain variables X and Y and one or more ID variables. The ID statement should name that variable or variables. Note: The X and Y values in the input data set must be in the same projection system and units as the X and Y in the map data set. So, if the map data set has unprojected X and Y values in radians, then the point data set X and Y variable values must also be unprojected and in radians. 4
OUT=output-data-set
species the output data set for the GINSIDE procedure. The output data set contains all of the observations and variables from the input data set, and an ID variable is added.
Options
INSIDEONLY
causes the output data set to contain only points that are inside the map polygons. By default, the data set contains all points.
1197
ID Statement
Species the identication variables in the map data set whose polygons will be checked against the points from the input data set.
Requirements:
ID id-variable(s);
Required Arguments
id-variable(s)
species one or more identication variables from the map data set. For each X and Y point in the input data set and each ID variable that you specify, if the point lies within a polygon in the map data set, then the ID value of that polygon is written to the output data set. If the point lies outside of all of the polygons, then a missing value is written to the output data set. For example, the rst observation in an input data set contains the values X=1.37 and Y=.68. In the PROC GINSIDE statement, you specify the MAPS.COUNTIES data set, and in the ID statement you specify the STATE variable. The point (1.37,.68) lies within the polygon where STATE=54, so the rst value for STATE in the output data set is 54.
Examples
ID statement
Sample library member: GINSIDE2
This example uses the GINSIDE procedure to determine the state and county for each pair of coordinates in the input data set.
Create the GPS data set. The X and Y variables are converted from decimal degrees to radians. The X variable is also multiplied by -1 to match the values in the MAPS.COUNTIES data set.
data gps; input x y site $; x=x*arcos(-1)/180; x=x*(-1);
1198
Chapter 41
y=y*arcos(-1)/180; datalines; -77.0348 40.0454 a -78.4437 39.1623 b -78.4115 39.3751 c -78.7646 40.6354 d ; run;
Determine the values of STATE and COUNTY for each data point.
proc ginside data=gps map=maps.counties out=gpscounties; id state county; run;
Output 41.1 shows the values of STATE and COUNTY for each observation in the input data set.
Output 41.1
site a b c d
ID statement
Sample library member: GINSIDE
1199
The following example determines which customers are inside Wake County in the state of North Carolina. It then draws a map and colors the dots (representing customers) to distinguish customers inside the county from customers outside the county. This example is featured in the SAS Sample Library under the name GINSIDE.
Set the graphics environment.
goptions reset=global border;
1200
Chapter 41
Project the map and points data sets to use the same projection.
proc gproject data=work.combined out=work.combined dupok; id state county; run; /*split the data*/ data work.states customer; set work.combined; if missing(zip) = 1 then output work.states; else output customer; run;
Create an annotate dataset from the points data and color the points black if inside the map, and color them red if outside.
data points; set mapout; length function style color $ 8 position $ 1 text $ 20 ; retain xsys ysys "2" hsys "3" when "a" text ""; retain rotate 360 style "solid" function "pie" position "5"; color= "black"; size=2; if missing(county) then color="red"; output; run; title "Red dots are outside of Wake County";
Use the GMAP procedure to display the map. The ANNO= option species the annotate data set.
proc gmap data=states map=states anno=points; id county; choro county / coutline=black nolegend;
1201
run; quit;
Output 41.2 shows the results of PROC PRINT. Notice that the last two observations have missing values for COUNTY because they are not in Wake County.
Output 41.2
X -.001541860 -.002986277 -.002444482 0.001531260 0.003358790 0.004053658 0.002555933 -.004565994
1202
1203
CHAPTER
42
The GKPI Procedure
Overview 1203 Slider KPI Charts 1204 Bullet Graph KPI Charts 1204 Dial KPI Charts 1205 Speedometer KPI Charts 1205 Trafc Light KPI Charts 1206 Concepts 1206 Specifying Basic or Raised Mode 1206 Specifying Segment Boundaries and Actual KPI Values 1208 Controlling the Display of Boundary and Tick Mark Values 1209 Controlling Segment Colors 1209 Default Colors 1209 Dening Active and Inactive Color Lists 1211 Example: Specifying an Inactive Color List 1212 Example: Specifying an Active Color List 1212 Specifying Active Colors Only for Specic Segments (Using Null Colors) 1213 Specifying Color Names 1213 Specifying Fonts 1214 Procedure Syntax 1215 PROC GKPI Statement 1215 DIAL, HBULLET, HSLIDER, HTRAFFICLIGHT, SPEEDOMETER, VTRAFFICLIGHT, VBULLET, and VSLIDER Statements 1216 Examples 1220 Example 1: Using the Default Colors as the Active Colors 1221 Example 2: Creating a Gray Scale Bullet Graph 1222 Example 3: Creating a Dial KPI Chart 1223 Example 4: Dening a Speedometer 1224 Example 5: Dening a Speedometer with Reversed Colors 1225 Example 6: Creating a Trafc Light 1226
Overview
The GKPI procedure creates graphical key performance indicator (KPI) charts. KPIs are metrics that help a business monitor its performance and measure its progress toward specic goals. The procedure produces ve KPI chart types:
1204
Chapter 42
1205
1206
Chapter 42
In each display type, tick marks are evenly spaced but do not correspond to colored segment boundaries. The numbered band in the full speedometer is always divided into ten sections (using 11 tick marks). The numbered band in the half speedometer is divided into ve sections (six tick marks), and the quarter speedometer is divided into three sections (four tick marks).
Concepts
The following gures illustrate the difference in appearance between basic mode and raised mode for each type of KPI chart.
1207
Figure 42.1
Figure 42.2
Figure 42.3
1208
Chapter 42
Figure 42.4
The order in which colors are applied is not affected by whether boundaries are specied in ascending or descending order. See Dening Active and Inactive Color Lists on page 1211 for information on controlling segment colors. The actual KPI value can fall outside of the highest or lowest boundaries, but the GKPI procedure treats such values as if they occur at the edge of the highest or lowest
1209
boundaries. For example, suppose the actual KPI value is 10, but the lowest boundary value is 8:
hslider actual=-10 bounds=(-8 -5 0 3 5 10)
If you specify a missing value for the actual KPI value (ACTUAL=.), then the GKPI procedure does not generate a KPI chart.
3 increasing the size of the KPI chart using the XPIXELS=/YPIXELS= or HSIZE=/
VSIZE= options on the GOPTIONS statement
3 reducing the size of the boundary value font using the BFONT= option 3 applying a SAS format to the boundary values using the FORMAT= option.
See Example 3 on page 1223 for an example that uses the XPIXELS=, YPIXELS=, BFONT=, and FORMAT= options.
Default Colors
If you dene only one segment or more than ve segments, the GKPI procedure uses the same value of gray (hexadecimal RGB value B2B2B2) for all segments.
Figure 42.5
If you dene two to ve segments, the GKPI procedure uses some or all of the colors shown in Figure 42.6 on page 1210 as the default colors.
1210
Chapter 42
Figure 42.6
For example, if you dene only three segments, the GKPI procedures uses the red, yellow, and green colors shown in Figure 42.6 on page 1210.
Table 42.1 on page 1210 lists the hexadecimal values for each of these default colors.
Table 42.1
Color
The trafc light also uses the default colors, but it applies them slightly differently. If you dene only one segment, then the procedure displays the light for that segment in gray. If you dene two to ve segments, the trafc light uses the default color listed in Table 42.1 on page 1210 only for the light corresponding to the segment that contains the actual KPI value. All other lights are gray. If you dene more than ve segments, all lights are displayed in gray, but the light corresponding to the segment that contains the actual KPI value is displayed in dark gray. In other words, only one light in a trafc light is turned on at a time. All other lights are turned off.
1211
Figure 42.7
Colors are applied in the same direction, regardless of whether the segment boundaries are in ascending or descending order. Colors for horizontal sliders and bullet graphs are applied from left to right. Colors for trafc lights, vertical sliders, and vertical bullet graphs are applied from bottom to top. Colors for dials and speedometers are applied clockwise.
1212
Chapter 42
of entries in the BOUNDS= list. If you specify the ACTIVECOLORS= list, you do not have to specify a color for every segment. See Specifying Active Colors Only for Specic Segments (Using Null Colors) on page 1213 for more information.
The actual KPI value falls into the second segment, and there are no active colors specied, so the second color in the COLORS= list, MediumTurquoise, is used for the second segment and for the actual KPI value indicator.
The actual KPI value is 0.28, which falls into the second segment, so the second color listed in the ACTIVECOLORS= color list, cxF1DC63, which is yellow, is used as the color for the second segment instead of gray.
1213
If the actual KPI value is changed to 0.43, then the third color in the ACTIVECOLORS= color list, cx84AF5B, which is green, is used for the third segment instead of gray.
Specifying Active Colors Only for Specic Segments (Using Null Colors)
If you specify a null color for a segment in the ACTIVECOLORS= list, then either the default color or the color in the COLORS= list, if one is specied, is used for that segment even if it contains the actual KPI value. To specify a null color, you can specify null for the color or enter a comma-delimited list with no space between the commas. For example, if you have ve segments and you want red to be used only for the lowest and highest segments, then you can specify the ACTIVECOLORS= list in either of the following forms:
activecolors=(red,null,null,null,red) activecolors=(red,,,,red)
The default colors (or the color in the COLORS= list) will be used for segments two through four even if the actual KPI value falls into one of these segments. The ACTIVECOLORS= list does not have to specify a color for each segment, but the one-to-one correspondence between the colors that are specied and the segments is maintained. For example, supposed you dene ve segments and you specify the following:
activecolors=(red green)
The GKPI procedure treats this specication as if you had entered the following:
activecolors=(red,green,null,null,null)
Red applies only to the rst segment, and green applies only to the second segment. Default colors (or COLORS= colors) apply to all the other segments.
Example COLORS=(cx98FB98 cxDDA0DD cxFFDAB9 cxDB7093 cxB0E0E6) COLORS=("FF00FF00" "00FFFF00" "FFFFFF00") COLORS=(H14055FF H0F060FF H0B485FF H07880FF) COLORS=(V0F055FF v010FFFF v03BFFFF v12C55E8) COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3)
1214
Specifying Fonts
Chapter 42
Example COLORS=(palegreen plum peachpuff palevioletred powderblue) COLORS=("very light purplish blue" "light vivid green" "medium strong yellow" "dark grayish green")
Specifying Fonts
You can control the fonts that are used to display the boundary and tick mark values, the actual KPI values, and the labels with the BFONT=, AFONT=, and LFONT= options, respectively. Each of these options takes a font specication of the following form:
<FONT="fontname</BOLD></ITALICS>"> <COLOR=color> <HEIGHT=text-height<units>>
FONT= "fontname</BOLD></ITALICS>" species the font name. You can specify only system fonts (such as TrueType and UNIX system fonts), not SAS/GRAPH fonts. See Chapter 11, Specifying Fonts in SAS/GRAPH Programs, on page 153 for more information.
Alias:
F=
COLOR=color species the text color. You can specify the color in any of the color-naming schemes recognized by SAS/GRAPH. See Specifying Color Names on page 1213 for more information. Alias: C= HEIGHT= text-height<units> species the font height in units. You can specify the text height in units of points (PT), centimeters (CM), inches (IN), or percentage of the graphics output area (PCT). The default unit is PCT. Alias: H= The LFONT= option also enables you to specify the JUSTIFICATION= option:
<FONT="fontname</BOLD></ITALICS>"> <COLOR=color> <HEIGHT=text-height<units>> <JUSTIFICATION=LEFT|CENTER|RIGHT>
JUSTIFICATION= species whether the text is left-justied, centered, or right-justied within the graphics output area. You can specify LEFT, RIGHT, or CENTER. The default is CENTER.
Alias:
J=
1215
Procedure Syntax
Requirements:
3 You must specify an ODS HTML or ODS RTF statement. 3 The only device supported for the GKPI procedure is JAVAIMG. If you do not
specify DEVICE=JAVAIMG, then the procedure sets this option automatically. 3 At least one DIAL, HSLIDER, HBULLET, HTRAFFICLIGHT, SPEEDOMETER, VTRAFFICLIGHT, VBULLET, or VSLIDER statement is required.
Global Statements: FOOTNOTE , GOPTIONS (BORDER, VSIZE, HSIZE, XPIXEL, YPIXEL, IBACK, CBACK, CTEXT, HTEXT, FTEXT only), TITLE Supports: Run-group processing
PROC GKPI < MODE= BASIC | RAISED>; DIAL|HBULLET|HSLIDER|HTRAFFICLIGHT|SPEEDOMETER| VTRAFFICLIGHT|VBULLET|VSLIDER ACTUAL=data-value BOUNDS=bound-value-list </ options>;
Syntax
PROC GKPI <MODE= BASIC | RAISED>;
Options
PROC GKPI statement options affect all graphs produced by the procedure.
MODE=BASIC | RAISED
species the display mode of KPI chart images. The two choices are as follows: BASIC RAISED creates a two-dimensional image. creates a three-dimensional image.
The default mode is BASIC. See Specifying Basic or Raised Mode on page 1206 examples of each mode.
1216
Chapter 42
Description
The DIAL, HBULLET, HSLIDER, HTRAFFICLIGHT, SPEEDOMETER, VTRAFFICLIGHT, VBULLET, and VSLIDER statements specify the type of graphic to be used to display the key performance indicator. One of the following display types is required: DIAL species a dial. HBULLET | BULLET species a horizontal bullet graph (a horizontal bar with a horizontal line that represents the actual KPI value). HSLIDER | SLIDER species a horizontal bar with a triangle that marks the actual KPI value. HTRAFFICLIGHT species a horizontal trafc light. SPEEDOMETER species a speedometer. VTRAFFICLIGHT| TRAFFICLIGHT species a vertical trafc light. VBULLET species a vertical bullet graph (a vertical bar with a vertical line that represents the actual KPI value). VSLIDER species a vertical bar with a triangle that marks the actual KPI value. See Overview on page 1203 for examples of each display type.
Syntax
DIAL|HBULLET|HSLIDER|HTRAFFICLIGHT|SPEEDOMETER| VTRAFFICLIGHT|VBULLET|VSLIDER ACTUAL=data-value BOUNDS=(bounds-list) </ options>; option(s) can be one or more options from any or all of the following categories: 3 appearance options ACTIVECOLORS=(color_1 color_2 color_3 ...color_n-1) AFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>>)
1217
AVALUE | NOAVALUE BFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>>) BVALUE | NOBVALUE COLORS=(color_1 color_2 color_3 ...color_n-1) FORMAT=SAS-format LABEL= string LFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>> <j=justication>) LOWBOUNDARY | NOLOWBOUNDARY TARGET= data-value TYPE=FULL | HALF | QUARTER
Required Arguments
ACTUAL= data-value
species the actual value of the key performance indicator. The actual data value can fall outside the bounds specied with the BOUNDS= option, but the GKPI procedure will display the actual value indicator at the outermost edge of the KPI chart. If you specify a missing value (ACTUAL=.), then the GKPI procedure does not generate a KPI chart.
BOUNDS=(bound_1 bound_2 bound_3 ...bound_n)
species a list of dened boundary values. The values can be negative or positive, but you must specify the list in either ascending or descending order. Separate each boundary value with a blank space. See Specifying Segment Boundaries and Actual KPI Values on page 1208 for more information.
Options
You can specify as many options as needed and list them in any order.
ACTIVECOLORS=(color_1 color_2 color_3 ...color_n-1)
species the list of active colors for each segment (the colors that you want to use for each segment when that segment contains the actual KPI value). You do not have to specify a color for each segment in the KPI chart. The default colors shown in Figure 42.6 on page 1210 (or the colors specied by the COLORS= option) are used for each segment for which active colors are not specied. The number of entries in the ACTIVECOLORS= list cannot exceed the number of segments that are dened; that is, the maximum number of active colors is one less than the number of entries in the BOUNDS= list. Separate each color with either a blank space or a comma. See Controlling Segment Colors on page 1209 for more information.
AFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>>)
species the name, color, and text height for the font used for the actual KPI value label. For example AFONT=(f="Comic Sans MS" c=red h=15pt). See Specifying Fonts on page 1214 for more information.
1218
DIAL, HBULLET, HSLIDER, HTRAFFICLIGHT, SPEEDOMETER, VTRAFFICLIGHT, VBULLET, and VSLIDER Statements
Chapter 42
species whether to display the actual KPI value label. Alias: AVAL | NOAVAL
Default: AVALUE BFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>>)
species the name, color, and text height of the font used for the boundary and tick mark values. For example, BFONT=(font="Arial" color=H14055FF height=.25in). See Specifying Fonts on page 1214 for more information. If you increase the size of the font to the point where labels would collide, then the intermediate labels are not displayed. The GKPI procedure displays only the lowest and highest boundary labels.
Style reference: Font attribute of the GraphValueText element BVALUE | NOBVALUE
species the list of inactive colors for each segment (the colors that you want to be used for each segment when that segment does not contain the actual KPI value). You must specify a color for each segment in the KPI chart. That is, the number of entries in the COLORS= list must be one less than the number of entries in the BOUNDS= list. Separate each color with either a blank space or a comma. For all KPI charts except trafc lights, if you dene two to ve segments, the GKPI procedure applies a default set of colors ranging from red to green. If you dene only one or more than ve segments, the default color for all segments is gray. For trafc lights, the default color for all segments is gray. This option is ignored by the TRAFFICLIGHT statement if the ACTIVECOLORS= option is specied. See Controlling Segment Colors on page 1209 for more information.
DESCRIPTION= description
species the description of the output. The maximum length for the description is 256 characters. The description does not appear on the graph. The default is Key performance indicator. The descriptive text is shown in the description portion of each of the following: 3 the Results window.
3 the Table of Contents that is generated when you use the CONTENTS= option
on an ODS HTML statement. 3 the chart description for Web output. See Chart Descriptions for Web Presentations on page 598 for more information.
Alias:
DES=
FORMAT=SAS-format
species a SAS format for the boundary and actual values. The default format is BEST. For example, you can use format="percent8.0"to display values as percentages or format="datetime7." to display SAS datetime values in the format ddmmmyy.
DIAL, HBULLET, HSLIDER, HTRAFFICLIGHT, SPEEDOMETER, VTRAFFICLIGHT, VBULLET, and VSLIDER Statements 1219
See SAS Formats Supported for Java on page 474 for more information.
LABEL= string
species a label for the graphic. The label is displayed at the top of graph, beneath the title, if a title is specied. Note: By default, labels are displayed at the top center of the graphics output area, and the KPI chart is displayed in the center of the output area. To reduce the space between labels and the KPI chart, reduce the size of the graphics output area by specifying the XPIXELS=/YPIXELS= or HSIZE=/VSIZE= options on the GOPTIONS statement. See The Graphics Output and Device Display Areas on page 59 for more information. 4
LFONT=(<f=fontname</BOLD></ITALICS>> <c=color> <h=text-height<units>> <j=justication>)
species the name, color, and text height of the font to use for the label that is specied by the LABEL= option. You can also specify whether the label is left-justied, centered, or right-justied within the graphics output area. For example: LFONT=(f="Albany AMT/italics" c=cornflowerblue height=.25cm j=right). See the description of LABEL= and Specifying Fonts on page 1214 for more information.
Style reference: Font attribute of the GraphLabelText element LOWBOUNDARY | NOLOWBOUNDARY
species whether the KPI chart displays as if the KPI value falls in the lower range segment or the upper range segment when the actual KPI value falls directly on a segment boundary. This option controls the color that is used for dial centers, trafc lights, and actual value indicators. It also controls which segment is displayed in the active color, if an active color list is specied. The default is LOWBOUNDARY, which tells the GKPI procedure to use the color of the lower range segment. If you specify NOLOWBOUNDARY, then PROC GKPI uses the color of the higher range segment. Figure 42.8 on page 1220 illustrates the effect of this option on dial centers and on the actual KPI value indicator in a horizontal slider when both a segment boundary and the actual KPI value is 30.
1220
Examples
Chapter 42
Figure 42.8
Alias:
LOWBOUND | NOLOWBOUND
species the name of the graphics output le. The name can be up to 256 characters long, and uppercase characters are converted to lowercase. The default name is graph.png. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, graph1.png.
TARGET= data-value
species the numeric value of the target key performance indicator. If you specify a missing value (TARGET=.), then the GKPI procedure generates a KPI chart without a target value indicator. Restriction: Not supported by the TRAFFICLIGHT statement
TYPE=FULL | HALF | QUARTER
species the size of the display for speedometers. See Speedometer KPI Charts on page 1205 for more information.
Restriction: Valid for SPEEDOMETER statement only Default: FULL
Examples
The following examples illustrate major features of the GKPI procedure. Each of these examples uses the XPIXELS and YPIXELS options on the GOPTIONS statement to scale the KPI charts to a size that would be appropriate for use in a dashboard. These examples also specify STYLE=LISTING option on the ODS HTML statement, which produces a white background instead of the default gray background normally used by the HTML destination. Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the
1221
boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
PROC GKPI statement option: MODE=RAISED HSLIDER statement options: ACTUAL= BOUNDS= COLORS= ACTIVECOLORS= Sample Library Member: GKPGRSLD
The default colors described in Default Colors on page 1209 can be used as the active colors instead of the inactive colors. This example uses the same value of gray for all segments for the inactive color. It uses the red, orange, yellow-green, and green colors shown in Figure 42.6 on page 1210 as the active colors.
Set the graphics environment.
goptions reset=all device=javaimg xpixels=180 ypixels=110;
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
Generate the KPI chart. Specify the segment boundaries, actual KPI value, and colors. Boundary values can be positive or negative or both, but must be specied in either ascending or descending order. All colors are specied as hexadecimal RGB values. The same value of gray, cxB2B2B2, is used as the inactive color for all segments. The default colors listed in Table 42.1 on page 1210 are used as the active colors.
proc gkpi mode=raised; hslider actual=-6.7 bounds=(-10 -5 0 5 10) / colors=(cxB2B2B2 cxB2B2B2 cxB2B2B2 cxB2B2B2) activecolors=(cxD06959 cxE1A05D cxBDCD5F cx84AF5B); run;
1222
Chapter 42
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
PROC GKPI statement option: MODE=RAISED VBULLET statement options: ACTUAL= BOUNDS= COLORS= TARGET= Sample Library Member: GKPGRBUL
This example creates a vertical bullet graph. It uses a gray scale color scheme that provides a good contrast between segments. This color scheme can be used in output that is included in publications that are not in color.
Set the graphics environment.
goptions reset=all device=javaimg xpixels=130 ypixels=250;
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
1223
Generate the KPI chart. Specify the segment boundaries, actual KPI value, target value, and colors. The gray scale colors are specied using hexadecimal RGB values.
proc gkpi mode=raised; vbullet actual=.58 bounds=(0 .22 .38 .52 .68 1) / target=.75 colors=(cx747474 cx8C8C8C cxB2B2B2 cxD2D2D2 cxE6E6E6); run;
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
PROC GKPI statement option: MODE=RAISED DIAL statement options: ACTUAL= AFONT= BFONT= BOUNDS= FORMAT= NOLOWBOUND TARGET=
Sample Library Member: GKPDIAL
1224
Chapter 42
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
Generate the KPI chart. Specify the segment boundaries, actual KPI value, and target value. In this case, the target value falls on a segment boundary. The NOLOWBOUNDARY option species that the KPI chart behaves as if the actual KPI value falls in the higher range segment. The AFONT= and BFONT= options specify the fonts for the actual value and the boundary segment values, respectively. The FORMAT= option species the SAS format for the values in the chart.
proc gkpi mode=raised; dial actual=.46 bounds=(0 .23 .46 .65 .79 1) / target=.9 nolowbound format="percent8.0" afont=(f="Albany AMT" height=.5cm) bfont=(f="Albany AMT" height=.4cm) ; run;
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
PROC GKPI statement option: MODE=RAISED SPEEDOMETER statement options: ACTUAL= BOUNDS= COLORS= FORMAT= LABEL= LFONT= TARGET= Sample Library Member: GKPSPD
1225
Set the graphics environment. The XPIXELS and YPIXELS graphics options reduce the size of the graphics output area and, therefore, reduce both the size of the KPI chart and the distance between the label and the KPI chart.
goptions reset=all device=javaimg xpixels=210 ypixels=200;
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
Generate the KPI chart. Specify the segment boundaries, actual KPI value, and target value. The LFONT= option species the font for the label. The FORMAT= option species the SAS format for the values in the chart.
proc gkpi mode=raised; speedometer actual=.72 bounds=(0 .40 .60 1) / target=.85 lfont=(f="Albany AMT" height=.5cm) label="Average Capacity" format="percent8.0"; run;
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
PROC GKPI statement option: MODE=BASIC SPEEDOMETER statement options: ACTUAL= BOUNDS= COLORS= LABEL=
Sample Library Member: GKPSPCLR
1226
Chapter 42
Set the graphics environment. The XPIXELS and YPIXELS graphics options reduce the size of the graphics output area and, therefore, reduce both the size of the KPI chart and the distance between the label and the KPI chart.
goptions reset=all device=javaimg xpixels=210 ypixels=200;
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
Generate the KPI chart. Specify the segment boundaries, actual KPI value, target value, and colors. The green, yellow, and red colors listed in Table 42.1 on page 1210 are specied in reverse order so that green begins at zero.
proc gkpi mode=basic; speedometer actual=12 bounds=(0 25 50 100) / colors=(cx84AF5B cxF1DC63 cxD06959) label="Cancellations"; run;
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
PROC GKPI statement option: MODE=RAISED TRAFFICLIGHT statement options: ACTUAL= BOUNDS= COLORS= LABEL= NOAVALUE Sample Library Member: GKPTRAFF
1227
This example creates a trafc light that uses primary green, yellow, and red colors. Colors are applied to vertical KPI charts from the bottom up, so to get red at the top, you must specify red last in the list of colors.
Set the graphics environment. The XPIXELS and YPIXELS graphics options reduce the size of the graphics output area and, therefore, reduce both the size of the KPI chart and the distance between the label and the KPI chart.
goptions reset=all device=javaimg xpixels=120 ypixels=210;
Close the LISTING destination, and open the HTML destination. Closing the LISTING destination conserves resources. Specifying STYLE=LISTING produces a white background.
ods listing close; ods html style=listing;
Generate the KPI chart. Specify the segment boundaries, actual KPI value, and colors. The NOAVALUE option turns off the display of the actual KPI value. The colors are specied as SAS Registry Color names.
proc gkpi mode=raised; trafficlight actual=598 bounds=(1500 900 600 0) / colors=(green yellow red) noavalue label="New Subscriptions"; run;
End the procedure, and close the HTML destination. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure. You must close the destination to generate output.
quit; ods html close;
1228
1229
CHAPTER
43
The GMAP Procedure
Overview 1230 About Block Maps 1230 About Choropleth Maps 1231 About Prism Maps 1232 About Surface Maps 1233 Concepts 1234 About Map Data Sets 1234 About Traditional Data Sets 1234 Required Variables 1234 Segment Variable 1235 LONG and LAT Variables 1235 Traditional Map Data Sets Containing X, Y, LONG, and LAT Traditional Map Data Sets Containing Only X and Y 1236 About Feature Tables 1236 $GEOREF format 1236 Merging Feature Tables with Response Data Sets 1237 The METAMAPS Data Set 1237 Special Data Sets for Annotating Maps 1238 About Response Data Sets 1238 Using the Response Data Set with the Map Data Sets 1238 About Response Variables 1239 About Response Levels 1239 About Identication Variables 1240 Displaying Map Areas and Response Data 1240 Summary of Use 1241 Accessing SAS Maps Online 1241 Importing Maps from ESRI Shapeles 1241 Procedure Syntax 1242 PROC GMAP Statement 1242 ID Statement 1245 AREA Statement 1245 BLOCK Statement 1249 CHORO Statement 1259 PRISM Statement 1266 SURFACE Statement 1275 Using FIPS Codes and Province Codes 1279 Using Formats for Map Variables 1281 Using SAS/GRAPH Map Data Sets 1284 Accessing Detailed Descriptions of Map Data Sets 1284 Customizing SAS/GRAPH Map Data Sets 1284 Subsetting Traditional Map Data Sets 1285
1236
1230
Overview
Chapter 43
Reducing Traditional Map Data Sets 1285 Projecting Traditional Map Data Sets 1286 Controlling the Display of Lakes 1287 Creating Traditional Map Data Sets 1287 Creating a Unit Area that is a Single Polygon 1287 Creating a Unit Area that Contains Multiple Polygons 1288 Creating a Unit Area that Contains Enclosed Polygons as Holes Creating a Unit Area that Contains Another Area 1289 Examples 1290 Example 1: Producing a Simple Block Map 1291 Example 2: Specifying Response Levels in a Block Map 1292 Example 3: Assigning a Format to the Response Variable 1293 Example 4: Specifying the Statistic for the Response Variable 1295 Example 5: Producing a Simple Choropleth Map 1296 Example 6: Labeling Provinces on a Map 1298 Example 7: Producing a Simple Prism Map 1299 Example 8: Specifying Midpoints in a Prism Map 1301 Example 9: Producing a Simple Surface Map 1302 Example 10: Rotating and Tilting a Surface Map 1303 Example 11: Creating a Map Using the Feature Table 1304
1288
Overview
The GMAP procedure produces two-dimensional (choropleth) or three-dimensional (block, prism, and surface) maps that show variations of a variable value with respect to an area. A wide assortment of map data sets is available with SAS/GRAPH software. Use the GMAP procedure to perform the following tasks:
3 3 3 3
produce maps summarize data that vary by physical area show trends and variations of data between geographic areas highlight regional differences or extremes
1231
Figure 43.1
Block Map
The program for this map is in Example 1 on page 1291. For more information on producing block maps, see BLOCK Statement on page 1249. You can assign patterns to the areas in a block map by using the AREA statement. The values of the AREA variable are represented by the pattern of each map area, and the values of the response variable on the BLOCK statement are represented by the height of the blocks. For more information, see AREA Statement on page 1245.
1232
Chapter 43
Figure 43.2
The program for this map is in Example 5 on page 1296. You can also produce a simple choropleth map that shows an outline of a maps areas by specifying your map data set as both the map data set and the response data set in a GMAP statement and adding a PATTERN statement with VALUE=EMPTY. For more information on the PATTERN statement, see PATTERN Statement on page 238. For more information on producing choropleth maps, see CHORO Statement on page 1259.
1233
Figure 43.3
Prism Map
The program for this map is in Example 7 on page 1299. For more information on producing prism maps, see PRISM Statement on page 1266. You can also assign patterns to the areas in a prism map by using the AREA statement. The values of the AREA variable are represented by the pattern of each map area, and the values of the response variable on the PRISM statement are represented by the height of the map areas. For more information, see AREA Statement on page 1245.
1234
Concepts
Chapter 43
Figure 43.4
Surface Map
The program for this map is in Example 10 on page 1303. For more information on producing surface maps, see SURFACE Statement on page 1275.
Concepts
Map data sets and response data sets are used in the GMAP procedure. These data sets must contain the required variables or the procedure stops and you get an error message. The GMAP procedure can take as input a map data set and a response data set, provided that both data sets contain the same ID variable. Alternatively, you can use a single data set as input if it contains either the map data or a variable that references a map data set.
Required Variables
A traditional map data set must contain at least these variables:
1235
3 a numeric variable named Y that contains the vertical coordinates of the boundary
points. The value of this variable could be either projected or unprojected. If unprojected, Y represents latitude.
3 one or more variables that uniquely identify the areas in the map. Map area
identication variables can be either character or numeric and are indicated in the ID statement. The X and Y variable values in the traditional map data set do not have to be in any specic units. They are rescaled by the GMAP procedure based on the minimum and maximum values in the data set. The minimum X and Y values are in the lower-left corner of the map, and the maximum X and Y values are in the upper-right corner. Map data sets in which the X and Y variables contain longitude and latitude should be projected before you use them with PROC GMAP. See Chapter 46, The GPROJECT Procedure, on page 1385 for details.
Segment Variable
The traditional map data set can also contain an optional variable named SEGMENT to identify map areas that comprise noncontiguous polygons. Each unique value of the SEGMENT variable within a single map area denes a distinct polygon. If the SEGMENT variable is not present, each map area is drawn as a separate closed polygon that indicates a single segment. The observations for each segment of a map area in the map data set must occur in the order in which the points are to be joined. The GMAP procedure forms map area outlines by connecting the boundary points of each segment in the order in which they appear in the data set, eventually joining the last point to the rst point to complete the polygon. All the segments for each ID value must be contiguous within the map data set.
3 a numeric variable named LONG containing the unprojected longitude (in radians
or degrees) of the boundary points
3 a numeric variable named LAT containing the unprojected latitude (in radians or
degrees) of the boundary points The GMAP procedure uses the values of the X and Y variables to draw the map. To use the unprojected values to produce a custom map, rename LONG and LAT to X and Y, and then do the following tasks:
1 Rename the LONG and LAT variables to X and Y. 2 Project the coordinates by using the GPROJECT procedure. 3 Use the output data set from GPROJECT as your map data set.
1236
Chapter 43
The MAP= value in the GMAP procedure automatically uses X and Y. See Input Map Data Sets that Contain Both Projected and Unprojected Values on page 1388 for more details.
$GEOREF format
The $GEOREF format stores spatial information in binary data streams, making it possible to store as a single variable value all the information needed to draw a map area. Thus, the feature tables use only a single observation for each map area, and they treat a eld of spatial information just like any other information that can be added to a data set. Each $GEOREF value contains the name of the map data set and the ID variable for that map. The traditional map data set associated with the feature table must be located in the SAS library with the feature table for GMAP to proceed correctly. The names of the feature tables that are supplied by SAS usually end with the number 2. For example, the feature table for MAPS.AFRICA is MAPS.AFRICA2. You can also determine the feature table for your map data set by referring to the MAPS.METAMAPS data set. To locate the variable that contains the spatial information, run PROC CONTENTS on a feature table. In the Output window, the variable containing the spatial information has $GEOREF as the value in the column labeled Format. Note: Some feature tables, like MAPS.CANCENS, have more than one $GEOREF format variable. 4
1237
F_GEOCOL
For example, consider the data sets MAPS.ASIA, MAPS.STATES, and MAPS.US. Each of these represents a geometry table, and to locate the corresponding feature tables, you would look in MAPS.METAMAPS to nd the MEMNAME values ASIA, STATES, and US. Here are the relevant values on those rows:
Table 43.1 Values from the METAMAPS Data Set
MEMCODE G G G F_TABLE ASIA2 US2 US2 F_GEOCOL CONT95_GEO GEO_STATE _MAP_GEOMETRY_
From these values, you can see that the data sets that are named ASIA, STATES, and US all represent geometry tables because their MEMCODE values are G. The feature table corresponding to the ASIA data set is the data set ASIA2, which stores the spatial information in the variable CONT95_GEO. The feature tables corresponding to STATES and US are both in the data set US2. The spatial information corresponding to STATES is stored in the variable GEO_STATE, and the spatial information corresponding to US is stored in the variable _MAP_GEOMETRY_.
1238
Chapter 43
3 one or more response variables that contain data values that are associated with
map areas. Each value of the response variable is associated with a map area in the map data set.
3 identication variables that identify the map area to which a response value
belongs. These variables must be the same as those that are contained in the map data set. The response data set can contain other variables in addition to these required variables.
Using the Response Data Set with the Map Data Sets
The traditional map data set and the response data set must be used independently in the PROC GMAP statement, where the response data set is specied by the DATA= option and the traditional map data set is specied by the MAP= option. The values of the map area ID variables in the response data set determine the map areas to be included on the map. Unless the ALL option is used in the PROC GMAP statement, only the map areas with response values are shown on the map. As a result, you do not need to subset your map data set if you are mapping only a small section of the map. However, if you map the same small section frequently, then create a subset of the map data set for efciency. If you have a response data set named WORK.SITES, then the syntax for using GMAP might resemble the following:
proc gmap map=maps.us data=work.sites; id state;
1239
To use data from both a feature table and response data set, merge the two data sets by using a variable that is contained in both data sets. The new combined data set becomes the DATA= value in the PROC GMAP statement. When the response data set and the feature table are merged into one, do not use MAP=map-data-set in the PROC GMAP statement. The $GEOREF formatted variable is the ID variable for the combined data set. See Example 11 on page 1304 for more details. Note: Response data that does not correspond to a map feature is included in the legend. 4
1240
Chapter 43
If the response variable values are continuous, then the GMAP procedure assigns response level intervals automatically unless you specify otherwise. The response levels represent a range of values rather than a single value. When response levels are determined by specic numeric values, and the DISCRETE option is specied, one level is created for each value. If the response variable has an associated format, then each formatted value is represented by a different response level. The AREA, BLOCK, CHORO, and PRISM statements assign patterns to response levels. In CHORO and PRISM maps, response levels are shown as map areas. However, in BLOCK maps, response levels are shown as blocks. If you specify the AREA statement on a BLOCK map, then the response levels for AREA variable are shown as map areas. The default ll pattern for the response level is solid. PATTERN statements can dene the ll patterns and colors for both blocks and map areas. PATTERN denitions that dene valid block patterns are applied to the blocks (response levels), and PATTERN denitions that dene valid map patterns are applied to map areas. See PATTERN Statement on page 238 for more information on ll pattern values and default pattern rotation.
If the response data set . . . includes the map area includes the map area
1241
And if . . . the response value for the map area is a missing value and the MISSING option is used in the map statement the ALL option is used in the PROC GMAP statement the ALL option is not used
Then the procedure . . . draws the map area and displays a response level for the missing value draws the map area but leaves it empty does not draw the map area
does not include the map area does not include the map area
Summary of Use
To use the GMAP procedure, you must do the following: 1 If using a traditional map data set, determine what processing needs to be done to the map data set before it is displayed. Use the GPROJECT, GREDUCE, and GREMOVE procedures or a DATA step to perform the necessary processing. 2 Issue a LIBNAME statement for the SAS data set that contains the response data set, or use a DATA step to create a response data set. 3 If using a traditional map data set, use the PROC GMAP statement to identify the map data set as the MAP= value and response data set as the DATA= value. 4 If using a feature table, use PROC SORT to individually sort the feature table and response data set by a variable common to both data sets. Next, use SQL or the DATA step MERGE to merge the feature table with the response data set by using a variable common to both data sets. Use the combined data set as the DATA= value in the PROC GMAP statement (do not include MAP= in the PROC GMAP statement). 5 Use the ID statement to specify the id-variables or, if you are using a feature table, specify the geo-variable. 6 Use a BLOCK, CHORO, PRISM, or SURFACE statement to identify the response variable and generate the map.
After downloading and unzipping map data sets, you must take them out of transport format by running the CIMPORT procedure using your current version of SAS. For more information, see Appendix 4, Transporting and Converting Graphics Output, on page 1651.
1242
Procedure Syntax
Chapter 43
Procedure Syntax
Requirements: One ID statement, and at least one CHORO, BLOCK, PRISM, or SURFACE statement is required. Global statements:
Reminder: The GMAP procedure can include the BY, FORMAT, LABEL, and WHERE statements as well as the TITLE, NOTE, and FOOTNOTE statements. Supports:
RUN-group processing
PROC GMAP <MAP=map-data-set> DATA=response-data-set | feature-table <ALL> <ANNOTATE=Annotate-data-set> <DENSITY=0...6 | LOW | MEDIUM | HIGH> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set> <STRETCH> <UNIFORM>; ID id-variable(s) | geo-variable; AREA response-variable </ option(s)>; BLOCK response-variable(s) </ option(s)>; CHORO response-variable(s) </ option(s)>; PRISM response-variable(s)</ option(s)>; SURFACE response-variable(s) </ option(s)>;
PROC GMAP <MAP=map-data-set> DATA=response-data-set | feature-table <ALL> <ANNOTATE=Annotate-data-set> <DENSITY=0...6 | LOW | MEDIUM | HIGH> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set> <STRETCH> <UNIFORM>;
1243
Required Argument
DATA=response-data-set | feature-table
identies the SAS data set that contains the response values or the response values and the spatial information that are evaluated and represented on the map. If a response data set is specied, it must contain the same identication variable or variables as the map data set, along with the values of the response variable. If a feature table is specied, it must contain response data information and spatial geometry information. By default, the GMAP procedure uses the most recently created SAS data set.
See Also:
Concepts on page 1234, SAS Data Sets on page 54, and About Feature Tables on page 1236.
Options
PROC GMAP statement options affect all of the graphs that are produced by the procedure.
ALL
species that the maps generated by the procedure should include all of the map areas from the map data set, even if the response data set does not include an observation for the map area. When you use the ALL option and a BY statement in a RUN group, the maps generated for each BY group include every map area from the map data set.
See also: Displaying Map Areas and Response Data on page 1240. ANNOTATE=Annotate-data-set
species a data set to annotate all of the maps that are produced by the GMAP procedure. To annotate individual maps, use the ANNOTATE= option in the action statement.
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643 DENSITY=0...6 | LOW | MEDIUM | HIGH
for maps that have a DENSITY variable, species the density of map observations that are used. The value that you specify indicates the maximum value that the DENSITY variable can have for the observation to be displayed. For example, if you specify DENSITY=5, then only observations in the map data set whose DENSITY value is less than or equal to 5 are displayed. Intuitively, the DENSITY variable species how close a map point is to other map points. If there are many map points in close proximity (high density), then it is possible to eliminate a number of them without seriously degrading the quality of the map. Many map data sets supplied by SAS contain a DENSITY variable. For map data sets that do not contain a DENSITY variable, you can add and populate the variable using the GREDUCE procedure. You can specify an integer from 0 to 6 for the DENSITY option, or you can specify one of the following: LOW = 1, MEDIUM = 3, HIGH = 6. If you do not specify the DENSITY option, then all the observations in a map data set are displayed, regardless of whether the data set contains a DENSITY variable or not. This is equivalent to specifying DENSITY=6.
Alias:
RESOLUTION=, RES=
Restriction: If the map data set does not contain a column of DENSITY values,
1244
Chapter 43
See also: Chapter 48, The GREDUCE Procedure, on page 1437 for information on
species the SAS catalog in which to save the graphics output that is produced by the GMAP procedure for later replay. You can use the GREPLAY procedure to view the graphs stored in the catalog. If you do not use the GOUT= option, catalog entries are written to the default catalog WORK.GSEG, which is erased at the end of your session.
Restriction: Not supported by Java and ActiveX See also: Specifying the Catalog Name and Entry Name for Your GRSEGs on
page 100
IMAGEMAP=output-data-set
creates a temporary SAS data set that contains information about the graph that is replayed from the graphics catalog. The information in the image map data set includes the shape and coordinates of the elements in the graph, along with values that were associated with those elements in variables that were identied for that purpose in the HTML= or HTML_LEGEND= options. The image map data set can be used to generate an HTML image map in an HTML output le using the IMAGEMAP macro. The IMAGEMAP macro takes two arguments, the name of the image map data set and the name or leref of an HTML output le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
names a SAS traditional map data set that contains the X and Y coordinates for the boundary points of each map area. The traditional map data set must contain the same identication variable or variables as the response data set being used. This statement is required if a feature table is not being used.
See also: About Traditional Data Sets on page 1234. STRETCH
stretches map extents to cover all available space in the device. This might cause the map to be distorted. When this option is applied to the PROC GMAP statement, it applies to all statements. If applied to a single statement, it applies only to that statement.
Restriction: Not supported by Java and ActiveX. UNIFORM
causes the same legend and coloring to be used for all maps produced by the procedure instead of being calculated within each BY group for each map. The UNIFORM option pre-scans the data to generate a categorization across all the data, regardless of BY grouping, and applies that categorization to all maps in the BY group. This results in a static legend and color distribution across all maps such that a single value always has the same color in multiple maps. When specied on a PROC GMAP statement, UNIFORM applies to all BLOCK, CHORO, AREA, and PRISM statements included within the GMAP run-group. When omitted from the PROC GMAP statement, and specied on an individual BLOCK, AREA, CHORO, or PRISM statement, UNIFORM applies only to the maps produced by that statement.
Restriction: Not supported by Java.
AREA Statement
1245
ID Statement
Identies the variable or variables in the input data set(s) that dene map areas.
Requirements:
ID id-variable(s) | geo-variable;
Required Arguments
id-variable(s)
identies one or more variables in the map and response data sets that dene map area. This argument is used only when map and response data sets are specied. If a feature table is specied, then specify a geo-variable instead. Every variable that is listed in the ID statement must appear in both the map and response data sets. The variable identied by the id-variable(s) argument can be of type numeric or character and should have the same name, type, and length in both the response and map data sets. Note: If the ID variables in the response data set and map data set do not have the same length, then your map areas might not be drawn correctly. 4 Featured in: Example 1 on page 1291, Example 3 on page 1293, and Example 5 on page 1296 See also: About Identication Variables on page 1240
geo-variable
identies the $GEOREF formatted variable in the feature table containing the spatial geometry information for the map. The variable identied by the geo-variable argument must be of character type. Featured in: Example 11 on page 1304 See also: About Identication Variables on page 1240
AREA Statement
Applies color to the regions in BLOCK and PRISM maps based on values of a specied response variable.
Requirements: The response variable is required. The AREA statement must be used in conjunction with either a BLOCK or PRISM statement.
Description
In the case of BLOCK: whereas the BLOCK statement controls the color and appearance of the blocks, the AREA statement controls the color and appearance of the regions under the block. In the case of PRISM: whereas the PRISM statement controls the height of the prism, the AREA statement controls the color of the region. If you specify an AREA statement, the PRISM statement controls both the color and height.
1246
AREA Statement
Chapter 43
AREA response-variable < / option(s)>; The option(s) argument can be one or more of the following: DISCRETE LEGEND=LEGEND<1...99> LEVELS=number-of-response-levels | ALL MIDPOINTS=value-list | OLD MISSING NOLEGEND PERCENT RANGE STATISTIC=FIRST | SUM | FREQUENCY | MEAN STATFMT= format-specication UNIFORM
Required Arguments
response-variable
species the variable in the response data set or in the merged response and feature table if they contain response values that are to be represented on the map. Areas that correspond to response variables with missing values are not colored unless you use the MISSING option in the AREA statement. This variable is represented in all BLOCK and PRISM maps in the same RUN group. See also: About Response Variables on page 1239.
Options
Options in an AREA statement affect all of the maps that are produced by that statement. You can specify as many options as you want and list them in any order. All of these options are the same as the normal GMAP options except that they apply to the areas of regions only, and not to the bar heights. Here is an example:
BLOCK ELECT / LEVELS=5; AREA CANDIDATE / DISCRETE NOLEGEND;
This produces a block map where there are ve levels categorized for the blocks. Regions under the blocks are colored by DISCRETE CANDIDATE. No legend is shown for the CANDIDATE values, but a legend is shown for the ELECT values.
DISCRETE
generates a separate response level (color and surface pattern) for each different value of the formatted response variable. The LEVELS= option is ignored when you use the DISCRETE option. If you specify the DISCRETE option, then distinct, non-continuous colors are used for the response values. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. Note: If the data does not contain a value in a particular range of the format, that formatted range is not displayed in the legend. 4
LEGEND=LEGEND<1...99>
species the LEGEND statement to associate with the map. The LEGEND= option is ignored if the specied LEGEND denition is not currently in effect. In the GMAP
AREA Statement
1247
procedure, the BLOCK statement produces a legend unless you use the NOLEGEND option. If you use the SHAPE= option in a LEGEND statement, only the value BAR is valid. Most of the LEGEND options described in LEGEND Statement on page 223 are supported by both Java and ActiveX. If a LEGEND option is not supported by Java or ActiveX, it is noted in the LEGEND option denition.
Restriction: Partially supported by Java and ActiveX See also: LEGEND Statement on page 223 LEVELS=number-of-response-levels | ALL
species the number of response levels to be graphed when the response variables are numeric and the DISCRETE and MIDPOINTS= options are not specied. Each response level is assigned a different surface pattern and color combination. The prism and block heights are based on the data value of the corresponding response variable. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. The response values are assigned lighter and darker values of a color scheme to express lower and higher response values. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. If neither the LEVELS= option nor the DISCRETE option is used, then the GMAP procedure determines the number of response levels by using the formula FLOOR(1+3.3 log(n)), where n is the number of response variable values. By default, an equal-distribution (quantizing) algorithm is used to determine each level. The LEVELS= option is ignored when you use the DISCRETE or MIDPOINTS=value-list option. When MIDPOINTS=OLD is used with the LEVELS= option, default midpoints are generated using the Nelder algorithm (Applied Statistics 25:947, 1976).
MIDPOINTS=value-list | OLD
species the response levels for the range of response values that are represented by each level (pattern and color combination). For numeric response variables, value-list is either an explicit list of values or a starting and an ending value with an interval increment, or a combination of both forms: n <...n> n TO n <BY increment> n <...n > TO n <BY increment> <n<...n>> By default, the increment value is 1. You can specify discrete numeric values in any order. In all forms, n can be separated by blanks or commas. For example,
midpoints=(2 4 6) midpoints=(2,4,6) midpoints=(2 to 10 by 2)
If a numeric variable has an associated format, the specied values must be the unformatted values. With numeric response values, DEVICE=JAVA uses only midpoints that fall in the range of the data being used. Thus, if your data ranged from 3080, but midpoints were specied at 25, 50, 75, and 100, only 50 and 75 are used. For character response variables, value-list is a list of unique character values enclosed in quotes and separated by blanks: value-1 <...value-n>
midpoints="Midwest" "Northeast" "Northwest"
1248
AREA Statement
Chapter 43
Specify the values in any order. If a character variable has an associated format, the specied values must be the formatted values. Character response values specied with the MIDPOINTS= option are not supported by DEVICE=JAVA. You can selectively exclude some response variable values from the map, as shown here:
midpoints="Midwest"
Only those observations for which the response variable exactly matches one of the values listed in the MIDPOINTS= option are shown on the map. As a result, observations might be excluded inadvertently if values in the list are misspelled or if the case does not match exactly. Specifying MIDPOINTS=OLD generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). Restriction: Partially supported by Java See also: The RANGE option
MISSING
causes GMAP to collect all response values (or their statistic) and chart each region as a percentage of the whole. You can use the STATISTICS= option to change how the percentage is calculatedwhether as a percentage of the SUM, FREQUENCY, or MEAN. If you do not use the STATISTICS= option, then STATISTICS=FIRST is assumed and the response variable of only the rst observation of each region is counted. If the response variable is a text eld, then STATISTIC=FREQUENCY is used, even if you specify a different value for the STATISTIC= option. Alias: PERCENTAGE See also: The STATFMT= option on page 1248, and the STATISTIC= option on page 1248
RANGE
causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specied with the MIDPOINTS= option (instead of displaying just the midpoints). For example, if MIDPOINTS=15 25 35, then the legend could show 10-20, 20-30, 30-40. Restriction The MIDPOINTS= option must be specied for the RANGE option to have any effect. Not supported by ActiveX.
STATFMT=format-specication
overrides the GMAP default format for percent of PERCENT8.2. Use this format when using calculated values. The STATFMT option is typically used when the STATISTIC=FREQUENCY option or the PERCENT option is used. Alias: SFMT=, SFORMAT=, STATFORMAT=
STATISTIC=FIRST | SUM | FREQUENCY | MEAN
species the statistic for GMAP to chart. For nonnumeric variables, FREQUENCY is the only allowed valueany other value is changed to FREQUENCY and a warning is issued. The frequency of a variable does not include missing values unless the MISSING option is specied. FIRST GMAP matches the rst observation from the DATA= data set and charts the response value from this observation only. This is
BLOCK Statement
1249
the default. If more rows exist that are not processed, a warning is issued to the log. SUM FREQUENCY MEAN All observations matching a given ID value are added together and the summed value is charted. A count of all rows with non-missing values is charted unless you specify the MISSING option. All observations matching a given ID value are added together and then divided by the number of non-missing observations matched. This value is then charted unless you specify the MISSING option. STAT=
Alias:
UNIFORM
causes the same legend and coloring to be used for all maps produced by the procedure instead of being calculated within each BY group for each map. The UNIFORM option prescans the data to generate a categorization across all the data, regardless of BY grouping, and applies that categorization to all maps in the BY group. This results in a static legend and color distribution across all maps such that a single value always has the same color in multiple maps. When specied on a PROC GMAP statement, the UNIFORM option applies to all AREA, BLOCK, CHORO, and PRISM statements included within the GMAP run-group. When omitted from the PROC GMAP statement, and specied on an individual AREA, BLOCK, CHORO, or PRISM statement, the UNIFORM option applies only to the maps produced by that statement. Restriction: Not supported by Java.
BLOCK Statement
Creates three-dimensional block maps on which levels of magnitude of the specied response variables are represented by blocks (bars) of varying height, pattern, and color.
Requirements: At least one response variable is required. The ID statement must be used in conjunction with the BLOCK statement. Global statements: FOOTNOTE, LEGEND, PATTERN, TITLE
Description
The BLOCK statement species the variable or variables that contain the data that are represented on the map by blocks of varying height, pattern, and color. This statement automatically performs the following operations: 3 determines the midpoints ranges. 3 scales the blocks. 3 assigns patterns to the block faces and map areas. (See About Block Maps and Patterns on page 1258 for more information.) You can use statement options to enhance the appearance of the map. For example, you can specify the width and shape of the blocks, the outline colors for the blocks and the map areas, and the angle of view. Other statement options control the response levels.
1250
BLOCK Statement
Chapter 43
In addition, you can use global statements to modify the block patterns, the map patterns, and the legend, as well as to add titles and footnotes to the map. You can also use an Annotate data set to enhance the map. BLOCK response-variable(s) </ option(s)>; The option(s) argument can be one or more of the following:
3 appearance options:
ANNOTATE=Annotate-data-set BLOCKSIZE=size CBLKOUT=block-outline-color | SAME CDEFAULT=empty-area-ll-color CEMPTY=empty-area-outline-color COUTLINE=area-outline-color | SAME SHAPE=3D-block-shape STRETCH UNIFORM WOUTLINE=block-outline-width XSIZE=map-width <units> YSIZE=map-height <units> XVIEW=x YVIEW=y ZVIEW=z
3 mapping options:
AREA=n | column-name DISCRETE LEVELS=number-of-response-levels | ALL MIDPOINTS=value-list | OLD MISSING PERCENT | PERCENTAGE RANGE RELZERO STATISTIC=FIRST | SUM | FREQUENCY | MEAN STATFMT=format-specication
3 legend options:
CTEXT=text-color LEGEND=LEGEND<1...99> NOLEGEND
3 description options:
DESCRIPTION=description NAME=name
3 ODS options
HTML=variable HTML_LEGEND=variable
BLOCK Statement
1251
Required Arguments
response-variable(s)
species one or more variables in the response data set, or in the merged response and feature table, that contain response values that are to be represented on the map. Each response variable produces a separate map. All variables must be in the input data set. Multiple response variables are separated with blanks. Blocks are not drawn for the response variable with missing values unless you use the MISSING option in the BLOCK statement. See also: About Response Variables on page 1239.
Options
Options in a BLOCK statement affect all of the maps that are produced by that statement. You can specify as many options as you want and list them in any order.
ANNOTATE=Annotate-data-set
species a data set to annotate onto maps that are produced by the BLOCK statement. Annotate coordinate systems 1, 2, 7, and 8 are not valid with block maps. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643.
AREA=n | column-name
species that a different map pattern be used for the surface of each map area or group of map areas on the map. You can specify pattern lls or colors or both with PATTERN statements that specify map/plot patterns. A separate PATTERN denition is needed for each specied area. AREA=n The value of n indicates which variable in the ID statement determines the groups that are distinguished by a surface pattern. By default, all map unit areas are drawn using the same surface ll pattern. If your ID statement has only one map area identication variable, then use AREA=1 to indicate that each map area surface uses a different pattern. If you have more than one variable in your ID statement, then use n to indicate the position of the variable that denes groups that share a pattern. When you use the AREA= option, the map data set should be sorted in order of the variables in the ID statement.
AREA=columnname
A column name dened in either the MAP= or DATA= data sets might be indicated with the column-name value. If the column name exists in both the MAP= and DATA= data sets, the column in the MAP= data set is used. When column-name is used, the areas are colored based on the AREA= value. Duplicate AREA= values might have different patterns assigned. See also: AREA Statement on page 1245, PATTERN Statement on page 238. species the width of the blocks. The unit of size is the character cell width for the selected output device. By default, BLOCKSIZE=2. Alias: BS=
BLOCKSIZE=size
CBLKOUT=block-outline-color | SAME
outlines all blocks in the specied color. The SAME value species that the outline color of a block, a block segment, or a legend is the same as the interior pattern color.
1252
BLOCK Statement
Chapter 43
The default outline color is determined by the current style. If you specied the NOGSTYLE system option, then the default color is black for Java and ActiveX and the rst color in the color list for all other devices. The CBLKOUT= option is not valid when SHAPE=CYLINDER. Note: If you specify empty block patterns (VALUE=EMPTY in a PATTERN statement), you should not change the outline color from the default value, SAME, to a single color. Otherwise all the outlines are one color and you can distinguish between empty areas only by their size. Empty block patterns (VALUE=EMPTY in a PATTERN statement) are not supported by DEVICE=JAVA. 4
Alias:
CBLOCK=
Style reference: The Color attribute of the GraphOutlines style element Restriction: Partially supported by Java CDEFAULT=empty-area-ll-color
lls empty map areas in the specied color. This option affects only map areas that are empty. Empty map areas are generated in block maps only when a map area is omitted from the response data set and the ALL option is included in the PROC GMAP statement. The default is NONE, which draws the polygon empty, showing the background in the ll area of the polygon.
Alias:
CDEF=, DEFCLR=
Restriction: Not supported by Java See also: The CEMPTY option, the ALL on page 1243 option, and Displaying Map
outlines empty map areas in the specied color. This option affects only map areas that are empty. Empty map areas are generated in block maps only when a map area is omitted from the response data set and the ALL option is included in the PROC GMAP statement. The default outline color is the same as the default COUTLINE= color.
Alias:
CE=
Restriction: Not supported by Java See also: The ALL option on page 1243 and Displaying Map Areas and Response
outlines non-empty map areas in the specied color. When COUTLINE=area-outline-color and DEVICE=JAVA or ACTIVEX, both empty and nonempty map areas are outlined. The SAME value species that the outline color of a map area is the same as the interior pattern color. The default outline color is determined by the current style. If you specied the NOGSTYLE system option, then the default color is black for Java and ActiveX and the rst color in the color list for all other devices. Note: If you specify empty map patterns (VALUE=EMPTY in a PATTERN statement), then you should not change the outline color from the default value SAME. Otherwise all the outlines are one color and you cannot distinguish between the empty areas. Empty block patterns (VALUE=EMPTY in a PATTERN statement) are not supported by DEVICE=JAVA. 4
Alias:
CO=
Style reference: The Color attribute of the GraphOutlines style element Restriction: Partially supported by Java
BLOCK Statement
1253
CTEXT=text-color
species a color for the text in the legend. If you omit the CTEXT= option, a color specication is searched for in this order: 1 the CTEXT= option in a GOPTIONS statement. 2 the default, the text color that is specied in the current style. 3 if you specify NOGSTYLE, then the default color is black for Java and ActiveX and the rst color in the color list for all other devices. The CTEXT= color specication is overridden if you also use the COLOR= suboption of a LABEL= or VALUE= option in a LEGEND denition that is assigned to the map legend. The COLOR= suboption determines the color of the legend label or the color of the legend value descriptions, respectively. Alias: CT= Style reference: The Color attribute of the GraphValueText style element
DESCRIPTION=description
species a descriptive string up to 256 characters long, that appears in the description eld of the catalog entry for the map. The description does not appear on the map. By default, the GMAP procedure assigns a description of the form BLOCK MAP OF variable, where variable is the name of the map variable. The descriptive text is shown in each of the following: 3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS HTML statement, assuming that the procedure output is generated while the contents page is open 3 the Description eld of the PROC GREPLAY window 3 the chart description for Web output (depending on the device driver). For more information, see PROC GANNO Statement on page 914.
Alias:
DES=
DISCRETE
generates a separate response level (color and surface pattern) for each different value of the formatted response variable. The LEVELS= option is ignored when you use the DISCRETE option. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. Note: If the data does not contain a value in a particular range of the format, that formatted range is not displayed in the legend. 4
HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with an area of the map and point to the data or graph you want to display when the user drills down on the area.
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with a legend value and point to the data or graph you want to display in response to drill-down input from the user. Restriction: Not supported by Java and ActiveX
1254
BLOCK Statement
Chapter 43
LEGEND=LEGEND<1...99>
species the LEGEND statement to associate with the map. The LEGEND= option is ignored if the specied LEGEND denition is not currently in effect. In the GMAP procedure, the BLOCK statement produces a legend unless you use the NOLEGEND option. If you use the SHAPE= option in a LEGEND statement, only the value BAR is valid. Most of the LEGEND options described in LEGEND Statement on page 223 are supported by both Java and ActiveX. If a LEGEND option is not supported by Java or ActiveX, it is noted in the LEGEND option denition. Restriction: Partially supported by Java and ActiveX See also: LEGEND Statement on page 223
LEVELS=number-of-response-levels | ALL
species the number of response levels to be graphed when the response variables are numeric and the DISCRETE and MIDPOINTS= options are not specied. Each response level is assigned a different surface pattern and color combination. The block height is based on the data value of the corresponding response variable. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. The response values are assigned lighter and darker values of a color scheme to express lower and higher response values. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. Note: If you specied the NOGSTYLE system option, then non-continuous colors are used by default. 4 If neither the LEVELS= option nor the DISCRETE option is used, then the GMAP procedure determines the number of response levels by using the formula FLOOR(1+3.3 log(n)), where n is the number of response variable values. By default, an equal-distribution (quantizing) algorithm is used to determine each level. The LEVELS= option is ignored when you use the DISCRETE or MIDPOINTS=value-list option. When MIDPOINTS=OLD is used with the LEVELS= option, default midpoints are generated using the Nelder algorithm (Applied Statistics 25:947, 1976).
MIDPOINTS=value-list | OLD
species the response levels for the range of response values that are represented by each level (pattern and color combination). For numeric response variables, value-list is either an explicit list of values or a starting and an ending value with an interval increment, or a combination of both forms: n <...n> n TO n <BY increment> n <...n > TO n <BY increment> <n<...n>> By default, the increment value is 1. You can specify discrete numeric values in any order. In all forms, n can be separated by blanks or commas. For example:
midpoints=(2 4 6) midpoints=(2,4,6) midpoints=(2 to 10 by 2)
If a numeric variable has an associated format, the specied values must be the unformatted values. With numeric response values, DEVICE=JAVA uses only midpoints that fall in the range of the data being used. Thus, if your data ranged from 3080, but midpoints were specied at 25, 50, 75, and 100, only 50 and 75 are used. For character response variables, value-list is a list of unique character values enclosed in quotes and separated by blanks:
BLOCK Statement
1255
value-1 <...value-n>
midpoints="Midwest" "Northeast" "Northwest"
Specify the values in any order. If a character variable has an associated format, the specied values must be the formatted values. Character response values specied with the MIDPOINTS= option are not supported by DEVICE=JAVA. You can selectively exclude some response variable values from the map, as shown here:
midpoints="Midwest"
Only those observations for which the response variable exactly matches one of the values listed in the MIDPOINTS= option are shown on the map. As a result, observations might be excluded inadvertently if values in the list are misspelled or if the case does not match exactly. Specifying MIDPOINTS=OLD generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976).
Featured in:
Restriction: Partially supported by Java See also: The RANGE option MISSING
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default GRSEG name is GMAP. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GMAP1.
NOLEGEND
causes GMAP to collect all response values (or their statistic) and chart each region as a percentage of the whole. You can use the STATISTIC= option to change how the percentage is calculatedwhether as a percentage of the SUM, FREQUENCY, or MEAN. If you do not use the STATISTIC= option, then STATISTIC=FIRST is assumed and the response variable of only the rst observation of each region is counted. If the response variable is a text eld, then STATISTIC=FREQUENCY is used, even if you specify a different value for the STATISTIC= option.
Alias:
PERCENTAGE
See also: The STATFMT= option on page 1256, and the STATISTIC= option on page
1256
RANGE
causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specied with the MIDPOINTS= option (instead of displaying just the midpoints). For example, if MIDPOINTS=15 25 35, then the legend could show 10-20, 20-30, 30-40.
Restriction MIDPOINTS= must be specied for the RANGE option to have any
1256
BLOCK Statement
Chapter 43
RELZERO
creates bars and regions that are relative to a zero value. By default, GMAP creates heights that are relative to the minimum value, which might or might not be zero. With the RELZERO option, zero value bars have no height. Alias: REL0, RELATIVETOZERO Restriction This option works only for variables that have no negative values.
SHAPE=3D-block-shape
species the shape of the blocks. Use this option to enhance the look of the block shape, or to specify a different shape. Unless you specify SHAPE=OLD, only solid ll patterns are used. The value of 3D-block-shape can be one of the following: 3 BLOCK | B 3 CYLINDER | C 3 HEXAGON | H 3 OLDBLOCK | OLD 3 PRISM | P 3 STAR | S SHAPE=BLOCK is the default. OLDBLOCK is the same as BLOCK except that with OLDBLOCK the tops and sides of blocks are colored the same as the background, as was the case before SAS 9.2. The CBLKOUT= option is not valid when SHAPE=CYLINDER. Default: BLOCK
STATFMT=format-specication
overrides the GMAP default format for percent of PERCENT8.2. Use this format when using calculated values. The STATFMT option is typically used when the STATISTIC=FREQUENCY option or the PERCENT option is used. Alias: SFMT=, SFORMAT=, STATFORMAT=
STATISTIC=FIRST | SUM | FREQUENCY | MEAN
species the statistic for GMAP to chart. For character variables, FREQUENCY is the only allowed valueany other value is changed to FREQUENCY and a warning is issued. The frequency of a variable does not include missing values unless the MISSING option is specied. FIRST GMAP matches the rst observation from the DATA= data set and charts the response value from this observation only. This is the default. If more rows exist that are not processed, a warning is issued to the log. All observations matching a given ID value are added together and the summed value is charted. A count of all rows with nonmissing values is charted unless you specify the MISSING option. All observations matching a given ID value are added together and then divided by the number of nonmissing observations matched. This value is then charted unless you specify the MISSING option. STAT= Example 4 on page 1295
Alias:
stretches map extents to cover all available space in the device. This might cause the map to be distorted. When this option is applied to the PROC GMAP statement, it
BLOCK Statement
1257
applies to all statements. If applied to a single statement, it applies only to that statement.
Alias:
STRETCHTOFIT, STR2FIT
causes the same legend and coloring to be used for all maps produced by the procedure instead of being calculated within each BY group for each map. The UNIFORM option prescans the data to generate a categorization across all the data, regardless of BY grouping, and applies that categorization to all maps in the BY group. This results in a static legend and color distribution across all maps such that a single value always has the same color in multiple maps. When specied on a PROC GMAP statement, the UNIFORM option applies to all AREA, BLOCK, CHORO, and PRISM statements included within the GMAP run-group. When omitted from the PROC GMAP statement, and specied on an individual AREA, BLOCK, CHORO, or PRISM statement, the UNIFORM option applies only to the maps produced by that statement.
Restriction: Not supported by Java. WOUTLINE=block-outline-width
species the width, in pixels, of the outline for all outlined blocks and for the outline of the map areas.
Default: 1 XSIZE=map-width <units> YSIZE=map-height <units>
specify the physical dimensions of the map to be drawn. By default, the map uses the entire procedure output area. Valid units are CELLS (character cells), CM (centimeters), IN (inches), or PCT (percentage of the graphics output area). The default unit is CELLS. If you specify values for map-width or map-height that are greater than the dimensions of the procedure output area, the map is drawn using the default size.
Restriction: Not supported by Java and ActiveX XVIEW=x YVIEW=y ZVIEW=z
specify coordinates of the viewing position in the reference coordinate system. In this system, the four corners of the map lie on the X-Y plane at coordinates (0,0,0), (0,1,0), (1,1,0), and (1,0,0). No axes are actually drawn on the maps that are produced by PROC GMAP. Your viewing position cannot coincide with the viewing reference point at coordinates (0.5,0.5,0), the center of the map. The value for z cannot be negative. If you omit the XVIEW=, YVIEW=, and ZVIEW= options, the default coordinates are (0.5, 2, 3). This viewing position is well above and to the south of the center of the map. You can specify one, two, or all three of the view coordinates; any that you do not specify are assigned the default values. While you can use the XVIEW= and YVIEW= options with DEVICE=JAVA, ZVIEW= cannot be used with DEVICE=JAVA.
Alias:
Figure 43.5 on page 1258 shows the position of the viewing reference point, as well as the default viewing position.
1258
BLOCK Statement
Chapter 43
Figure 43.5
3 the blocks themselves, which represent the response levels 3 the map areas from which the blocks rise
By default, block patterns are determined by the current style. If you specify the AREA statement or the AREA= option, then the map area colors are determined by the current style and the block colors are determined by the attributes that you specied. Note: If you specied the NOGSTYLE system option, then solid patterns are used for blocks and hatch patterns are used for the map areas. The map areas and their outlines use the rst color in the color list. 4 The BLOCK statement has the following options that explicitly control the outline colors used by the blocks and the map areas:
pattern1 color=blue;
Note: Empty block patterns (VALUE=EMPTY in a PATTERN statement) are not supported by DEVICE=JAVA. 4
CHORO Statement
1259
CHORO Statement
Creates two-dimensional maps in which values of the specied response variables are represented by varying patterns and colors.
Requirements: At least one response variable is required. The ID statement must be used in conjunction with the CHORO statement Global statements: FOOTNOTE, LEGEND, PATTERN, TITLE
Description
The CHORO statement species the variable or variables that contain the data represented on the map by patterns that ll the map areas. This statement automatically 3 determines the midpoints 3 assigns patterns to the map areas You can use statement options to enhance the appearance of the map, for example, by selecting the colors and patterns that ll the map areas. Other statement options control the selection of ranges for the response variable. In addition, you can use global statements to modify the map area patterns and legend, as well as add titles and footnotes to the map. You can also use an Annotate data set to enhance the map. CHORO response-variable(s) < / option(s)>; option(s) can be one or more from any of the following categories: 3 appearance options: ANNOTATE=Annotate-data-set CDEFAULT=empty-area-ll-color CEMPTY=empty-area-outline-color COUTLINE=area-outline-color | SAME STRETCH UNIFORM WOUTLINE=area-outline-width XSIZE=map-width<units> YSIZE=map-height <units> 3 mapping options: DISCRETE LEVELS=number-of-response-levels | ALL MIDPOINTS=value-list | OLD MISSING PERCENT | PERCENTAGE RANGE STATISTIC=FIRST | SUM | FREQUENCY | MEAN STATFMT=format-specication 3 legend options: CTEXT=text-color
1260
CHORO Statement
Chapter 43
LEGEND=LEGEND<1...99> NOLEGEND
3 description options:
DESCRIPTION=description NAME=name
3 ODS options
HTML=variable HTML_LEGEND=variable
Required Arguments
response-variable(s)
species one or more variables in the response data set or in the merged response and feature table if they contain response values that are represented on the map. Each response variable produces a separate map. All variables must be in the input data set. Multiple response variables are separated with blanks. Missing values for the response variable are not considered valid response values unless you use the MISSING option in the CHORO statement. Response variables can be either numeric or character in type. Numeric response variables are normally grouped into ranges, or response levels, as determined by the MIDPOINTS= or LEVELS= options. Each response level is assigned a different combination of pattern and color. Character response variables are assigned unique response levels, as are numeric variables when the DISCRETE option is specied.
See also: About Response Variables on page 1239.
Options
Options in a CHORO statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.
ANNOTATE=Annotate-data-set
species a data set to annotate onto maps that are produced by the CHORO statement.
Alias:
Featured in:
See also: Chapter 29, Using Annotate Data Sets, on page 643. CDEFAULT=empty-area-ll-color
lls empty map areas in the specied color. This option affects only map areas that are empty. Empty map areas are generated in choro maps only when there is no response value for a map area and the MISSING option is not used, or when a map area is omitted from the response data set and the ALL option is included in the PROC GMAP statement. The default is NONE, which draws the polygon empty, showing the background in the ll area of the polygon.
Alias:
CDEF=, DEFCLR=
Restriction: Not supported by Java See also: The CEMPTY option, the ALL option on page 1243, and Displaying Map
CHORO Statement
1261
CEMPTY=empty-area-outline-color
outlines empty map areas in the specied color. This option affects only the empty map areas, which are generated in choro maps when either of the following is true: 3 There is no response value for a map area and the MISSING option is not used. 3 A map area is omitted from the response data set and the ALL option is included in the PROC GMAP statement. The default outline color is the same as the default COUTLINE= color. CE= Restriction: Not supported by Java See also: The ALL option on page 1243 and Displaying Map Areas and Response Data on page 1240
Alias: COUTLINE=area-outline-color | SAME
outlines non-empty map areas in the specied color. When COUTLINE=area-outline-color and DEVICE=JAVA or ACTIVEX, both empty and non-empty map areas are outlined. The value SAME species that the outline color of a map area is the same as the interior pattern color. The default outline color is determined by the current style. If you specied the NOGSTYLE system option, then the default color is black for Java and ActiveX and the rst color in the color list for all other devices. Note: If you specify empty map patterns (VALUE=EMPTY in a PATTERN statement), then you should not change the outline color from the default value SAME to a single color. Otherwise all the outlines are one color and you cannot distinguish between the empty areas. 4 Alias: CO= Style reference: The Color attribute of the GraphOutlines style element
CTEXT=text-color
species a color for the text in the legend. If you omit the CTEXT= option, a color specication is searched for in this order: 1 the CTEXT= option in a GOPTIONS statement. 2 the default, the text color that is specied in the current style. 3 If you specied the NOGSTYLE system option, then the default color is black for Java and ActiveX and the rst color in the color list for all other devices. The CTEXT= color specication is overridden if you also use the COLOR= suboption of a LABEL= or VALUE= option in a LEGEND denition that is assigned to the map legend. The COLOR= suboption determines the color of the legend label or the color of the legend value descriptions, respectively. Alias: CT= Style reference: The Color attribute of the GraphValueText style element
DESCRIPTION=description
species a descriptive string up to 256 characters long that appears in the description eld of the catalog entry for the map. The description does not appear on the map. By default, the GMAP procedure assigns a description of the form CHOROPLETH MAP OF map_variable. The descriptive text is shown in each of the following: 3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS HTML statement, assuming that the procedure output is generated while the contents page is open
1262
CHORO Statement
Chapter 43
3 the Description eld of the PROC GREPLAY window 3 the chart description for Web output (depending on the device driver). For more
information, see PROC GANNO Statement on page 914.
Alias:
DES=
DISCRETE
generates a separate response level (color and surface pattern) for each different value of the formatted response variable. The LEVELS= option is ignored when you use the DISCRETE option. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. Note: If the data does not contain a value in a particular range of the format, that formatted range is not displayed in the legend. 4
Featured in: HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with an area of the map and point to the data or graph you want to display when you drill down on the area. See also: Adding Links with the HTML= and HTML_LEGEND= Options on page 603
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with a legend value and point to the data or graph you want to display when you drill down on the value.
Restriction: Not supported by Java and ActiveX See also: Adding Links with the HTML= and HTML_LEGEND= Options on page
603
LEGEND=LEGEND<1...99>
assigns the specied LEGEND statement that is to be applied to the map. The LEGEND= option is ignored if the specied LEGEND denition is not currently in effect. In the GMAP procedure, the CHORO statement produces a legend by default unless you specify the NOLEGEND option. If you use the SHAPE= option in a LEGEND statement, then only the value BAR is valid. Most of the LEGEND options described in LEGEND Statement on page 223 are supported by both Java and ActiveX. If a LEGEND option is not supported by Java or ActiveX, it is noted in the LEGEND option denition. Example 3 on page 1293 Restriction: Partially supported by Java and ActiveX
Featured in: See also: LEGEND Statement on page 223. LEVELS=number-of-response-levels | ALL
species the number of response levels to be graphed when the response variables are numeric and the DISCRETE and MIDPOINTS= options are not specied. Each response level is assigned a different surface pattern and color combination. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. The response values are assigned lighter and darker values of a color scheme to express lower and higher response values. If
CHORO Statement
1263
you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. Note: If you specied the NOGSTYLE system option, then non-continuous colors are used by default. 4 If neither the LEVELS= option nor the DISCRETE option is used, then the GMAP procedure determines the number of response levels by using the formula FLOOR(1+3.3 log(n)), where n is the number of response variable values. By default, an equal-distribution (quantizing) algorithm is used to determine each level. The LEVELS= option is ignored when you use the DISCRETE or MIDPOINTS=value-list option. When MIDPOINTS=OLD is used with the LEVELS= option, default midpoints are generated using the Nelder algorithm (Applied Statistics 25:947, 1976).
Featured in:
MIDPOINTS=value-list | OLD
species the response levels for the range of response values that are represented by each level (pattern and color combination). For numeric response variables, the value-list argument is either an explicit list of values, a starting and an ending value with an interval increment, or a combination of both forms: n <...n> n TO n <BY increment > n <...n> TO n <BY increment > n <...n> By default the increment value is 1. You can specify discrete numeric values in any order. In all forms, n can be separated by blanks or commas. For example:
midpoints=(2 4 6) midpoints=(2,4,6) midpoints=(2 to 10 by 2)
If a numeric variable has an associated format, the specied values must be the unformatted values. With numeric response values, DEVICE=JAVA uses only midpoints that fall in the range of the data being used. Thus, if your data ranged from 3080, but midpoints were specied at 25, 50, 75,and 100, only 50 and 75 are used. For character response variables, value-list is a list of unique character values enclosed in quotation marks and separated by blanks: value-1 <...value-n> The values are character strings enclosed in single quotation marks and separated by blanks. For example:
midpoints="Midwest" "Northeast" "Northwest"
Specify the values in any order. If a character variable has an associated format, the specied values must be the formatted values. Character response values specied with the MIDPOINTS= option are not supported by DEVICE=JAVA. You can selectively exclude some response variable values from the map, as shown here:
midpoints="Midwest"
The only observations that are shown on the map are those observations for which the response variable exactly matches one of the values that are listed in the MIDPOINTS= option. As a result, observations might be excluded inadvertently if values in the list are misspelled or if the case does not match exactly.
1264
CHORO Statement
Chapter 43
Specifying MIDPOINTS=OLD generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). Featured in: Example 8 on page 1301 Restriction: Partially supported by Java See also: The RANGE option
MISSING
accepts a missing value as a valid level for the response variable. See also: Displaying Map Areas and Response Data on page 1240
NAME=name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default GRSEG name is GMAP. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GMAP1.
NOLEGEND
causes GMAP to collect all response values (or their statistic) and chart each region as a percentage of the whole. You can use the STATISTIC= option to change how the percentage is calculatedwhether as a percentage of the SUM, FREQUENCY, or MEAN. If you do not use the STATISTIC= option, then STATISTIC=FIRST is assumedthe response variable of only the rst observation of each region is counted. If the response variable is a text eld, then STATISTIC=FREQUENCY is used, even if you specify a different value for the STATISTIC= option. Alias: PERCENTAGE See also: The STATFMT= option on page 1264 and the STATISTIC= option on page 1264.
RANGE
causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specied with the MIDPOINTS= option (instead of displaying just the midpoints). For example, if MIDPOINTS=15 25 35, then the legend could show 10-20, 20-30, 30-40. Restriction: The MIDPOINTS= option must be specied for the RANGE option to have any effect. Not supported by ActiveX.
STATFMT=format-specication
overrides the GMAP default format for percent of PERCENT8.2. Use this format when using calculated values. The STATFMT option is typically used when the STATISTIC=FREQUENCY option or the PERCENT option is used. Alias: SFMT=, SFORMAT=, STATFORMAT=
STATISTIC=FIRST | SUM | FREQUENCY | MEAN
species the statistic for GMAP to chart. For character variables, FREQUENCY is the only allowed valueany other value is changed to FREQUENCY and a warning is issued. The frequency of a variable does not include missing values unless the MISSING option is specied. FIRST GMAP matches the rst observation from the DATA= data set and charts the response value from this observation only. This is
CHORO Statement
1265
the default. If more rows exist that are not processed, a warning is issued to the log. SUM FREQUENCY MEAN All observations matching a given ID value are added together and the summed value is charted. A count of all rows with nonmissing values is charted unless you specify the MISSING option. All observations matching a given ID value are added together and then divided by the number of non-missing observations matched. This value is then charted unless you specify the MISSING option. STAT=
Alias:
STRETCH
stretches map extents to cover all available space in the device. This might cause the map to be distorted. When this option is applied to the PROC GMAP statement, it applies to all statements. If applied to a single statement, it applies only to that statement. Alias: STRETCHTOFIT, STR2FIT Restriction: Not supported by Java and ActiveX
UNIFORM
causes the same legend and coloring to be used for all maps produced by the procedure instead of being calculated within each BY group for each map. The UNIFORM option prescans the data to generate a categorization across all the data, regardless of BY grouping, and applies that categorization to all maps in the BY group. This results in a static legend and color distribution across all maps such that a single value always has the same color in multiple maps. When specied on a PROC GMAP statement, UNIFORM applies to all AREA, BLOCK, CHORO, and PRISM statements included within the GMAP run-group. When omitted from the PROC GMAP statement, and specied on an individual AREA, BLOCK, CHORO, or PRISM statement, UNIFORM applies only to the maps produced by that statement. Restriction: Not supported by Java
WOUTLINE=area-outline-width
specify the physical dimensions of the map. By default, the map uses the entire procedure output area. Valid units are CELLS (character cells), CM (centimeters), IN (inches), or PCT (percentage of the graphics output area). The default unit is CELLS. If you specify values for units that are greater than the dimensions of the procedure output area, the map is drawn using the default size. If you specify either the XSIZE= or YSIZE= option without specifying the other option, the GMAP procedure scales the dimension for the option that was not specied to retain the original shape of the map. Restriction: Not supported by Java and ActiveX
1266
PRISM Statement
Chapter 43
PRISM Statement
Creates three-dimensional prism maps in which levels of magnitude of the specied response variables are represented by polyhedrons (raised polygons) of varying height, pattern, and color.
Requirements: At least one response variable is required. You must use the ID statement in conjunction with the PRISM statement. Global statements: FOOTNOTE, LEGEND, PATTERN, TITLE
Description
The PRISM statement species the variable or variables that contain the data that are represented on the map by raised map areas. This statement automatically performs the following operations: 3 determines the midpoints ranges or midpoints 3 assigns patterns to the map areas You can use statement options to control the ranges of the response values, specify the angle of view, and enhance the appearance of the map. In addition, you can use global statements to modify the map area patterns and the legend, as well as add titles and footnotes to the map. You can also use an Annotate data set to enhance the map. Note: PRISM maps do not work well with polygons within polygons (holes). It is recommended that a CHORO or BLOCK map be created for these maps instead. 4 PRISM response-variable(s) < / option(s)>; The option(s) can be one or more options from any or all of the following categories: 3 appearance options: ANNOTATE=Annotate-data-set CDEFAULT=empty-area-ll-color CEMPTY=empty-area-outline-color COUTLINE=area-outline-color | SAME STRETCH UNIFORM WOUTLINE=area-outline-width XLIGHT=x YLIGHT=y XSIZE=map-width <units> YSIZE=map-height <units> XVIEW=x YVIEW=y ZVIEW=x 3 mapping options: AREA=n | column-name | (area-options) DISCRETE LEVELS=number-of-response-levels | ALL MIDPOINTS=value-list | OLD
PRISM Statement
1267
MISSING PERCENT | PERCENTAGE RANGE RELZERO STATISTIC=FIRST | SUM | FREQUENCY | MEAN STATFMT=format-specication 3 legend options: CTEXT=text-color LEGEND=LEGEND<1...99> NOLEGEND 3 description options: DESCRIPTION=description NAME=name 3 ODS options HTML=variable HTML_LEGEND=variable
Required Arguments
response-variable(s)
species one or more variables in the response data set, or in the merged response and feature table, that contain response values that are to be represented on the map. Each response variable produces a separate map. All variables must be in the input data set. Multiple response variables are separated with blanks. Missing values for the response variable are not considered valid unless you use the MISSING option. Response variables can be either numeric or character. By default, and as determined by the LEVELS= or MIDPOINTS= values, numeric response variables are grouped into ranges, or response levels. Each response level is assigned a different prism height and a different pattern and color combination. Character variables and numeric variables (when you use the DISCRETE option) have a unique response level for each unique response variable value. See also: About Response Variables on page 1239.
Options
Options in a PRISM statement affect all of the graphs that are produced by that statement. You can specify as many options as you want and list them in any order.
ANNOTATE=Annotate-data-set
species a data set to annotate onto the maps that are produced by the PRISM statement. Annotate coordinate systems 1, 2, 7, and 8 are not valid with Prism maps. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
AREA=n| column-name
species that a different map pattern be used for the surface of each map area or group of map areas on the map. Note: The AREA statement provides a greater amount of control than the AREA= option. 4
1268
PRISM Statement
Chapter 43
You can specify pattern lls or colors or both with PATTERN statements that specify map/plot patterns. A separate PATTERN denition is needed for each specied area. AREA=n The value of n indicates which variable in the ID statement determines the groups that are distinguished by a surface pattern. By default, all map unit areas are drawn using the same surface ll pattern. If your ID statement has only one map area identication variable, then use AREA=1 to indicate that each map area surface uses a different pattern. If you have more than one variable in your ID statement, then use n to indicate the position of the variable that denes groups that share a pattern. When you use the AREA= option, the map data set should be sorted in order of the variables in the ID statement. A column name dened in either the MAP= or DATA= data sets can be indicated with the column-name value. If the column name exists in both the MAP= and DATA= data sets, the column in the map= data set is used. When column-name is used, the areas are colored based on the AREA= value. Duplicate AREA= values might have different patterns assigned
AREA=columnname
See also: AREA Statement on page 1245, PATTERN Statement on page 238. CDEFAULT=empty-area-ll-color
lls empty map areas in the specied color. This option affects only map areas that are empty. Empty map areas are generated in prism maps only when there is no response value for a map area and the MISSING option is not used, or when a map area is omitted from the response data set and the ALL option is included in the PROC GMAP statement. The default is NONE, which draws the polygon empty, showing the background in the ll area of the polygon.
Alias:
CDEF=, DEFCLR=
Restriction: Not supported by Java See also: The CEMPTY option, the ALL option on page 1243, and Displaying Map
outlines empty map areas in the specied color. Empty map areas are generated in prism maps either
3 when there is no response value for a map area and the MISSING option is not
used, or
3 when a map area is omitted from the response data set and the ALL option is
included in the PROC GMAP statement. The default outline color is the same as the default COUTLINE= color.
Alias:
CE=
Restriction: Not supported by Java See also: ALL on page 1243 and Displaying Map Areas and Response Data on
page 1240
COUTLINE=area-outline-color | SAME
outlines nonempty map areas in the specied color. SAME species that the outline color of a map area is the same as the interior pattern color. The default outline color is determined by the current style. If you specied the NOGSTYLE system option, then the default color is the rst color in the color list.
PRISM Statement
1269
Note: If you specify empty map patterns (VALUE=EMPTY in a PATTERN statement), you should not change the outline color from the default value SAME to a single color. Otherwise, all the outlines are one color and you cannot distinguish between the empty areas. Empty block patterns (VALUE=EMPTY in a PATTERN statement) are not supported by DEVICE=JAVA. 4
Alias:
CO=
Style reference: The Color attribute of the GraphOutlines style element. CTEXT=text-color
species a color for the text in the legend. If you omit the CTEXT= option, a color specication is searched for in this order:
1 the CTEXT= option in a GOPTIONS statement. 2 the default, the text color that is specied in the current style. 3 If you specied the NOGSTYLE system option, then the default color is black
for Java and ActiveX and the rst color in the color list for all other devices. The CTEXT= color specication is overridden if you also use the COLOR= suboption of a LABEL= or VALUE= option in a LEGEND denition assigned to the map legend. The COLOR= suboption determines the color of the legend label or the color of the legend value descriptions, respectively.
Alias:
CT=
Style reference: The Color attribute of the GraphValueText style element DESCRIPTION=description
species the description of the catalog entry for the map. The maximum length for description is 256 characters. By default, the GMAP procedure assigns a description of the form PRISM MAP OF map_variable. The descriptive text is shown in each of the following:
3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS
HTML statement, assuming that the procedure output is generated while the contents page is open
3 the Description eld of the PROC GREPLAY window 3 the chart description for Web output (depending on the device driver). For more
information, see PROC GANNO Statement on page 914.
Alias:
DES=
DISCRETE
generates a separate response level (color and surface pattern) for each different value of the formatted response variable. The LEVELS= option is ignored when you use the DISCRETE option. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. Note: If the data does not contain a value in a particular range of the format, that formatted range is not displayed in the legend. 4
Featured in: HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with an area of
1270
PRISM Statement
Chapter 43
the map and point to the data or graph that are displayed in response to drill-down input. See also: Adding Links with the HTML= and HTML_LEGEND= Options on page 603
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with legend values and point to the data or graphs that are displayed in response to drill-down input. Restriction: Not supported by Java and ActiveX See also: Adding Links with the HTML= and HTML_LEGEND= Options on page 603
LEGEND=LEGEND<1...99>
species the LEGEND denition to associate with the map. LEGEND= is ignored if the specied LEGEND denition is not currently in effect. In the GMAP procedure, the PRISM statement produces a legend unless you use the NOLEGEND option. If you use the SHAPE= option in a LEGEND statement, only the value BAR is valid. Most of the LEGEND options described in LEGEND Statement on page 223 are supported by both Java and ActiveX. If a LEGEND option is not supported by Java or ActiveX, it is noted in the LEGEND option denition. Featured in: Example 8 on page 1301 Restriction: Partially supported by Java and ActiveX See also: LEGEND Statement on page 223
LEVELS=number-of-response-levels | ALL
species the number of response levels to be graphed when the response variables are numeric and the DISCRETE and MIDPOINTS= options are not specied. Each response level is assigned a different surface pattern and color combination. The prism height is based on the data value of the corresponding response variable. If you specify the LEVELS= option, then a color ramp is used to assign each response value a continuous color scheme. The response values are assigned lighter and darker values of a color scheme to express lower and higher response values. If you specify the DISCRETE option, then distinct, non-continuous colors are used are used for the response values. If neither the LEVELS= option nor the DISCRETE option is used, then the GMAP procedure determines the number of response levels by using the formula FLOOR(1+3.3 log(n)), where n is the number of response variable values. By default, an equal-distribution (quantizing) algorithm is used to determine each level. The LEVELS= option is ignored when you use the DISCRETE or MIDPOINTS=value-list option. When MIDPOINTS=OLD is used with the LEVELS= option, default midpoints are generated using the Nelder algorithm (Applied Statistics 25:947, 1976). Featured in: Example 2 on page 1292
MIDPOINTS=value-list | OLD
species the response levels for the range of response values that are represented by each level (prism height, pattern, and color combination). For numeric response variables, value-list is either an explicit list of values, or a starting and an ending value with an interval increment, or a combination of both forms: n <...n> n TO n <BY increment>
PRISM Statement
1271
n <...n> TO n <BY increment > n <...n> By default the increment value is 1. You can specify discrete numeric values in any order. In all forms, n can be separated by blanks or commas. For example,
midpoints=(2 4 6) midpoints=(2,4,6) midpoints=(2 to 10 by 2)
If a numeric variable has an associated format, the specied values must be the unformatted values. With numeric response values, DEVICE=JAVA uses only midpoints that fall in the range of the data being used. Thus, if your data ranged from 3080, but midpoints were specied at 25, 50, 75,and 100, only 50 and 75 are used. For character response variables, value-list has this form: value-1 <...value-n> The values are character strings enclosed in single quotation marks and separated by blanks. For example,
midpoints="Midwest" "Northeast" "Northwest"
Specify the values in any order. If a character variable has an associated format, the specied values must be the formatted values. Character response values specied with the MIDPOINTS= option are not supported by DEVICE=JAVA. You can selectively exclude some response variable values from the map, as shown here:
midpoints="Midwest"
Only those observations for which the response variable exactly matches one of the values listed in the MIDPOINTS= option are shown on the map. As a result, observations might be inadvertently excluded if values in the list are misspelled or if the case does not match exactly. Specifying MIDPOINTS=OLD generates default midpoints using the Nelder algorithm (Applied Statistics 25:947, 1976). Featured in: Example 8 on page 1301 Restriction: Partially supported by Java See also: The RANGE option
MISSING
accepts a missing value as a valid level for the response variable. See also: Displaying Map Areas and Response Data on page 1240
NAME=name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default GRSEG name is GMAP. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GMAP1.
NOLEGEND
causes GMAP to collect all response values (or their statistic) and chart each region as a percentage of the whole. You can use the STATISTIC= option to change how the percentage is calculatedwhether as a percentage of the SUM, FREQUENCY, or MEAN. If you do not use the STATISTIC= option, then STATISTIC=FIRST is assumed and the response variable of only the rst observation of each region is
1272
PRISM Statement
Chapter 43
counted. If the response variable is a text eld, then STATISTIC=FREQUENCY is used, even if you specify a different value for the STATISTIC= option.
Alias:
PERCENTAGE
See also: The STATFMT= option on page 1272, and the STATISTIC= option on page
1272
RANGE
causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specied with the MIDPOINTS= option (instead of displaying just the midpoints). For example, if MIDPOINTS=15 25 35, then the legend could show 10-20, 20-30, 30-40.
Restriction MIDPOINTS= must be specied for the RANGE option to have any
creates area heights that are relative to a zero value. By default, GMAP creates heights that are relative to the minimum value, which might or might not be zero. With the RELZERO option, zero value areas have no height.
Alias:
REL0, RELATIVETOZERO
Restriction This option works only for variables that have no negative values. STATFMT=format-specication
overrides the GMAP default format for percent of PERCENT8.2. Use this format when using calculated values. The STATFMT option is typically used when the STATISTIC=FREQUENCY option or the PERCENT option is used.
Alias:
species the statistic for GMAP to chart. For character variables, FREQUENCY is the only allowed valueany other value is changed to FREQUENCY and a warning is issued. The frequency of a variable does not include missing values unless the MISSING option is specied. FIRST GMAP matches the rst observation from the DATA= data set and charts the response value from this observation only. This is the default. If more rows exist that are not processed, a warning is issued to the log. All observations matching a given ID value are added together and the summed value is charted. A count of all rows with nonmissing values is charted unless you specify the MISSING option. All observations matching a given ID value are added together and then divided by the number of nonmissing observations matched. This value is then charted unless you specify the MISSING option. STAT=
Alias:
STRETCH
stretches map extents to cover all available space in the device. This might cause the map to be distorted. When this option is applied to the PROC GMAP statement, it applies to all statements. If applied to a single statement, it applies only to that statement. STRETCHTOFIT, STR2FIT Restriction: Not supported by Java and ActiveX
Alias:
PRISM Statement
1273
UNIFORM
causes the same legend and coloring to be used for all maps produced by the procedure instead of being calculated within each BY group for each map. The UNIFORM option prescans the data to generate a categorization across all the data, regardless of BY grouping, and applies that categorization to all maps in the BY group. This results in a static legend and color distribution across all maps such that a single value always has the same color in multiple maps. When specied on a PROC GMAP statement, the UNIFORM option applies to all AREA, BLOCK, CHORO, and PRISM statements included within the GMAP run-group. When omitted from the PROC GMAP statement, and specied on an individual AREA, BLOCK, CHORO, or PRISM statement, the UNIFORM option applies only to the maps produced by that statement.
Restriction: Not supported by Java WOUTLINE=area-outline-width
specify the coordinates of the imaginary light source in the map coordinate system. The position of the light source affects the way the sides of the map polygons are shaded. Although you can specify any point for the light source using the XLIGHT= and YLIGHT= options, the light source is actually placed in one of only four positions. Table 43.3 on page 1273 shows how the point you specify is positioned.
Table 43.3 Light Source Coordinates
Light Source Position behind the map (point A), and all side polygons are shadowed the viewing position (point D), and none of the side polygons are shadowed to the left of the map (point B), and the right-facing sides of polygons are shadowed to the right of the map (point C), and the left-facing side polygons are shadowed
Specied Light Source in quadrants I or II, or on the X or +Y axis on or within approximately 10 degrees of the Y axis in quadrant III (except within 10 degrees of the Y axis) in quadrant IV (except within 10 degrees of the Y axis)
Figure 43.6 on page 1274 illustrates the light source positions. Assume that your viewing position, selected by the XVIEW=, YVIEW=, and ZVIEW= options, is point D.
1274
PRISM Statement
Chapter 43
Figure 43.6
II
III
IV
By default, the light source position is the same as the viewing position specied by the XVIEW=, YVIEW=, and ZVIEW= options. The light source position cannot coincide with the viewing reference point (0.5,0.5), which corresponds with the position directly above the center of the map. Restriction: Not supported by Java and ActiveX See also: XVIEW= on page 1274
XSIZE=map-width <units> YSIZE=map-height <units>
specify the dimensions of the map that you are drawing. By default, the map uses the entire procedure output area. Valid units are CELLS (character cells), CM (centimeters), IN (inches), or PCT (percentage of the graphics output area). The default unit is CELLS. If you specify values for map-width and map height that are greater than the dimensions of the procedure output area, the map is drawn using the default size. If you specify one value and not the other, the dimension is adjusted to maintain the correct aspect ratio. Restriction: Not supported by Java and ActiveX
XVIEW=x YVIEW=y ZVIEW=z
specify the viewing position coordinates for the map. In this system, the four corners of the map lie on the XY plane at coordinates (0, 0, 0), (0, 1, 0), (1, 1, 0), and (1, 0, 0). The viewing position cannot coincide with the viewing reference point at coordinates (0.5, 0.5, 0). The value for z cannot be negative. If you omit the XVIEW=, YVIEW=, and ZVIEW= options, the default coordinates are (0.5, 2,3). This viewing position is well above and to the south of the center of the map. One, two, or all three view coordinates can be specied; any that are not specied are assigned the default values.
SURFACE Statement
1275
Figure 43.5 on page 1258 shows the position of the viewing reference point, as well as the default viewing position. To ensure that the polygon edges are distinguishable, the angle from vertical must be less than or equal to 45 degrees. If you specify a ZVIEW= value such that this condition cannot be satised (that is, a very small value), PROC GMAP increases the ZVIEW= value automatically so that the angle is 45 degrees or less. While you can use the XVIEW= and YVIEW= options with DEVICE=JAVA, ZVIEW= cannot be used with DEVICE=JAVA. Alias: XV=, YV=, ZV= Restriction: Partially supported by Java
SURFACE Statement
Creates three-dimensional surface maps in which levels of magnitude of the specied response variables are represented by spikes of varying height.
Requirements: At least one response variable is required and must be numeric. The ID statement must be used in conjunction with the SURFACE statement. Global statements: FOOTNOTE, TITLE Restriction: Not supported by Java and ActiveX
Description
The SURFACE statement species the variable or variables that contain the data that are represented on the map by raised map areas. This statement automatically determines the midpoints. You can use statement options to control spike proportions, specify the angle of view, and modify the general appearance of the map. For example, you can select the color and number of lines for the representation of the surface area. You can control the selection of spike heights and base widths. In addition, you can use global statements to add titles and footnotes to the map. You can also enhance the map with an Annotate data set. SURFACE response-variable(s) </ option(s)>; option(s) can be one or more of the following: 3 appearance options: ANNOTATE=Annotate-data-set CBODY=surface-map-color CONSTANT=n NLINES=number-of-lines ROTATE=degrees TILT=degrees XSIZE=map-width <units> YSIZE=map-height <units> 3 mapping options: PERCENT | PERCENTAGE STATISTIC=FIRST | SUM | FREQUENCY | MEAN STATFMT=format-specication
1276
SURFACE Statement
Chapter 43
3 description options:
DESCRIPTION=description NAME=name
Required Arguments
response-variable(s)
species one or more variables in the response data set, or in the merged response and feature table, that contain response values that are to be represented on the map. The response-variable must be numeric and must contain only positive values. Each response variable produces a separate map. All variables must be in the input data set. Multiple response variables are separated with blanks. The GMAP procedure scales response variables for presentation on the map. The height of the spikes on the map correspond to the relative value of the response variable, not to the actual value of the response variable. However, when the viewing angle is changed, the spikes might not appear this way. The spikes in the front might appear to be higher than the spikes in the back, which represent greater values. See also: About Response Variables on page 1239.
Options
SURFACE statement options affect all maps that are produced by that statement.
ANNOTATE=Annotate-data-set
species a data set to annotate onto maps that are produced by the SURFACE statement. Annotate coordinate systems 1, 2, 7, and 8 are not valid with surface maps. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
CBODY=surface-map-color
species the color that is used to draw the surface map. Regardless of the current ODS style, the default color is the rst color in the current color list. Alias: CB=
CONSTANT=n
species a denominator to use in the distance decay function. This function determines the base width of the spike that is drawn at each map area center. By default, CONSTANT=10. Values greater than 10 yield spikes that are wider at the base. Values less than 10 yield spikes that are narrower at the base. Let xk and yk represent the coordinates, and zk represent the function value at the center of each map area. The zk values are scaled from 1 to 11. A square grid of x by y points (where the size of the grid is the NLINES= option value) and the associated function value f(x,y) are generated from the map area center value using this formula:
f (x; y) =
where
k
X 0
k
1
k 3k 1:5 + :5D
4
k
k zk
D =
0 0
x xk
2
+
yk
SURFACE Statement
1277
and
Featured in:
DESCRIPTION=description
species the description of the catalog entry for the map. The maximum length for description is 256 characters. By default, the GMAP procedure assigns a description of the form SURFACE MAP OF variable, where variable is the name of the map variable. The descriptive text is shown in each of the following:
3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Table of Contents that is generated when you use CONTENTS= on an ODS
HTML statement, assuming that the procedure output is generated while the contents page is open
3 the Description eld of the PROC GREPLAY window 3 the chart description for Web output (depending on the device driver). For more
information, see PROC GANNO Statement on page 914.
Alias:
DES=
NAME=name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default GRSEG name is GMAP. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GMAP1.
NLINES=number-of-lines
species the number of lines used to draw the surface map. Values can range from 50 to 100; the higher the value, the more solid the map appears and the more resources used. By default, NLINES=50.
Alias:
causes GMAP to collect all response values (or their statistic) and chart each region as a percentage of the whole. You can use the STATISTIC= option to change how the percentage is calculatedwhether as a percentage of the SUM, FREQUENCY, or MEAN. If you do not use the STATISTIC= option, then STATISTIC=FIRST is assumed and the response variable of only the rst observation of each region is counted. If the response variable is a text eld, then STATISTIC=FREQUENCY is used, even if you specify a different value for the STATISTIC= option.
Alias:
PERCENTAGE
See also: The STATFMT= option on page 1278, and the STATISTIC= option on page
1278
1278
SURFACE Statement
Chapter 43
ROTATE=degrees
species the degrees of the angle at which to rotate the map about the Z axis in the map coordinate system. The degrees argument can be any angle. Positive values indicate rotation in the counterclockwise direction. By default, ROTATE=70. The ROTATE= option also affects the direction of the lines that are used to draw the surface map.
Featured in:
STATFMT=format-specication
overrides the GMAP default format for percent of PERCENT8.2. Use this format when using calculated values. The STATFMT option is typically used when the STATISTIC=FREQUENCY option or the PERCENT option is used.
Alias:
species the statistic for GMAP to chart. For character variables, FREQUENCY is the only allowed valueany other value is changed to FREQUENCY and a warning is issued. The frequency of a variable does not include missing values unless the MISSING option is specied. FIRST GMAP matches the rst observation from the DATA= data set and charts the response value from this observation only. This is the default. If more rows exist that are not processed, a warning is issued to the log. All observations matching a given ID value are added together and the summed value is charted. A count of all rows with non-missing values is charted unless you specify the MISSING option. All observations matching a given ID value are added together and then divided by the number of non-missing observations matched. This value is then charted unless you specify the MISSING option. STAT=
Alias:
TILT=degrees
species the degrees of the angle at which to tilt the map about the X axis in the map coordinate system. The value of degrees can be 0 to 90. Increasing values cause the map to tilt backward and makes the spikes more prominent. Decreasing values make the map shape more distinguishable and the spikes less prominent. TILT=90 corresponds to viewing the map edge-on, while TILT=0 corresponds to viewing the map from directly overhead. By default, TILT=70.
Featured in:
specify the physical dimensions of the map. By default, the map uses the entire procedure output area. Valid units are CELLS (character cells), CM (centimeters), IN (inches), or PCT (percentage of the graphics output area). The default unit is CELLS. If you specify values for map-width and map-height that are greater than the dimensions of the procedure output area, the map is drawn using the default size. And if you specify only one dimension, the other is scaled to maintain the aspect ratio.
1279
1280
Chapter 43
FIPS Code 22 23 24 25 26 27 28 29
FIPS Code 49 50 51 53 54 55 56 72
State Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming Puerto Rico
Table 43.5
Province Code 10 11 12 13 24 35 46 47 48 59 60 61
Note:
The MAPS.CNTYNAME data set contains a cross-reference of names and FIPS codes for all counties in the United States. The MAPS.CANCENS data set contains a cross-reference of census district names and codes for Canadian provinces. Base SAS software provides several functions that convert state names to FIPS codes and vice versa. The following table lists these functions and a brief description of each. See SAS Language Reference: Dictionary for more information.
Table 43.6
Function STFIPS STNAME STNAMEL FIPNAME
1281
FIPNAMEL FIPSTATE
converts FIPS code to state name in mixed case converts FIPS code to state postal code
The formats for maps are located in the SASHELP.MAPFMTS catalog. See the MAPS.NAMES table to view all the continent and country names and corresponding GLC, ISO, and numeric representation for the continent values. To use one of the formats for maps, you must specify the SASHELP.MAPFMTS catalog on the FMTSEARCH= option on a SAS OPTIONS statement:
options fmtsearch=(sashelp.mapfmts);
In addition to using the PUT statement (as shown in the examples in the following table), the formats can also be invoked using a FORMAT statement. Note:
Table 43.7
FORMAT contfmt
glcna
glcnlu
id=460 put(id,glcnlu.);
glcnsu
id=460 put(id,glcnsu.);
IRAN
glcnsm
id=460 put(id,glcnsm.);
Iran
1282
Chapter 43
FORMAT ison2a
DESCRIPTION use the countrys ISO numeric code to output the countrys ISO alpha2 code use the countrys ISO numeric code to output the countrys ISO alpha3 code use the countrys ISO numeric code to output the countrys long name in uppercase use the countrys ISO numeric code to output the countrys short name in uppercase use a countrys short name in uppercase to output the countrys long name in uppercase use the GLC alpha code to output the countrys long name in uppercase use the countrys GLC alpha code to output the countrys GLC numeric code use the countrys short name in uppercase to output the GLC alpha code name use the countrys short name in uppercase to output the countrys GLC numeric code use the countrys short name in mixed-case to output the countrys GLC alpha code use the countrys short name in mixed-case to output the countrys GLC numeric code
OUTPUT IR
ison3a
iso=364 put(iso,ison3a.);
IRN
isonlu
iso=364 put(iso,isonlu.);
isonsu
iso=364 put(iso,isonsu.);
IRAN
$cntrysl
name=IRAN put(name,$cntrysl.);
$glcalu
$glcan
$glcsua
name=IRAN put(name,$glcsua.);
IR
$glcsun
name=IRAN put(name,$glcsun.);
460
$glcsma
mixname=Iran put(mixname,$glcsma.);
IR
$glcsmn
mixname=Iran put(mixname,$glcsmn.);
460
1283
FORMAT $glcprov
DESCRIPTION use a province/city name appended by || as a delimiter, followed by the countrys GLC alpha code to output a province||country code, the province/city code, and the countrys GLC alpha numeric code use the countrys short name in uppercase to output the countrys ISO alpha2 code use the countrys name in uppercase to output the countrys ISO alpha3 code use the countrys short name in uppercase to output the countrys ISO numeric code use the countrys ISO alpha2 code to output the countrys long name in uppercase use the countrys ISO alpha2 code to output the countrys ISO numeric code use the countrys ISO alpha2 code to output the countrys short name in uppercase use the countrys ISO alpha3 code to output the countrys long name in uppercase use the countrys ISO alpha3 code to output the countrys ISO numeric code use the countrys ISO alpha3 code to output the countrys short name in uppercase
EXAMPLE provname=TEHRAN||IR
OUTPUT 8250460
put(provname,$glcprov.); 8250 province/ city code 460 country GLC numeric code
$isosu2a
name=IRAN put(name,$isosu2a.);
IR
$isosu3a
name=IRAN put(name,$isosu3a.);
IRN
$isosun
name=IRAN put(name,$isosun.);
364
$isoa2lu
alpha2=IR put(alpha2,$isoa2su.);
$isoa2n
alpha2=IR put(alpha2,$isoa2n.);
364
$isoa2su
alpha2=IR put(alpha2,$isoa2lu.);
IRAN
$isoa3lu
alpha3=IRN put(alpha3,$isoa3lu.);
$isoa3n
alpha3=IRN put(alpha3,$isoa3n.);
364
$isoa3su
alpha3=IRN put(alpha3,$isoa3su.);
IRAN
1284
Chapter 43
FORMAT $isosm2a
DESCRIPTION use the countrys short name in mixed-case to output the countrys ISO alpha2 code use the countrys short name in mixed-case to output the countrys ISO alpha3 code use the countrys short name in mixed-case to output the countrys ISO numeric code
OUTPUT IR
$isosm3a
mixname=Iran put(mixname,$isosm3a.);
IRN
$isosmn
mixname=Iran put(mixname,$isosmn.);
364
The following statements provide detailed information on a traditional map data set, including the number of observations, the variables in each data set, and a description of each variable:
proc contents data=maps.canada3; run;
To see the contents and descriptions of all of the map data sets supplied by SAS you can specify DATA=MAPS._ALL_ in the CONTENTS procedure. See the Base SAS Procedures Guide for more information on the CONTENTS and DATASETS procedures.
1285
longitude and latitude values. For more information, see Chapter 46, The GPROJECT Procedure, on page 1385. You can combine traditional map data sets in either of these situations: 3 The map data sets to be combined were originally projected together. 3 The map data sets all contain the same type of coordinates. That is, all are in radians or all are in degrees, and the longitude coordinates are measured in the same direction. Traditional map data sets supplied by SAS that have coordinates expressed only as longitude and latitude, with variable names LONG and LAT, must be renamed X and Y and should be projected before you use them with the GMAP procedure.
To use only North Carolina in US2MERGED (a data set created by using SQL or DATA step MERGE on the feature table US2 and a response data set also containing the variable STATE) the GMAP procedure would begin with the following statement:
proc gmap data=work.us2merged(where=(STATE=37));
The WHERE= data set option applies only to the data set that you specify in the argument in which the WHERE= option appears. If you use the WHERE statement, the WHERE condition applies to the traditional map data set and the response data sets or the merged response and feature table. Another approach is to use a DATA step to create a subset of the larger data set. This code illustrates another way to extract the observations for Quebec from the CANADA traditional map data set:
data quebec; set maps.canada(where=(province="24"));
This code illustrates another way to extract North Carolina data from the US2 feature table:
data ncarolina; set maps.us2(where=(STATE=37));
This approach is most useful when you want to create a permanent subset of a map data set or when you need to make additional changes to the map data set. Also see Chapter 49, The GREMOVE Procedure, on page 1449 for an example of how to use GREMOVE to create a regional map from one of the traditional map data sets that are supplied with SAS/GRAPH.
1286
Chapter 43
considerably less storage space, and can be drawn much more quickly. You can improve performance by plotting fewer observations for each map area. You reduce a traditional map data set when you subset it on the variable DENSITY. You can add the variable DENSITY to a map data set by using the GREDUCE procedure. For more information, see Chapter 48, The GREDUCE Procedure, on page 1437. Note: Many of the map data sets in the MAPS library are supplied with a DENSITY variable. 4 An unreduced map data set contains all of the coordinates that were produced when the map was digitized. This type of map data set has more observations than most graphics output devices can accurately plot. Some unreduced map data sets already contain a DENSITY variable like the one calculated by the GREDUCE procedure, so it is not necessary to use the GREDUCE procedure to process these data sets. Values for DENSITY range from 0 through 6 (the lower the density, the coarser the boundary line). You can set the DENSITY value by using the DENSITY= option on the PROC GMAP statement. For example, the following statement excludes all points with a density level of 2 or greater:
proc gmap map=maps.states density=2;
The resulting map is much coarser than one drawn by using all of the observations in the data set, but it is drawn much faster. Another way to create a reduced map data set is to use a DATA step to exclude observations with larger density values:
data states; set maps.states(where=(density<2));
3 3 3 3 3
If the projection supplied with the traditional map data set does not meet your needs, then you can use the GPROJECT procedure (on unprojected map coordinates) to create a different projection. For more information on traditional map data sets with unprojected coordinates, see Traditional Map Data Sets Containing X, Y, LONG, and LAT on page 1236. You should select a projection method that least distorts the regions that you are mapping. (All projection methods inherently distort map regions.) See Chapter 46, The GPROJECT Procedure, on page 1385 for more information. Note: Using an unprojected traditional map data set with the GMAP procedure can cause your map to be reversed. 4 * If your data is in degrees, then it can be converted to radians by multiplying by the degree-to-radian constant [atan(1)/45].
1287
You can also create a new traditional map data set that is a subset of the traditional map data set:
data nolake; set maps.chile(where=(lake=0)); run;
1288
Chapter 43
1 1 1 1 ;
datalines; 0 0 0 40 40 40 40 0
Figure 43.7
1289
separated from the primary polygon boundary by inserting a missing value for X and Y. For example, the data set that is created by this DATA step produces the map shown in Figure 43.8 on page 1289:
data map; input id $ segment x y; datalines; square 1 0 0 square 1 0 4 square 1 4 4 square 1 4 0 square 1 . . square 1 1 1 square 1 2 2 square 1 3 1 ;
Figure 43.8
Note: A single map segment (a section of a unit area with a single value of the SEGMENT variable) cannot contain multiple polygons without at least one observation with missing values for X and Y. All segments within the map data sets that are supplied by SAS/GRAPH contain a single polygon that can have one or more separate boundaries, each separated by an observation with missing values for X and Y. 4
surround area.
1290
Examples
Chapter 43
3 Dene the boundary as part of the enclosed area by using the ID value for the
enclosed area. For example, this DATA step creates a data set that produces the map shown in Figure 43.9 on page 1290:
data map; input id $ segment x y; datalines; square 1 0 0 square 1 0 4 square 1 4 4 square 1 4 0 square 1 . . square 1 1 1 square 1 2 2 square 1 3 1 triangle 1 1 1 triangle 1 2 2 triangle 1 3 1 ;
Figure 43.9
Examples
The following examples include features from one or more of the GMAP statements. Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the
1291
boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
ID statement BLOCK statement option: BLOCKSIZE= RELZERO Sample library member: GMPSIMPL
This example produces a block map that shows population of countries in Asia. Since the DISCRETE option is not used, the response variable is assumed to have a continuous range of values. Because neither the LEVELS= nor MIDPOINTS= option is used, the GMAP procedure selects a number of levels based on the number of map areas and then calculates the appropriate response levels.
Set the graphics environment.
goptions reset=all border;
1292
Chapter 43
Produce the block map. The ID statement species the variable that is in both the map data set and the response data set and denes map areas. The BLOCK statement species the variable in the response data set that contains the response values for each of the map areas. The BLOCKSIZE= option species the width of the blocks. The RELZERO option species that the block values are relative to zero.
proc gmap data=sashelp.demographics(where=(cont=95)) map=maps.asia all; id id; block pop / blocksize=1 relzero; run; quit;
BLOCK statement options: CEMPTY= LEVELS= SHAPE= RELZERO Sample library member: GMPLEVEL
This example uses the LEVELS= option to specify the number of response levels for the blocks. The LEVELS= option tells GMAP how many response levels and the GMAP procedure calculates the quantiles.
Set the graphics environment.
goptions reset=all border;
1293
Produce the block map. The LEVELS= option species the number of response levels for the graph. The SHAPE= option draws the blocks as prisms. The RELZERO option species that the block values are relative to zero. The CEMPTY= option species the outline color for map areas that have missing data.
proc gmap data=sashelp.demographics(where=(cont=92)) map=maps.samerica all; id id; block gni / levels=3 shape=prism relzero cempty=gray; run; quit;
1294
Chapter 43
This example creates formats for the response variables. The format for the POP variable denes and labels ranges of values. These ranges appear in the legend and make the map easier to understand. The example also uses the AREA statement to patterns the map areas by region.
Set the graphics environment.
goptions reset=all border;
Create a format for POP.POPFMT. denes the ranges of values for POP and labels the values.
proc format; value popfmt low-1000000="0-1" 1000001-10000000="1-10" 10000001-100000000="10-100" 100000001-500000000="100-500" 500000001-high="over 500"; run;
1295
Produce the block maps. The FORMAT statements assign POPFMT. to the POP variable and $REGIONFMT. to the REGION variable. The AREA statement assigns patterns to the map areas according to the values of the REGION variable. The RELZERO option species that the blocks values are relative to zero.
proc gmap data=sashelp.demographics(where=(cont=95)) map=maps.asia all; format pop popfmt.; format region $regionfmt.; id id; area region / midpoints="SEAR" "EUR" "EMR" "WPR"; block pop / levels=all legend=legend1 relzero; run; quit;
BLOCK statement options: STATISTIC= LEVELS= RELZERO Sample library member: GMPSTAT
1296
Chapter 43
This example species the statistic for the response variable that is displayed by the block map. The STATISTIC= option species that the statistic is frequency rather than the default statistic (sum).
Set the graphics environment.
goptions reset=all border;
Produce the block maps. The FORMAT statements assign POPFMT. to the POP variable and $REGIONFMT. to the REGION variable. The AREA statement assigns patterns to the map areas according to the values of the REGION variable. The RELZERO option species that the blocks values are relative to zero.
proc gmap map=maps.us data=sashelp.zipcode all; id state; block zip / statistic=frequency levels=5 relzero; run; quit;
1297
This example produces a choropleth (two-dimensional) map that shows the population of countries in Europe. Since the DISCRETE option is not used, the response variable is assumed to have a continuous range of values. Because neither the LEVELS= nor MIDPOINTS= options are used, the GMAP procedure selects a number of levels based on the number of map areas and then calculates the appropriate response levels. The legend shows the range of values for each level.
Set the graphics environment.
goptions reset=all border;
Produce the choropleth map. The ID statement species the variable that is in both the map data set and the response data set that denes map areas. CDEFAULT= species the color for the map areas that have missing data. The WHERE= clause on the MAP= option excludes the islands of Greenland and Svalbard, which have no data in DEMOGRAPHICS data set.
proc gmap map=maps.europe(where=(id ne 405 and id ne 845)) data=sashelp.demographics(where=(cont=93)) all; id id;
1298
Chapter 43
Annotate Facility
Sample library member: GMPLABEL
This example uses the Annotate facility to add labels to each area in a map of Belarus. The CHORO statement assigns the Annotate data set to the map. The %MAPLABEL annotate macro is used to create and position the map labels. For more information about this macro, see %MAPLABEL Macro on page 749.
Set the graphics environment.
goptions reset=all border;
1299
Dene pattern characteristics. PATTERN1 denes a single map pattern that is repeated for each of the six map areas (provinces). The pattern is an empty ll with a blue border. The VALUE= option denes a map/plot pattern. Specifying a color causes PATTERN1 to generate only one pattern denition. The REPEAT= option species the number of times to repeat the pattern denition.
pattern1 value=empty color=blue repeat=6;
Create the Annotate data set. The %ANNOMAC macro enables the annotate macros. The %MAPLABEL annotate macro creates the annotate data set.
%annomac; %maplabel (maps.belarus, maps.belarus2, work.labelout, idname, id, font=Arial Black, color=crimson, size=4, hsys=3);
Produce the choropleth map. The NOLEGEND option suppresses the legend. The ANNOTATE= option species the data set to annotate the map.
proc gmap map=maps.belarus data=maps.belarus; id id; choro id / nolegend annotate=labelout; run; quit;
1300
Chapter 43
This example produces a prism map of the population of countries in Africa. Since the DISCRETE option is not used, the response variable is assumed to have a continuous range of values. Because neither the LEVELS= nor MIDPOINTS= option is used, the GMAP procedure selects a number of levels based on the number of map areas and then calculates the appropriate response levels. Since the XVIEW=, YVIEW=, and ZVIEW= options are not used, the default viewing position, above and to the east and south of the center of the map, is used. Since the XLIGHT= and YLIGHT= options are not used, none of the side polygons of the prisms are shadowed. The light source is the same as the viewing position.
Set the graphics environment.
goptions reset=all border;
Produce the prism map. The ID statement species the variable in the map data set and the response data set that denes map areas. The CDEFAULT= option sets the color of map areas that have missing data. The RELZERO option makes the prism heights relative to zero.
proc gmap data=sashelp.demographics(where=(cont=94)) map=maps.africa density=low all; id id; prism pop / cdefault=yellow relzero; run; quit;
1301
This example species a set of midpoints that are used to create the response levels.
Set the graphics environment.
goptions reset=all border;
Produce the prism map. The MIDPOINTS= option species the response levels for the map. The CDEFAULT= option sets the color of map areas that have missing data.
proc gmap data=sashelp.demographics(where=(cont=94)) map=maps.africa density=low all; id id; format adultliteracypct percentn7.2; prism adultliteracypct / midpoints=10 to 90 by 20
1302
Chapter 43
SURFACE statement
Sample library member: GMPSURFA
This example produces a surface map that shows the annual population growth rate of countries in Europe. Because the CONSTANT= and NLINES= options are not used, the GMAP procedure draws a surface that consists of 50 lines and uses the default decay function to calculate spike height and base width. And because the ROTATE= and TILT= options are not used, the map is rotated 70 degrees around the Z axis and tilted 70 degrees with respect to the X axis.
Set the graphics environment.
goptions reset=all border;
1303
Produce the surface map. The ID statement species the variable in the map data set and the response data set that denes the map areas.
proc gmap map=maps.europe data=sashelp.demographics; id id; surface popagr; run; quit;
This example tilts and rotates the surface map and uses more lines to draw the surface.
Set the graphics environment.
goptions reset=all border;
1304
Chapter 43
Produce the surface map. The CONSTANT= option species a value that is less than the default value so the spikes are narrower at the base. The NLINES= option species the maximum number of map lines, which gives the best map shape resolution. The ROTATE= and TILT= options adjust the map orientation to make the crowded spikes in the northeast portion of the map easier to distinguish.
proc gmap map=maps.europe data=sashelp.demographics; id id; surface pop / constant=4 nlines=100 rotate=40 tilt=60; run; quit;
When you use a feature table with the GMAP procedure, you must merge the feature table with your response data set before generating a map, storing the combined data in a new data set. On PROC GMAP, you use the DATA= option to name the combined data set, and you use the ID statement to identify the variable that contains the spatial information. To illustrate the use of a feature table, assume you want to generate a map of the United States. Rather than using the traditional map data set MAPS.US, you want to use its corresponding feature table. To determine which feature table corresponds to a traditional map data set, look in the MAPS.METAMAPS data set: 3 The feature table MAPS.US2 corresponds to the traditional map data set MAPS.US.
1305
3 PROC SORT sorts WORK.SITES by the values of variable STATE. This prepares
SITES for a merge with the feature table MAPS.US2. The variable STATE identies the map areas in both SITES and MAPS.US2.
3 PROC SORT sorts the feature table MAPS.US2. The OUT= option species that
the sorted data be written to a new data set WORK.MYMAP.
3 In the DATA step, the MERGE statement merges the feature table with the
response data. The combined data set is saved to a new data set named BOTH. The data set BOTH is stored in WORK, a temporary library. To use the combined data set in other SAS/GRAPH programs, you would need to save the merged data set to a permanent library.
3 On the PROC GMAP statement, the DATA= option points to the combined data
set, BOTH. The ID statement species _MAP_GEOMETRY_ as the variable that contains the spatial data. The following example creates the response data set SITES and merges it with the feature table US2. It then uses the combined data set to generate a map.
Create the data set SITES with regional data. Sites contains a region number for each state and the total number of hazardous waste sites in each state. The STFIPS function converts the state postal codes to FIPS state codes.
data sites; length stcode $ 2;
1306
Chapter 43
6 9 4 10 4 1 4 7 9 10 4 8 5 ; run;
10 18 16 10 13 22 0 9 10 12 26 49
Sort the response and the feature tables in the order of the BY variable. By default, the rst PROC SORT sorts the response data set created in the code above. Both sorted data sets are stored in the SAS temporary library WORK. To enable the data sets to be merged, the same BY variable is used to sort both the response and feature tables.
proc sort data=sites out=sites; by state; run; proc sort data=maps.us2 out=mymap; by state; run;
Specify the ACTIVEX driver and HTML output. To conserve system resources, ODS LISTING CLOSE closes the Listing destination for procedure output. In the programs ODS HTML statement, the BODY= option names the le for storing HTML output.
goptions reset=all border; ods listing close; ods html body="hazmat_sites.html";
1307
Generate the choropleth map using the merged response data set and feature table. The ID variable is the $GEOREF formatted variable that associates the feature table data with its map data set (MAPS.US). DISCRETE species that each level of REGION is a separate response level.
proc gmap data=both; id _map_geometry_; choro region/discrete; run; quit;
Close the HTML destination and open the listing destination. The HTML destination must be closed before you can view the output with a browser. ODS LISTING opens the Listing destination again so that the destination is again available for displaying output during this SAS session.
ods html close; ods listing;
1308
1309
CHAPTER
44
The GOPTIONS Procedure
Overview 1309 Procedure Syntax 1310 PROC GOPTIONS Statement 1310 Examples 1312 Example 1: Displaying TITLE and FOOTNOTE Statements 1312 Example 2: Displaying Graphics Options without the Description 1313
Overview
The GOPTIONS procedure provides information about the values of graphics options and the global statement denitions that are currently in effect in your session. The values displayed are either the defaults of the current device driver or user-dened values that have been assigned in your SAS session. You can use the GOPTIONS procedure to do the following tasks: 3 list the current values of all of the graphics options or of one specied option 3 display the values of all of the AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, and TITLE denitions that are currently in effect Note: Do not confuse the GOPTIONS procedure with the GOPTIONS statement. The GOPTIONS procedure lists the values that are dened in a GOPTIONS statement as well as in any other global statement denitions. See GOPTIONS Statement on page 219 for a list of the graphics options that you can set with the GOPTIONS statement. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for a complete description of each graphics option. 4 The list of graphics options displays in the SAS Log window and includes the names of the options, the current values, and a brief description of each one. You can use PROC GOPTIONS statement options to control what information is listed and where it appears in the Log window. Output 44.1 contains part of a sample Log listing. Note: The information returned by the GOPTIONS procedure does not reect any style settings that are in effect. 4
1310
Procedure Syntax
Chapter 44
Output 44.1
SAS/GRAPH software options and parameters (executing in DMS Programming Environment environment) NOADMGDF GDDM driver output an ADMGDF file ASPECT= Aspect ratio (width/height) for software characters NOAUTOCOPY Automatic hardcopy after display NOAUTOFEED Automatic paper feed after plot NOAUTOSIZE Change character cell size to preserve device catalog rows and columns BINDING=NOBINDING Binding edge NOBORDER Draw a border around display or plot CBACK= Background color CBY= BY line color CELL Hardware characters must be on cell boundaries CHARACTERS Use hardware characters CHARTYPE= Select hardware font CIRCLEARC Use hardware circle/arc generator NOCOLLATE Collate output COLORS=( ) Default color list CPATTERN= Default pattern color CSYMBOL= Default symbol color CTEXT= Default text color CTITLE= Default title, footnote and note color DASH Use hardware dashed line generator DASHSCALE= Dash pattern scale factor DELAY= Animation delay time in milliseconds DEVADDR= IBM Device address, qname, or node name DEVICE= Default device driver DEVMAP=DEFAULT Output character map for hardware text DISPLAY Display graph on device DISPOSAL=NONE Image animation disposal method DRVINIT= Host command executed before driver initialization DRVTERM= Host command executed after driver termination NODUPLEX Duplex printing NOERASE Erase graph upon completion FASTTEXT Use quicker, less precise, integer font rendering routines; generally unsuitable for multiple device or templated replay situations.
Note: All of the graphics options that are displayed by the GOPTIONS procedure are described in Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329. 4
Procedure Syntax
PROC GOPTIONS <option(s)>;
Syntax
PROC GOPTIONS <option(s)>; option(s) can be one or more options from the following categories:
1311
Options
You can specify as many options as you want and list them in any order.
AXIS
requests a list of all current AXIS denitions. AXIS also lists the current values for all graphics options, unless you use the NOLIST option. If you have not dened any AXIS statements, the GOPTIONS procedure issues a message.
Alias:
CENTIMETERS
displays the values of the HORIGIN=, HSIZE=, PAPERFEED=, PAPERLIMIT=, VORIGIN=, and VSIZE= graphics options in units of centimeters (CM). These graphics options use units of IN or CM only, and their values are always stored as inches even if you specify CM. Therefore, the GOPTIONS procedure displays these values in inches, unless you specify the CENTIMETERS option. Note: The CENTIMETERS option does not affect the graphics options that can use unit specications of CELLS, CM, IN, PCT, and PT. 4 Alias: CM
FOOTNOTE
requests a list of all of the current FOOTNOTE and TITLE denitions. FOOTNOTE also lists the current values for all of the graphics options, unless you use the NOLIST option. If you have not dened any FOOTNOTE or TITLE statements, the GOPTIONS procedure issues a message. Alias: F
Featured in: LEGEND
requests a list of all of the current LEGEND denitions. LEGEND lists the current values for all of the graphics options, unless you use the NOLIST option. If you have not dened any LEGEND statements, the GOPTIONS procedure issues a message.
Alias: NOLIST
suppresses the display of graphics options. Use the NOLIST option in conjunction with the appropriate statement request option when you want to list only the current AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, or TITLE denitions.
1312
Examples
Chapter 44
Alias: NOLOG
Featured in:
displays the output in the OUTPUT window instead of the Log window.
OPTION=graphics-option
requests information on the specied graphics option. For these options, requesting the information on one option also displays the value of its corresponding option, as follows: 3 HSIZE= and VSIZE= 3 HPOS= and VPOS= 3 XMAX= and YMAX= 3 XPIXELS= and YPIXELS=
PATTERN
requests a list of all of the current PATTERN denitions. The PATTERN option lists the current values for all of the graphics options unless you use the NOLIST option. If you have not dened any PATTERN statements, the GOPTIONS procedure issues a message. Alias: P
SHORT
suppresses the descriptions of the graphics options and displays the graphics options values in an alphabetical list in paragraph form. Featured in: Example 2 on page 1313
SYMBOL
requests a list of all of the current SYMBOL denitions. The SYMBOL option lists the current values for all of the graphics options, unless you use the NOLIST option. If you have not dened any SYMBOL statements, the GOPTIONS procedure issues a message. Alias: S
TITLE
requests a list of all of the current TITLE and FOOTNOTE denitions. The TITLE option lists the current values for all of the graphics options, unless you use the NOLIST option. If you have not dened any FOOTNOTE or TITLE statements, the GOPTIONS procedure issues messages. Alias: T
Examples
1313
This example uses the FOOTNOTE option to display the current denitions of both the FOOTNOTE and TITLE statements. It also uses the NOLIST option to suppress the list of graphics options. Output 44.2 shows the listing that appears in the LOG window.
Output 44.2 Using the NOLIST Option (GOPTIFT)
TITLE1 HEIGHT=6 COLOR=BLUE FONT=SWISSB "Production Quality" ; TITLE2 HEIGHT=4 COLOR=BLUE FONT=SWISSB "January through June"; FOOTNOTE1 HEIGHT=3 COLOR=GREEN FONT=SWISS "Data from SASDATA.QUALITY" ; FOOTNOTE2 HEIGHT=3 COLOR=GREEN FONT=SWISS "* denotes approximations" ;
Produce the listing. The NOLIST and FOOTNOTE options control the information that appears in the Log window.
proc goptions nolist footnote; run;
GOPSHORT
This example uses the SHORT option to display only the values of graphics options without the description of each graphics option. Output 44.3 shows the listing that appears in the Log window.
1314
Chapter 44
Output 44.3
SAS/GRAPH software options and parameters (executing in DMS Process environment) NOACCESSIBLE NOADMGDF ALTDESC ASPECT= NOAUTOCOPY NOAUTOFEED AUTOSIZE=
BINDING=DEFAULTEDGE
NOBORDER CBACK= CBY= CELL CHARACTERS CHARTYPE= CIRCLEARC NOCOLLATE COLORS=( ) CPATTERN= CSYMBOL= CTEXT= CTITLE= DASH DASHSCALE= DELAY= DEVADDR= DEVICE= DEVMAP=DEFAULT DISPLAY DISPOSAL=NONE DRVINIT= DRVTERM= NODUPLEX NOERASE EXTENSION= FASTTEXT FBY= FCACHE=3 FILECLOSE= FILEONLY FILL FILLINC= FONTRES=NORMAL FTEXT= FTITLE= FTRACK=TIGHT GACCESS= GCLASS=G GCOPIES=(0, 20) GDDMCOPY=FSCOPY GDDMNICKNAME= GDDMTOKEN= GDEST=LOCAL GEND= GEPILOG= GFORMS= GOUTMODE=APPEND GPROLOG= GPROTOCOL= GRAPHRC GSFLEN= GSFMODE=PORT GSFNAME= NOGSFPROMPT GSIZE= GSTART= GUNIT=CELLS GWAIT= GWRITER=SASWTR HANDSHAKE= HBY= HORIGIN= HPOS= HSIZE= HTEXT= HTITLE= IBACK= IMAGEPRINT IMAGESTYLE=TILE INTERPOL= ITERATION= NONINTERLACED KEYMAP=DEFAULT LFACTOR= OFFSHADOW=(0.0625 in., -0.0625 in.) PAPERDEST= PAPERFEED= PAPERLIMIT= PAPERSIZE= PAPERSOURCE= PAPERTYPE= PENMOUNTS= PENSORT PIEFILL NOPCLIP POLYGONCLIP POLYGONFILL POSTGEPILOG= POSTGRAPH= POSTGPROLOG= PPDFILE= PREGEPILOG= PREGRAPH= PREGPROLOG= PROMPT PROMPTCHARS=000A010D05000000X RENDER=MEMORY RENDERLIB=WORK REPAINT= NOREVERSE NOROTATE SIMFONT= SPEED= NOSWAP SWFONTRENDER=DEFAULT SYMBOL TARGETDEVICE= NOTRANSPARENCY TRANTAB= UCC= NOUSERINPUT NOV5COMP NOV6COMP VORIGIN= VPOS= VSIZE= XMAX= XPIXELS= YMAX= YPIXELS=
Set the graphics environment. The values of the graphics options specied in this statement appear in the Log listing.
goptions reset=all;
Produce the listing. The SHORT option suppresses the display of the description of each graphics option.
proc goptions short; run;
1315
CHAPTER
45
The GPLOT Procedure
Overview 1315 About Plots of Two Variables 1316 About Plots with a Classication Variable 1317 About Bubble Plots 1317 About Plots with Two Vertical Axes 1318 About Interpolation Methods 1319 Concepts 1319 Parts of a Plot 1319 About the Input Data Set 1321 Missing Values 1321 Values Out of Range 1321 Sorted Data 1321 Logarithmic Axes 1321 Procedure Syntax 1322 PROC GPLOT Statement 1322 BUBBLE Statement 1323 BUBBLE2 Statement 1333 PLOT Statement 1336 PLOT2 Statement 1351 Examples 1356 Example 1: Generating a Simple Bubble Plot 1357 Example 2: Labeling and Sizing Plot Bubbles 1358 Example 3: Adding a Right Vertical Axis 1360 Example 4: Plotting Two Variables 1362 Example 5: Connecting Plot Data Points 1365 Example 6: Generating an Overlay Plot 1367 Example 7: Filling Areas in an Overlay Plot 1370 Example 8: Plotting Three Variables 1373 Example 9: Plotting with Different Scales of Values 1376 Example 10: Creating Plots with Drill-down Functionality for the Web
1379
Overview
The GPLOT procedure plots the values of two or more variables on a set of coordinate axes (X and Y). The coordinates of each point on the plot correspond to two variable values in an observation of the input data set. The procedure can also generate a separate plot for each value of a third (classication) variable. It can also generate bubble plots in which circles of varying proportions representing the values of a third variable are drawn at the data points.
1316
Chapter 45
The procedure produces a variety of two-dimensional graphs including the following plots: 3 simple scatter plots 3 overlay plots in which multiple sets of data points display on one set of axes 3 plots against a second vertical axis 3 bubble plots 3 logarithmic plots (controlled by the AXIS statement) In conjunction with the SYMBOL statement, the GPLOT procedure can produce join plots, high-low charts, needle plots, and plots with simple or spline-interpolated lines. The SYMBOL statement can also display regression lines on scatter plots. The GPLOT procedure is useful for the following tasks: 3 displaying a long series of data, showing trends and patterns 3 interpolating between data points 3 extrapolating beyond existing data with the display of regression lines and condence limits.
Figure 45.1
The program for this plot is in Example 4 on page 1362. For more information on producing scatter plots, see PLOT Statement on page 1336.
1317
You can also overlay two or more plots (multiple sets of data points) on a single set of axes and you can apply a variety of interpolation techniques to these plots. See About Interpolation Methods on page 1319.
Figure 45.2
By default, plots with a classication variable generate a legend. In the code that generates the plot for Example 8 on page 1373, a SYMBOL statement connects the data points and species the plot symbol that is used for each value of the classication variable (CITY). For more information on how to produce plots with a classication variable, see PLOT Statement on page 1336.
1318
Chapter 45
Figure 45.3 on page 1318 shows a bubble plot in which each bubble represents a category of engineer that is shown on the horizontal axis. The location of each bubble in relation to the vertical axis is determined by the average salary for the category. The size of each bubble represents the number of engineers in the category relative to the total number of engineers in the data. By default, the BUBBLE statement scales the axes to include the maximum and minimum data values and draws a circle at each data point. It labels each axis with the name of its variable or an associated label and displays the value of each major tick mark.
Figure 45.3
The program for this plot is in Example 1 on page 1357. For more information on producing bubble plots, see BUBBLE Statement on page 1323.
3 display the same variable values as the left axis 3 display left axis values in a different scale 3 plot a second response (Y) variable, thereby producing one or more overlay plots
In the following gure, the right axis displays the values of the vertical coordinates in a different scale from the scale that is used for the left axis.
Parts of a Plot
1319
Figure 45.4
The program for this plot is in Example 9 on page 1376. For more information on how to produce plots with a right vertical axis, see PLOT2 Statement on page 1351 and BUBBLE2 Statement on page 1333.
3 connect the data points with straight lines 3 specify regression analysis to t a line to the points and can display lines for
condence limits
3 connect the data points to the zero line on the vertical axis 3 display the minimum and maximum values of Y at each X value and mark the
mean value, display standard deviations that connect the data points with lines or bars, generate box plots, or plot high-low-close stock market data
3 specify that a pattern lls the polygon that is dened by data points 3 smooth plot lines with spline interpolation 3 use a step function to connect the data points
SYMBOL Statement on page 250 describes all interpolation methods.
Concepts
Parts of a Plot
Some terms used with GPLOT procedure are illustrated in Figure 45.5 on page 1320 and Figure 45.6 on page 1320.
1320
Parts of a Plot
Chapter 45
Figure 45.5
vertical axis label (y variable)
reference line
plot symbol
plot line
Figure 45.6
area 3 area 2
area 1
offset
offset
1321
Missing Values
If the value of either of the plot variables is missing, the GPLOT procedure does not include the observation in the plot. If you specify interpolation with a SYMBOL denition, the plot is not broken at the missing value. To break the plot line or area ll at the missing value, use the PLOT statements SKIPMISS option. The SKIPMISS option is enabled only for JOIN interpolations.
Sorted Data
Data points are plotted in the order in which the observations are read from the data set. Therefore, if you use any type of interpolation that generates a line, sort your data by the horizontal axis variable.
Logarithmic Axes
If your data contain logarithmic values or if the data values vary over a wide range or contain large values, you might want to specify a logarithmic axis for the horizontal or vertical axis. Logarithmic axes can be specied with the AXIS statement options LOGBASE= and LOGSTYLE=. See AXIS Statement on page 196 for a complete discussion.
1322
Procedure Syntax
Chapter 45
Procedure Syntax
Requirements: At least one PLOT or BUBBLE statement is required. A PLOT2 or BUBBLE2 statement can be used in conjunction with a PLOT or BUBBLE statement. Global statements: AXIS, FOOTNOTE, LEGEND, PATTERN, TITLE Reminder: The procedure can include BY, FORMAT, LABEL, WHERE, and NOTE statements. Supports:
RUN-group processing
PROC GPLOT <DATA=input-data-set> <ANNOTATE=Annotate-data-set> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set > <UNIFORM>; BUBBLE plot-request(s) </option(s)>; BUBBLE2 plot-request(s) </option(s)>; PLOT plot-request(s) </option(s)>; PLOT2 plot-request(s) </option(s)>;
Syntax
PROC GPLOT <DATA=input-data-set> <ANNOTATE=Annotate-data-set> <GOUT=< libref.>output-catalog> <IMAGEMAP=output-data-set > <UNIFORM>;
Options
ANNOTATE=Annotate-data-set ANNO=Annotate-data-set
species a data set to annotate all graphs that are produced by the GPLOT procedure. To annotate individual graphs created using a By statement or multiple action statements, use ANNOTATE= in the action statement. See also: Chapter 29, Using Annotate Data Sets, on page 643
BUBBLE Statement
1323
DATA=input-data-set
species the SAS data set that contains the variables to plot. By default, the procedure uses the most recently created SAS data set.
See also: SAS Data Sets on page 54 and About the Input Data Set on page 1321. GOUT=< libref. >output-catalog
species the SAS catalog in which to save the graphics output that is produced by the GPLOT 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: Specifying the Catalog Name and Entry Name for Your GRSEGs on
page 100.
IMAGEMAP=output-data-set
creates a temporary SAS data set that is used to generate an image map in an HTML output le. The IMAGEMAP= option can be used only if the PLOT or PLOT2 statements are used, and the PLOT or PLOT2 statement must use the HTML= option or the HTML_LEGEND= option or both. If the HTML= option is used in the PLOT or PLOT2 statement, the plot points are dened as hot zones, unless the AREA= option is also used. In that case there are not plot points and the areas between plot lines are dened as hot zones. If the HTML_LEGEND= option is used, the legend symbols are dened as hot zones. Information for the links is stored in the variables referenced by the HTML= or HTML_LEGEND= options or both. The %IMAGEMAP macro generates the image map in the HTML output le. The macro takes two arguments, the name of the image map data set and the name or leref of the HTML output le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
UNIFORM
species that the same axis scaling is used for all graphs that are produced by the procedure. By default, the range of axis values for each axis is based on the minimum and maximum values in the data and, therefore, can vary from graph to graph and among BY groups. Using the UNIFORM option forces the value range for each axis to be the same for all graphs. Thus, if the procedure produces multiple graphs with both left and right vertical axes, the UNIFORM option scales all of the left axes the same and all of the right axes the same, based on the minimum and maximum data values. In addition, UNIFORM forces the assignment of SYMBOL statements for the category variable without regard to the BY-group variable. If a legend is generated, UNIFORM makes the legend the same across graphs.
Restriction:
BUBBLE Statement
Creates bubble plots in which a third variable is plotted against two variables represented by the horizontal and vertical axes; the value of the third variable controls the size of the bubble.
Requirements:
Global statements:
1324
BUBBLE Statement
Chapter 45
Description
The BUBBLE statement species one or more plot requests that name the horizontal and left vertical axis variables and the variable that controls the size of the bubbles. This statement automatically does the following: 3 centers each circle at a data point that is determined by the values of the vertical and horizontal axes variables 3 scales the axes to include the maximum and minimum data values 3 labels each axis with the name of its variable or associated label 3 displays each major tick mark value 3 draws circles for values that are located within the axes You can use statement options to control axis scaling, draw reference lines, modify the appearance of axes, control the display of the bubbles, specify a backplane color or image, and specify annotation. In addition, you can use global statements to modify axes (AXIS statement), and add text to the graph (TITLE, NOTE, and FOOTNOTE statements). You can also use the Annotate data set to enhance the plot.
Syntax
BUBBLE plot-request(s) </option(s)>; option(s) can be one or more options from any or all of the following categories:
BUBBLE Statement
1325
HZERO LAUTOHREF=reference-line-type LHREF=reference-line-type | (reference-line-type) | reference-line-type-list 3 vertical axis options: AUTOVREF CAUTOVREF=reference-line-color CVREF=reference-line-color | (reference-line-color) | reference-line-color-list LAUTOVREF=reference-line-type LVREF=reference-line-type | (reference-line-type) | reference-line-type-list VAXIS=value-list | AXIS<1...99> VMINOR=number-of-minor-ticks VREF=value-list VREVERSE VZERO WAUTOHREF= WHREF= 3 catalog entry description options: DESCRIPTION=entry-description NAME=entry-name
Required Arguments
plot-request(s)
each species the variables to plot and produces a separate graph. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request must have this form: y-variable*x-variable=bubble-size plots the values of two variables and draws a circle (bubble) at each data point. The value of the third variable determines the size of the bubble. y-variable variable plotted on the left vertical axis. x-variable variable plotted on the horizontal axis. bubble-size variable that species the size of the bubbles. Bubble-size must be numeric. If the value of bubble-size is positive, bubbles are drawn with a solid line; if it is negative, bubbles are drawn with a dashed line. Note: If you specify the JAVA, JAVAMETA, JAVAIMG, ACTIVEX, or ACTXIMG device drivers, then either the x-variable or the y-variable must be numeric. If you specify the x-variable as a character and the y-variable as numeric, SAS/GRAPH converts the x-axis to display the character values and the y-axis to display the numeric values. 4
Options
Options in a BUBBLE statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.
1326
BUBBLE Statement
Chapter 45
ANNOTATE=Annotate-data-set
species a data set to annotate plots that are produced by the BUBBLE statement.
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643 AUTOHREF
draws reference lines at all major tick marks on the horizontal axis. LAUTOHREF=, CAUTOHREF=, and WAUTOHREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the HAXIS= option.
AUTOVREF
draws reference lines at all major tick marks on the vertical axis. LAUTOVREF=, CAUTOVREF=, and WAUTOVREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the VAXIS= option.
BCOLOR=bubble-color
species the color for the bubbles. If you do not specify the BCOLOR= option, then the bubble color becomes the color of the default style (GSTYLE) or the color specied by the current ODS style (if used).
Featured in:
TwoColorAltRamp elements.
BFILL=SOLID|GRADIENT
enables you to generate solid or gradient-lled bubbles. By default, the JAVA and ActiveX devices create solid bubbles. BFILL=SOLID lls the bubbles with the color specied by the BCOLOR= option. If the BFILL option is not specied, then the color is specied by the current style. If you are using specic ODS style, the color comes from the contrast color attribute within the GraphData1 style element. BFILL=GRADIENT starts with the current background color and gradually transitions to the color specied with the BCOLOR= option or the color of the current style. If you are using an ODS style, the colors are controlled by the startcolor and endcolor attributes of the TwoColorAltRamp style element. Note: The SAS/GRAPH ActiveX control displays negative values as empty circles. 4
Restriction: Not supported by Java and ActiveX BFONT=font
species the font to use for bubble labels. See Chapter 11, Specifying Fonts in SAS/ GRAPH Programs, on page 153 for details on how to specify font. If you omit the BFONT= option, a font specication is searched for in this order:
1 the FTEXT= option in a GOPTIONS statement 2 the font specied by the current style 3 the default hardware font
Featured in:
Style reference: Font attribute of the GraphValueText element Restriction: Not supported by Java and ActiveX See also: The BLABEL option for information on the location and color of labels
BUBBLE Statement
1327
BLABEL
labels the bubbles with the values of the third variable. If the variable has a format, the formatted value is used. By default, bubbles are not labeled. The procedure normally places labels directly outside of the circle at 315 degrees rotation. If a label in this position does not t in the axis area, other 45-degree placements (that is, 45, 135, and 225 degrees) are attempted. If the label cannot be placed at any of the positions (45, 135, 225, or 315 degrees) without being clipped, the label is omitted. However, labels can collide with other bubbles or previously placed labels. Labels display in the color specied by the CTEXT= option. If you omit the CTEXT=option, the default is the color of the current style. Featured in: Example 2 on page 1358
BSCALE=AREA | RADIUS
species whether the bubble-scaling proportion is based on the area of the circles or the radius measure. By default, BSCALE=AREA. The value that is assigned to the BSCALE= option affects how large the bubbles appear in relation to each other. For example, suppose the third variable value is twice as big for one bubble as it is for another. If BSCALE=AREA, the area of the larger bubble is twice the area of the smaller bubble. If BSCALE=RADIUS, the radius of the larger bubble is twice the radius of the smaller bubble and the larger bubble has more than twice the area of the smaller bubble. Restriction: Not supported by Java and ActiveX
BSIZE=multiplier
species an overall scaling factor for the bubbles so that you can increase or decrease the size of all bubbles by this factor. By default, BSIZE=5. If you specify BSIZE=0, then the default size is used instead. In Web output, the Java applets and the ActiveX Control override the default value. To prevent this override, specify a value for the BSIZE= option, rather than relying on the default value. Featured in: Example 2 on page 1358 Restriction: Partially supported by Java and ActiveX
CAUTOHREF=reference-line-color
species colors for reference lines drawn at major tick marks on the horizontal axis, as specied by the AUTOHREF option. The default color is either the value of the CAXIS= option or the rst color in the color list. Style reference: Color attribute of the GraphGridLines element
CAUTOVREF=reference-line-color
species the color of reference lines drawn at major tick marks on the vertical axis, as determined by the AUTOVREF option. If you do not specify the CAUTOREF option, the default color is the value of the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied. Style reference: Color attribute of the GraphGridLines element.
CAXIS=axis-color
species the color for the axis line and all major and minor tick marks. By default, the procedure uses the color of the current style. The CAXIS= option is overridden by the COLOR= option in an AXIS denition. The COLOR= option in an AXIS denition is overridden by the COLOR= suboption of the MAJOR= and MINOR= options in an AXIS denition. Alias: CA= Style reference: Color attribute of the GraphAxisLines attribute
1328
BUBBLE Statement
Chapter 45
CFRAME=background-color
lls the axis area with the specied color. If the FRAME option is also in effect, the procedure determines the color of the frame according to the precedence list given for the FRAME option description. If the IFRAME= option is in effect, the specied image lls the axis area instead of the specied color.
Style reference: Color attribute of the GraphWalls element CHREF=reference-line-color | (reference-line-color)
species the color of reference lines drawn perpendicular to the horizontal axis. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOHREF= option overrides the CHREF= option for lines drawn with the AUTOHREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the HREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the HREF= option. The syntax of the color list is of the form (color1 color2... colorN). If you do not specify the CHREF= option, the GPLOT procedure uses the color specied by the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE option is specied.
Alias:
CH=
species the color for all text on the axes, including tick mark values, axis labels, and bubble labels. The GPLOT procedure searches for a color specication in this order:
1 colors specied for labels and values on assigned AXIS and LEGEND
statements, which override the CTEXT= option specied in the PLOT statement.
2 the color specied by the CTEXT= option in the PLOT statement. 3 the color specied by the CTEXT= option in the GOPTIONS statement. 4 the color specied in the current style, or, if the NOGSTYLE option is specied,
then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. The COLOR= suboption of a LABEL= option in an AXIS denition overrides the CTEXT= option and determines the color of the axis label. Likewise, the COLOR= suboption of a VALUE= option in an AXIS denition overrides the CTEXT= option and determines the color of the tick marks. or VALUE= option in an AXIS denition, then that COLOR= suboption determines the color of the axis label or the color of the tick mark values, respectively.
Alias:
C=
elements
CVREF=reference-line-color | (reference-line-color) | reference-line-color-list
species the color of reference lines drawn perpendicular to the vertical axis. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOVREF= option overrides the CVREF= option for lines drawn with the AUTOVREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the VREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the VREF= option. The syntax of the color list is of the form (color1 color2... colorN). If you do not specify the CVREF= option, the GPLOT procedure uses the color specied by the CAXIS=
BUBBLE Statement
1329
option. If neither option is specied, the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE option is specied. Alias: CV= Style reference: Color attribute of the GraphGridLines element.
DATAORDER=entry-description
plots character of midpoint-type data in data order instead of the default alphabetical order. Restriction: Supported by Java and ActiveX only
DESCRIPTION=description
species the description of the catalog entry for the plot. The maximum length for entry-description is 256 characters. The description does not appear on the plot. By default, the procedure assigns a description of the form BUBBLE OF variable*variable=variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information, refer to the discussion of Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following locations: 3 in the Results window. 3 among the catalog-entry properties that you can view from the Explorer window 3 in the Description eld of the PROC GREPLAY window. 3 the data tip text for Web output (depending on the device driver you are using). See Data Tips for Web Presentations on page 600 for details.
Alias:
DES=
FRAME | NOFRAME
species whether a frame is drawn around the axis area. The default is FRAME. If you also use a BUBBLE2 or PLOT2 statement and your plotting statements have conicting frame specications, FRAME is used. For the frame color, a specication is searched for in this order: 1 the CAXIS= option 2 the COLOR= option in the AXIS denition assigned to the vertical axis 3 the COLOR= option in the AXIS denition assigned to the horizontal axis 4 the default, which is the color dened by the current style. To ll the axis area with a background color, use the CFRAME= option. To ll the axis area with a background image, use the IFRAME= option. species the color of error bars in bar charts. The default is the color of the response axis, which is controlled by the CAXIS= option. Alias: FR|NOFR=
FRONTREF
species that reference lines drawn by the AUTOREF or REF= options should be drawn in front of the bars. By default, reference lines are drawn on the back plane of the axis.
GRID
draws reference lines at all major tick marks on both axes. You get the same result when you use all of these options in a BUBBLE statement: AUTOHREF, AUTOVREF, FRAME, LVREF=34, and LHREF=34. The line type for GRID is 34.
1330
BUBBLE Statement
Chapter 45
species major tick mark values for the horizontal axis or assigns an axis denition. For a description of value-list, see the HAXIS= option on page 1344 for the PLOT statement. To assign labels to horizontal reference lines, specify an axis denition that contains the REFLABEL= option. Labels are applied in sequence to all reference lines drawn with the AUTOHREF and HREF= options. If you assign an axis denition that does not currently exist, the option is ignored. By default, the procedure scales the axis and provides an appropriate number of tick marks. If data values fall outside of the range that is specied by the HAXIS= option, then by default the outlying data values are not used in interpolation calculations. For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 196.
Featured in:
Restriction: Partially supported by Java and ActiveX See also: About the Input Data Set on page 1321 for more information on values
out of range
HMINOR=number-of-minor-ticks
species the number of minor tick marks that are drawn between each major tick mark on the horizontal axis. Minor tick marks are not labeled. The HMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS denition. You must specify a positive number.
Alias:
draws one or more reference lines perpendicular to the horizontal axis at points that are specied by value-list. For a description of value-list HAXIS= option on page 1344 HAXIS for the PLOT statement. LHREF=, CHREF=, and WHREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the HAXIS= option.
HREVERSE
species that the order of the values on the horizontal axis be reversed. For Web output that is generated with a Java device driver, the horizontal axis data must be numeric.
Restriction: Partially supported by Java and ActiveX HZERO
species that tick marks on the horizontal axis begin in the rst position with a value of zero. The HZERO request is ignored if negative values are present for the horizontal variable or if the horizontal axis has been specied with the HAXIS= option.
IFRAME=leref | external-le
identies the image le you want to apply to the backplane of the plot. See also the IMAGESTYLE= option and Displaying Images on Data Elements on page 183. The IFRAME= option is overridden by the NOIMAGEPRINT goption. For more information about the NOIMAGEPRINT option, see IMAGEPRINT on page 389.
Restriction: Not supported by Java
BUBBLE Statement
1331
species whether to tile multiple instances of the image to ll the backplane (TILE) or to stretch the image to t the backplane frame (FIT). The TILE value is the default. For more information see the IFRAME= option.
LAUTOHREF=reference-line-type
species the line type for reference lines at major tick marks on the horizontal axis, as specied by the AUTOHREF option. Line types are specied as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line.
Style reference: LineStyle attribute of the GraphGridLines element LAUTOVREF=reference-line-type
species a line type for reference lines drawn at major tick marks on the vertical axis, as specied by the AUTOVREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line.
Style reference: LineStyle attribute of the GraphGridLines element LHREF=reference-line-type | (reference-line-type) | reference-line-type-list
species line types for reference lines drawn perpendicular to the horizontal axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOHREF= option overrides the LHREF= option for lines drawn with the AUTOHREF option. Specifying a single line type in parentheses applies that line type only to the rst reference line drawn with the HREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the HREF= option. The syntax of the line type list is of the form (type1 type2... typeN). The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line.
Alias:
LH=
Style reference: LineStyle attribute of the GraphGridLines element LVREF=reference-line-type | (reference-line-type) | reference-line-type-list
species line types for reference lines drawn perpendicular to the vertical axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOVREF= option overrides the LVREF= option for lines drawn with the AUTOVREF option. Specifying a single line type in parentheses applies that line type only to the rst line drawn by the VREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the VREF= option. The syntax of the line type list is of the form (type1 type2... typeN). The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify colors for these references lines, use the CVREF= option. To specify labels for these reference lines, use the VAXIS= option.
Alias:
LV=
1332
BUBBLE Statement
Chapter 45
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GPLOT. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique name-for example, GPLOT1.
NOAXIS
suppresses the axes, including axis lines, axis labels, all major and minor tick marks, and tick mark values.
Alias:
NOAXES
VAXIS=value-list | AXIS<1...99>
species the major tick mark values for the vertical axis or assigns an axis denition. For a description of the value-list, see the HAXIS= option on page 1344. To assign labels to reference lines, specify an axis denition that contains the REFLABEL= option. The labels are applied in sequence to all reference lines dened with the AUTOVREF and VREF= options. For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 196.
Featured in:
species the number of minor tick marks that are drawn between each major tick mark on the vertical axis. Minor tick marks are not labeled. The VMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS denition. You must specify a positive number.
Alias:
draws one or more reference lines perpendicular to the vertical axis at points that are specied by value-list. For a description of the value-list, see the HAXIS= option on page 1344. LVREF=, CVREF=, and WVREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the VAXIS= option.
VREVERSE
species that the order of the values on the vertical axis should be reversed.
VZERO
species that tick marks on the vertical axis begin in the rst position with a zero. The VZERO request is ignored if the vertical variable either contains negative values or has been ordered with the VAXIS= option or the ORDER= option in an AXIS statement.
WAUTOHREF=N
species the line width for all reference lines at major tick marks on the horizontal axis as determined by the AUTOHREF option. Line widths are specied as whole numbers with the default value being 1. To specify a color for these reference lines, use the CAUTOREF= option.
Style reference: LineThickness attribute of the GraphGridLines element
BUBBLE2 Statement
1333
WAUTOVREF=N
species the line width for all reference lines at major tick marks on the vertical axis as determined by the AUTOVREF option. Line widths are specied as whole numbers with the default value being 1. To specify a color for these reference lines, use the CAUTOREF= option. Style reference: LineThickness attribute of the GraphGridLines element
WHREF=N
species line widths for reference lines as determined by the horizontal axis. Line widths are specied as whole numbers. To specify colors for these reference lines, use the CREF= option. Style reference: LineThickness attribute of the GraphGridLines element
WVREF=N
species line widths for reference lines as determined by the vertical axis. Line widths are specied as whole numbers. To specify colors for these reference lines, use the CREF= option. Style reference: LineThickness attribute of the GraphGridLines element
BUBBLE2 Statement
Creates a second vertical axis on the right side of a graph produced by an accompanying BUBBLE or PLOT statement. A second variable can be plotted against this axis.
Requirements: You cannot use the BUBBLE2 statement alone. You can use it only with a BUBBLE or PLOT statement. At least one plot request is required. Global statements: AXIS, FOOTNOTE, TITLE
Description
The BUBBLE2 statement species one or more plot requests that name the horizontal and right vertical axis variables and the variable that controls the size of the bubbles. This statement automatically does the following: 3 scales the axes to include the maximum and minimum data values 3 labels each axis with the name of its variable or an associated label 3 displays each major tick mark value 3 draws circles for values that are located within the axes.
1334
BUBBLE2 Statement
Chapter 45
You can use statement options to control right vertical axis scaling, draw reference lines on the right vertical axis, control the display of the bubbles, display a background color or image, and specify annotation. In addition, you can use global statements to modify the axes (AXIS statement), and add text to the graph (TITLE, NOTE, and FOOTNOTE statements). You can also use the Annotate data set to enhance the plot.
Syntax
BUBBLE2 plot-request(s) </option(s)>; option(s) can be one or more options from any or all of the following categories:
Required Arguments
plot-request(s)
each species the variables to plot and produces a separate graph. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request must have this form:
BUBBLE2 Statement
1335
y-variable*x-variable=bubble-size plots the values of two variables and draws a circle (bubble) at each data point. The value of the third variable determines the size of the bubble. All of these variables must be in the input data set: y-variable variable plotted on the right vertical axis; typically it is different from y-variable in the accompanying BUBBLE or PLOT statement. x-variable variable plotted on the horizontal axis; it is the same as x-variable in the accompanying BUBBLE or PLOT statement. bubble-size species the size of the bubbles. Bubble-size must be numeric. If the value of bubble-size is positive, bubbles are drawn with a solid line; if it is negative, bubbles are drawn with a dashed line.
Options
Options for the BUBBLE2 statement are identical to the options for the BUBBLE statement with exception of the following, which are ignored if specied: AUTOHREF CAUTOHREF= CHREF= DESCRIPTION= HAXIS= HMINOR= HREF= HZERO= IFRAME= IMAGESTYLE = LAUTOHREF= LHREF= NAME= WAUTOHREF= WHREF= See BUBBLE Statement on page 1323 for complete descriptions of options used with the BUBBLE2 statement.
1336
PLOT Statement
Chapter 45
These plot requests generate a plot in which both sets of bubbles have the same value (size) but different locations on the graph. 3 The vertical axis variables are the same, Y, but the bubble size variables, S and S2, are different:
bubble y*x=s; bubble2 y*x=s2;
The resulting plot has two identical vertical axes and two sets of concentric bubbles of different sizes. 3 Both the vertical axis variables, Y and Y2, and the bubble size variables, S and S2, are different:
bubble y*x=s; bubble2 y2*x=s2;
These plot requests produce the equivalent of an overlay plot in which two different sets of bubbles plotted against different vertical axes are displayed on the same graph. The plot requests on the BUBBLE and BUBBLE2 statements must be evenly matched, for example:
bubble y*x=s b*a=c; bubble2 y2*x=s b2*a=c2;
These statements produce two graphs each with two vertical axes. The rst pair of plot requests (Y*X=S and Y2*X=S) produce one graph in which the variable X is plotted on the horizontal axis, the variable Y is plotted on the left axis, and the variable Y2 is plotted on the right axis. In this pair, the value of S is the same for both requests. The second pair of plot requests (B*A=C and B2*A=C2) produce another graph in which the variable A is plotted on the horizontal axis, the variable B is plotted on the left axis, and the variable B2 is plotted on the right axis. Any modications to horizontal axes specications must be identical for both statements; if they are different, the BUBBLE2 axis specication is ignored. If the scale of values for the left and right vertical axes is the same and you want both axes to represent the same range of values, specify the range with a VAXIS= option in both the BUBBLE and BUBBLE2 statements.
PLOT Statement
Creates plots in which one variable is plotted on the horizontal axis and a second variable is plotted on the left vertical axis. At least one plot request is required. AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, TITLE Supports: Drill-down functionality
Requirements: Global statements:
Description
The PLOT statement species one or more plot requests that name the horizontal and left vertical axis variables, and can specify a third classication variable. This statement automatically does the following:
PLOT Statement
1337
3 scales the axes to include the maximum and minimum data values 3 plots data points within the axes 3 labels each axis with the name of its variable and displays each major tick mark
value. You can use statement options to manipulate the axes, modify the appearance of your graph, and describe catalog entries. You can use SYMBOL denitions to modify plot symbols for the data points, join data points, draw regression lines, plot condence limits, or specify other types of interpolations. For more information on the SYMBOL statement, see About SYMBOL Denitions on page 1350. In addition, you can use global statements to modify the axes; add titles, footnotes, and notes to the plot; or modify the legend if one is generated by the plot. You can also use an Annotate data set to enhance the plot.
Syntax
PLOT plot-request(s) </option(s)>; option(s) can be one or more options from any or all of the following categories:
3 plot options:
AREAS=n GRID LEGEND | LEGEND=LEGEND<1...99> NOLEGEND OVERLAY REGEQN SKIPMISS 3 appearance options: ANNOTATE=Annotate-data-set CAXIS=axis-color CFRAME=background-color COUTLINE=outline-color CTEXT=text-color FRAME | NOFRAME FRONTREF IFRAME= leref | external-le IMAGESTYLE = TILE | FIT NOAXIS | NOAXES 3 horizontal axis options: AUTOHREF CAUTOHREF=reference-line-color CHREF=reference-line-color | (reference-line-color) | reference-line-color-list HAXIS=value-list | AXIS<1...99> HMINOR=number-of-minor-ticks HREF=value-list HREVERSE HZERO LAUTOHREF=reference-line-type
1338
PLOT Statement
Chapter 45
LHREF=reference-line-type | (reference-line-type) | reference-line-type-list 3 vertical axis options: AUTOVREF CAUTOVREF=reference-line-color CVREF=reference-line-color | (reference-line-color) | reference-line-color-list LAUTOVREF=reference-line-type LVREF=reference-line-type | (reference-line-type) | reference-line-type-list VAXIS=value-list | AXIS<1...99> VMINOR=number-of-minor-ticks VREF=value-list VREVERSE VZERO WAUTOVREF WVREF
3 ODS options:
HTML=variable HTML_LEGEND=variable
Required Arguments
plot-request(s)
each species the variables to plot and produces a separate graph, unless you specify OVERLAY. All variables must be in the input data set. Multiple plot requests are separated with blanks. You can plot character or numeric variables. A plot request can be any of these: y-variable*x-variable<=n> plots the values of two variables and can assign a SYMBOL denition to the plot. y-variable variable plotted on the left vertical axis. x-variable variable plotted on the horizontal axis. n number of the nth generated SYMBOL denition. Note: The nth generated SYMBOL denition is not necessarily the same as the nth SYMBOL statement. Plot requests of the form y-variable*x-variable=n assign the SYMBOL denition that is designated by n to the plot that is produced by y-variable*x-variable. For more information, see About Plot Requests that Assign a SYMBOL Denition on page 1351. 4 (y-variable(s))*(x-variable(s)) plots the values of two or more variables and produces a separate graph for each combination of Y and X variables. That is, each Y*X pair is plotted on a separate set of axes unless you specify OVERLAY.
PLOT Statement
1339
y-variable(s) variables plotted on the left vertical axes. x-variable(s) variables plotted on the horizontal axes. If you use only one y-variable or only one x-variable, omit the parentheses for that variable, for example:
plot (temp rain)*month;
This plot request produces two plots, one of TEMP and MONTH and one of RAIN and MONTH. y-variable*x-variable=third-variable plots the values of two variables against a third classication variable y-variable variable plotted on the left vertical axis. x-variable variable plotted on the horizontal axis. third-variable classication variable against which y-variable and x-variable are plotted. Third-variable can be character or numeric, but numeric variables should contain discrete rather than continuous values, or should be formatted to provide discrete values. A separate plot (set of data points) is produced for each unique value of third-variable; that is, all plots are drawn on the same set of axes, and a legend is automatically generated to show the plot symbol and color for each value of the classication variable. Note: If a BY statement is used to produce multiple plots, you can make the legend identical across graphs by specifying the UNIFORM option in the PROC GPLOT statement. 4 The following plot request produces a graph with a plot line for each department and a legend that shows the plot symbol for each department:
plot sales*weekday=dept;
For an example of a plot that species a third-variable, see Example 8 on page 1373. You can use more than one type of plot request in a single PLOT statement (provided that you do not specify OVERLAY), for example:
plot temp*month rain*month=2;
Options
Options in a PLOT statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.
ANNOTATE=Annotate-data-set
species a data set to annotate plots that are produced by the PLOT statement.
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643.
1340
PLOT Statement
Chapter 45
AREAS=n
lls all the areas below plot line n with a pattern. The value of n species which areas to ll: 3 AREAS=1 lls the rst area. 3 AREAS=2 lls both the rst and second areas, and so on. If you specify a value for the AREAS= option that is greater than the number of bounded areas in the plot, the area between the top plot line and the axis frame is lled. Before an area can be lled, the data points that border the area must be joined by a line. Use a SYMBOL statement with one of these interpolation methods to join the data points: INTERPOL=JOIN INTERPOL=STEP INTERPOL=Rseries INTERPOL=SPLINE | SM | L See SYMBOL Statement on page 250 for details on interpolation methods. By default, the AREAS= option lls areas by rotating a solid ll through the list of colors dened in the current style. If the NOGSTYLE option is specied, the areas are lled by rotating a solid ll through the devices color list. If the graph needs more patterns, it rotates hatch patterns, beginning with the M2N0 pattern. See PATTERN Statement on page 238 for more information on map/plot patterns. However, if color is limited to a single color with the CPATTERN= or COLORS= graphic options, the solid pattern is skipped and the rst default pattern is M2N0. If the COLORS= graphic option species a single color, use as many SYMBOL statements as you have areas to ll because the INTERPOL= setting does not automatically apply to multiple symbol denitions. Note: If you have specied the NOGSTYLE option and the rst color in your devices default color list is black, color rotation begins with the second color in the list; that is, there are no solid black patterns. See How Default Patterns and Outlines Are Generated on page 246 for more information. 4 You can alter the default pattern behavior by specifying patterns and colors on PATTERN statements that specify map and plot patterns. A separate PATTERN denition is needed for each specied area. If you specify the PATTERN statements, the AREAS= option uses the lowest numbered PATTERN statement rst. If it runs out of patterns, it uses the default behavior for map and plot patterns. See PATTERN Statement on page 238 for details. Pattern denitions are assigned to the areas below the plot lines in the order the plots are drawn. The rst area is that between the horizontal axis and the plot line that is drawn rst. The second area is that above the rst plot line and below the plot line that is drawn second, and so on. If the line that is drawn second lies below the line that is drawn rst, the second area is hidden when the rst is lled. The plots with the lower line values must be drawn rst to prevent one area ll from overlaying another. If the lines cross, only the part of an area that is above the previous line is visible. Therefore, when creating multiple plots in combination with the OVERLAY option, the PLOT statements must be ordered so that the plot request that produces the lowest line value is rst (leftmost), the plot request that produces the next lowest line value is second plot request, and so on. If you produce multiple plots with a y-variable*x-variable=third-variable plot request, the lines are plotted in order of increasing third variable values. Therefore, the data must be recoded so that the lowest value of the third variable produces the lowest plot line, the next lowest value produces the next lowest plot line, and so on.
PLOT Statement
1341
The AREAS= option works only if all plot lines are generated by the same PLOT or PLOT2 statement. If you use the VALUE= option in the SYMBOL statement, some symbols might be hidden. If reference lines are also specied with the AREAS= option, they are drawn behind the pattern ll.
Featured in:
draws reference lines at all major tick marks on the horizontal axis. If the AREAS= option is also used, the lled areas cover the reference lines. To draw lines on top of the lled areas, use the FRONTREF option. LAUTOHREF=, CAUTOHREF=, and WAUTOHREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the HAXIS= option.
AUTOVREF
draws reference lines at all of the major tick marks on the vertical axis. If you also use the AREAS= option, the lled areas cover the reference lines. To draw lines on top of the lled areas, use the FRONTREF option in either the PROC GPLOT statement or the PLOT statement. LAUTOVREF=, CAUTOVREF=, and WAUTOVREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the VAXIS= option.
CAUTOHREF=reference-line-color
species colors for reference lines drawn at major tick marks on the horizontal axis, as specied by the AUTOHREF option. The default color is either the value of the CAXIS= option or the rst color in the color list.
CAUTOVREF=reference-line-color
species the color of reference lines drawn at major tick marks on the vertical axis, as determined by the AUTOVREF option. If you do not specify the CAUVTOREF option, the default color is the value of the CAXIS= option. If neither option is specied, the default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied.
CAXIS=axis-color
species the color for the axis line and all major and minor tick marks. The default color is retrieved from the current style or from the devices color list if the NOGSTYLE option is specied.
Alias:
CA=
CFRAME=background-color
lls the axis area with the specied color. If the FRAME option is also in effect, the procedure determines the color of the frame according to the precedence list given later in the FRAME option description. If the IFRAME= option is in effect, an image appears in the background instead of the color.
Style reference: Color attribute of the GraphWalls element. CHREF=reference-line-color | (reference-line-color) | reference-line-color-list
species the color of reference lines drawn perpendicular to the horizontal axis. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOHREF= option overrides the CHREF= option for reference lines drawn with the AUTOHREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the HREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the HREF=
1342
PLOT Statement
Chapter 45
option. The syntax of the color list is of the form (color1 color2 ...colorN). If you do not specify the CHREF= option, the GPLOT procedure uses the color specied by the CAXIS= option. If neither option is specied, the default color is retrieved from the current style of from the rst color in the color list if the NOGSTYLE option is specied. Alias: CH= Style reference: Color attribute of the GraphGridLines element
COUTLINE=outline-color
species the color of the outline that is drawn around lled areas. The lled areas are generated when the SYMBOL statement species the INTERPOL=map/ plot-pattern option or the GOPTIONS statement species the INTERPOL= optionINTERPOL on page 391. The default outline color is specied in the current style. However, if the NOGSTYLE option is specied, then the default color is the rst color in the devices color list (the foreground color), and the default slice outline color is determined as follows: 3 If you do not specify a PATTERN statement, the default outline color is the color dened in the current style. 3 If you specify the NOGSTYLE option and no PATTERN statement, the default outline color is black for the Java or ActiveX devices. Otherwise, the default outline color is the foreground color. If you specify an EMPTY PATTERN statement, then the default outline color is the same as the ll color. The COUTLINE= option overrides the SYMBOL statement option CO=. Restriction: Not supported by Java Style reference: Color attribute of the GraphOutlines element
CTEXT=text-color
species a color for all text on the axes and legend, including axis labels, tick mark values, legend labels, and legend value descriptions. The GPLOT procedure searches for a color specication in this order: 1 colors specied for labels and values on assigned AXIS and LEGEND statements, which override the CTEXT= option specied in the PLOT statement. 2 the color specied by the CTEXT= option in the PLOT statement. 3 the color specied by the CTEXT= option in the GOPTIONS statement. 4 the color specied in the current style, or, if the NOGSTYLE option is specied, then the default color is black for the Java and ActiveX devices and the rst color in the color list for all other devices. The LEGEND statements VALUE= color is used for legend values, and its LABEL= color is used for legend labels. The AXIS statements VALUE= color is used for axis values, and its LABEL= color is used for axis labels. However, if the AXIS statement species only general axis colors with its COLOR= option, the CTEXT= color overrides the general COLOR= specication and is used for axis labels and values; the COLOR= color is still used for all other axis colors, such as tick marks. Note: If you use a BY statement in the procedure, the color of the BY variable labels is controlled by the CBY= option in the GOPTIONS statement. 4 Alias: C= Style reference: Color attributes of the GraphValueText and the GraphLabelText elements
CVREF=reference-line-color | (reference-line-color) | reference-line-color-list
species the color of reference lines drawn perpendicular to the vertical axis. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options.
PLOT Statement
1343
Specifying a single color without parentheses applies that color to all reference lines. The CAUTOVREF= option overrides the CVREF= option for lines drawn with the AUTOVREF option. Specifying a single color in parentheses applies that color only to the rst reference line drawn with the VREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the VREF= option. The syntax of the color list is of the form (color1 color2... colorN). If you do not specify the CVREF= option, the GPLOT procedure uses the color specied by the CAXIS= option. If neither option is specied, the default color is retrieved from the current style of from the rst color in the color list if the NOGSTYLE option is specied.
Alias:
CV=
species the description of the catalog entry for the plot. The maximum length for entry-description is 256 characters. The description does not appear on the plot. By default, the procedure assigns a description of the form PLOT OF variable*variable=variable. The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information, refer to the discussion of Substituting BY Line Values in a Text String on page 293. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. The descriptive text is shown in each of the following locations:
3 in the Results window. 3 among the catalog-entry properties that you can view from the Explorer window. 3 in the Description eld of the PROC GREPLAY window. 3 the data tip text for Web output (depending on the device driver you are using).
See Data Tips for Web Presentations on page 600 for details.
Alias:
DES=
FRAME | NOFRAME
species whether a frame is drawn around the axis area. The default is FRAME. If you also use a BUBBLE2 or PLOT2 statement and your plotting statements have conicting frame specications, FRAME is used. For the frame color, a specication is searched for in this order:
1 the CAXIS= option 2 the COLOR= option in the AXIS denition assigned to the vertical axis 3 the COLOR= option in the AXIS denition assigned to the horizontal axis 4 the default, which is the color dened by the current style.
To ll the axis area with a background color, use the CFRAME= option. To ll the axis area with a background image, use the IFRAME= option. species the color of error bars in bar charts. The default is the color of the response axis, which is controlled by the CAXIS= option.
Alias:
FR|NOFR=
FRONTREF
species that reference lines drawn by the AUTOREF or REF= options should be drawn in front of the bars. By default, reference lines are drawn on the back plane of the axis.
1344
PLOT Statement
Chapter 45
GRID
draws reference lines at all major tick marks on both axes. The line color is the color of the axis. When specied in a PLOT2 statement, the reference lines are drawn on the vertical axis on the right side of the plot.
HAXIS=value-list | AXIS<1 . . . 99>
species major tick mark values for the horizontal axis or assigns an axis denition. By default, the procedure scales the axis and provides an appropriate number of tick marks. To assign labels to reference lines, use an axis denition that contains the REFLABEL= option. The labels are applied in sequence to all reference lines dened with the AUTOHREF and HREF= options. The way you specify value-list depends on the type of variable:
3 For date-time values, value-list includes any SAS date, time, or datetime value
described for the SAS functions INTCK and INTNX, shown here as SAS-value: SAS-valuei < ...SAS-valuei> SAS-valuei TO SAS-value i<BY interval>
species the number of minor tick marks drawn between each major tick mark on the horizontal axis. Minor tick marks are not labeled. The HMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS denition. You must specify a positive number.
Alias:
draws one or more reference lines perpendicular to the horizontal axis at points that are specied by value-list. See the HAXIS= option for a description of value-list. If the AREAS= option is also used, the lled areas cover the reference lines. To draw
PLOT Statement
1345
lines on top of the lled areas, use the FRONTREF option. LHREF=, CHREF=, and WHREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the HAXIS= option.
HREVERSE
species that the order of the values on the horizontal axis be reversed. For Web output that is generated with a Java device driver, the horizontal axis data must be numeric. To specify line widths for these reference lines, use the WAUTOHREF= option.
Restriction: HTML=variable
identies the variable in the input data set whose values create links in the HTML output le that is generated by ODS. These links are associated with the plot points, or if the AREA= option is used, with the areas between plot lines. The links point to the data or graph that you want to display when the user drills down on the plot point or area. There is no limit on the length of the variable.
Restriction:
Partially supported by Java and ActiveX for the PLOT statement and not supported by Java and ActiveX for the PLOT2 statement.
identies the variable in the input data set whose values are used to create links in the HTML output le that is generated by ODS. When the HTML output le is displayed in a Web browser, clicking on an element in the legend displays the URL that was specied for that legend element, based on the value of the variable that is named as the value of the HTML_LEGEND option. The maximum length for the value of this variable is 1024 characters. To see an example that generates a drill-down graph using ODS, see Example 10 on page 1379.
Restriction:
species that tick marks on the horizontal axis begin in the rst position with a value of zero. The HZERO request is ignored if negative values are present for the horizontal variable or if the horizontal axis has been specied with the HAXIS= option.
IFRAME=leref | external-le
identies the image le you want to apply to the backplane frame of the plot. See also the IMAGESTYLE= option and Displaying an Image in Graph Frame on page 182. The IFRAME= option is overridden by the NOIMAGEPRINT goption. For more information about the NOIMAGEPRINT option, see IMAGEPRINT on page 389. For Web output that is generated with the ACTIVEX or ACTXIMG device drivers,
Restriction:
species whether to tile multiple instances of the image to ll the backplane frame (TILE) or to stretch a single instance of the image to ll the backplane frame (FIT). The TILE value is the default. See also the IFRAME= option.
Restriction: Not supported by Java LAUTOHREF=reference-line-type
species a line type for reference lines drawn at major tick marks on the horizontal axis, as specied by the AUTOHREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46
1346
PLOT Statement
Chapter 45
specify dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line.
LAUTOVREF=reference-line-type
species a line type for reference lines drawn at major tick marks on the vertical axis, as specied by the AUTOVREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line.
Style reference: LineStyle attribute of the GraphGridLines element. LEGEND | LEGEND=LEGEND<1...99>
3 a PLOT statement that includes the OVERLAY option does not automatically
generate a legend. In these plot types, use LEGEND to produce a default legend, or LEGEND=LEGENDn to assign a dened LEGEND statement to the plot. The default legend is centered below the axis frame and identies which colors and plot symbols represent the y-variables that you specify for the plots. To control the order of the legend entries for overlaid plots, use the ORDER= option in the LEGEND statement and specify the list of variables in quotes in the preferred order. For example, the following causes the legend entry for y3 to be displayed rst, y1 next, and y2 last:
legend1 order=(y3 y1 y2); proc gplot data=mydata2; plot (y1 y2 y3)*x / overlay legend=legend1; run;
species line types for reference lines drawn perpendicular to the horizontal axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOHREF= option overrides the LHREF= option for lines drawn with the AUTOHREF option. Specifying a single line type in parentheses applies that line type only to the rst reference line drawn with the HREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the HREF= option. The syntax of the line type list is of the form (type1 type2... typeN). The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify colors for these references lines, use the CHREF= option. To specify labels for these reference lines, use the HAXIS= option.
Alias:
LH=
PLOT Statement
1347
Style reference: LineStyle attribute of the GraphGridLines element LVREF=reference-line-type | (reference-line-type) | reference-line-type-list
species line types for reference lines drawn perpendicular to the vertical axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 species a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOVREF= option overrides the LVREF= option for lines drawn with the AUTOVREF option. Specifying a single line type in parentheses applies that line type only to the rst line drawn with the VREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the VREF= option. The syntax of the line type list is of the form (type1 type2... typeN). The default line type is retrieved from the current style, or if the NOGSTYLE option is specied, the default value is 1, which draws a solid line. To specify colors for these references lines, use the CVREF= option. To specify labels for these reference lines, use the VAXIS= option. For needle plots that are generated with a Java or ActiveX device driver, the value of the LVREF= option is not applied to the default reference line that is drawn at zero when the minimum value of the vertical axis is less than zero. This line is solid (not dashed).
Alias:
Featured in:
Style reference: LineStyle attribute of the GraphGridLines element Restriction: Partially supported by Java and ActiveX NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is GPLOT. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique name-for example, GPLOT1.
NOAXIS
suppresses the axes, including axis lines, axis labels, all major and minor tick marks, and tick mark values.
Alias:
NOAXES
NOLEGEND
suppresses the legend that is generated by a plot request of the type y-variable*x-variable=third-variable.
OVERLAY
places all the plots that are generated by the PLOT statement on one set of axes. The axes are scaled to include the minimum and maximum values of all of the variables, and the variable names or labels associated with the rst pair of variables label the axes. The OVERLAY option produces a legend if you include the LEGEND or the LEGEND=n option in the PLOT statement. OVERLAY is not enabled with plot requests of the form y-variable*x-variable=third-variable. However, you can achieve an overlay effect by using a PLOT and PLOT2 statement. When generating output for the Web with the JAVA, JAVAMETA, or JAVAIMG device drivers, the OVERLAY option cannot be used in the PLOTor PLOT2 statement under these conditions:
1348
PLOT Statement
Chapter 45
displays the regression equation that is specied in the INTERPOL= option of the SYMBOL statement in the lower left hand corner of the plot. You cannot modify the format that is used for the equation. The GPLOT regression equation is computed from the screen coordinates of the markers. Therefore, a graph might not display if the chart area for the plot becomes so small that markers cannot be drawn because there are no coordinates from which to build the regression equation. In such cases, the regression equation is no longer meaningful. Featured in: Example 4 on page 1362 Restriction: Not supported by ActiveX
SKIPMISS
breaks a plot line or an area ll at occurrences of missing values of the Y variable. By default, plot lines and area lls are not broken at missing values. The SKIPMISS option is available only with JOIN interpolation. If the SKIPMISS option is used, observations should be sorted by the independent (horizontal axis) variable. If the plot request is y-variable*x-variable=third-variable, observations should also be sorted by the values of the third variable. See also: About the Input Data Set on page 1321
VAXIS=value-list | AXIS<1...99>
species the major tick mark values for the vertical axis or assigns an axis denition. See the HAXIS= option for a description of the value-list. To assign labels to reference lines, use an axis denition that contains the REFLABEL= option. The labels are applied in sequence to all reference lines dened with the AUTOVREF and VREF= options. For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 196. Featured in: Example 4 on page 1362 and Example 5 on page 1365 Restriction: Partially supported by Java and ActiveX
VMINOR=number-of-minor-ticks
species the number of minor tick marks that are drawn between each major tick mark on the vertical axis. Minor tick marks are not labeled. The VMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS denition. You must specify a positive number. Alias: VM= Featured in: Example 2 on page 1358
VREF=value-list
draws one or more reference lines perpendicular to the vertical axis at points that are specied by the value-list. See the HAXIS= option for a description of the value-list. If the AREAS= option is also used, the lled areas cover the reference lines. To draw lines on top of the lled areas, use the FRONTREF option. LVREF=, CVREF=, and
PLOT Statement
1349
WVREF= options can be used to change the line types, colors, and widths of these reference lines. To specify labels for these reference lines, use the VAXIS= option.
Featured in: VREVERSE
species that the order of the values on the vertical axis be reversed.
VZERO
species that tick marks on the vertical axis begin in the rst position with a zero. The VZERO request is ignored if the vertical variable either contains negative values or has been ordered with the VAXIS= option or the ORDER= option in an AXIS statement.
WAUTOHREF=reference-line-type
species the line width for all reference lines at major tick marks on the horizontal axis as determined by the AUTOHREF option. Line widths are specied as whole numbers with the default value being 1. To specify a color for these reference lines, use the CAUTOREF= option. Style reference: LineThickness attribute of the GraphGridLines element
WAUTOVREF=value-list
species the line width for all reference lines at major tick marks on the vertical axis as determined by the AUTOVREF option. Line widths are specied as whole numbers with the default value being 1. To specify a color for these reference lines, use the CAUTOREF= option.
Style reference: LineThickness attribute of the GraphGridLines element WHREF=value-list
species line widths for reference lines as determined by the horizontal axis. Line widths are specied as whole numbers. To specify a color for these reference lines, use the CAUTOREF= option. Style reference: LineThickness attribute of the GraphGridLines element
WVREF=value-list
species line widths for reference lines as determined by the vertical axis. Line widths are specied as whole numbers. To specify a color for these reference lines, use the CAUTOREF= option. Style reference: LineThickness attribute of the GraphGridLines element
1350
PLOT Statement
Chapter 45
Figure 45.7
3 an interpolation method for plotting data 3 how missing values are treated in interpolation calculations
SYMBOL denitions are assigned either by default by the GPLOT procedure or explicitly with a plot request. If no SYMBOL denition is currently in effect, the GPLOT procedure produces a scatter plot of the data points using the default plot symbol. If you need more than one SYMBOL denition, the procedure rotates through the colors dened by the current style, or if the NOGSTYLE option is specied, through the device color list. If the current color list contains only one color, or if all the colors are used, additional plot symbols are used. If SYMBOL denitions have been dened but not explicitly assigned by a plot request of the form y-variable*x-variable=n, the procedure assigns them in the order in which they are generated. For example, this statement creates three plots:
plot y*x b*a s*r;
The procedure assigns the rst generated SYMBOL denition to Y*X, the second generated SYMBOL denition to B*A, and the third to S*R. If more SYMBOL denitions are needed than have been dened, the procedure uses the default denitions for the plots that remain. See SYMBOL Statement on page 250.
PLOT2 Statement
1351
PLOT2 Statement
Produces one or more plots with the vertical axis on the right side of the graph against which a second variable can be plotted.
Requirements: You cannot use the PLOT2 statement alone. It can be used only with a PLOT or BUBBLE statement. At least one plot request is required. Global statements: AXIS, FOOTNOTE , LEGEND , PATTERN, SYMBOL, TITLE
Description
The PLOT2 statement species one or more plot requests that name the horizontal and right vertical axis variables. This statement automatically does the following: 3 plots data points within the axes 3 scales the axes to include the maximum and minimum data values 3 labels each axis with the name of its variable and displays each major tick mark value You can use statement options to manipulate the axes and modify the appearance of your graph. You can use SYMBOL denitions to modify plot symbols for the data points, join data points, draw regression lines, plot condence limits, or specify other types of interpolation. For more information on the SYMBOL statement see About SYMBOL Denitions on page 1350. Note: When using the PLOT2 statement to generate output with the Java or ACTIVEX device drivers, and when the global statement SYMBOL is used, the value of the SYMBOL statement option INTERPOL= cannot be BOX, STD, or HILO. 4 In addition, you can use global statements to modify the axes; to add titles, footnotes, and notes to the plot; or to modify the legend if one is generated by the plot. You can also use an Annotate data set to enhance the plot.
Syntax
PLOT2 plot-request(s) </option(s)>; option(s) can be one or more options from any or all of the following categories: 3 plot options: AREAS=n GRID
1352
PLOT2 Statement
Chapter 45
3 appearance options:
ANNOTATE=Annotate-data-set CAXIS=axis-color CFRAME=background-color COUTLINE=outline-color CTEXT=text-color FRAME | NOFRAME NOAXIS | NOAXES
3 ODS options:
HTML=variable HTML_LEGEND=variable
Required Arguments
plot-request(s)
each species the variables to plot and produces a separate graph, unless you specify the OVERLAY option. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request can be any of these: y-variable*x-variable<=n> plots the values of two variables and can assign a SYMBOL denition to the plot. y-variable variable plotted on the right vertical axis. x-variable variable plotted on the horizontal axis. n number of the nth generated SYMBOL denition. (y-variable(s))*(x-variable(s))
PLOT2 Statement
1353
plots the values of two or more variable and produces a separate graph for each combination of Y and X variables. y-variable(s) variables plotted on the right vertical axes. x-variable(s) variables plotted on the horizontal axes. y-variable*x-variable=third-variable plots the values of two variables against a third classication variable y-variable variable plotted on the right vertical axis. x-variable variable plotted on the horizontal axis. third-variable classication variable against which y-variable and x-variable are plotted. Third-variable can be character or numeric, but numeric variables should contain discrete rather than continuous values, or should be formatted to provide discrete values. For more information about plot requests, see PLOT Statement on page 1336. In a PLOT2 plot request, the X variable for the horizontal axis must be the same as in the accompanying PLOT or BUBBLE statement. Typically, the Y variable for the right vertical axis is different. Use the same types of plot requests with a PLOT2 statement that you use with a PLOT statement, but a PLOT2 statement always plots the values of y-variable on the right vertical axis.
Options
Options for the PLOT2 statement are identical to the options for the PLOT statement except for these options, which are ignored if you specify them: AUTOHREF CAUTOHREF= CHREF= DESCRIPTION= HAXIS= HMINOR= HREF= HREVERSE= HZERO= IFRAME= IMAGESTYLE = LAUTOHREF= LHREF= NAME= WHREF= WAUTOHREF= See PLOT Statement on page 1336 for descriptions of options that you can use with the PLOT2 statement.
1354
PLOT2 Statement
Chapter 45
These statements produce two graphs, each with two vertical axes. The rst pair of plot requests (Y*X and Y2*X) produce one graph in which X is plotted on the horizontal axis, Y is plotted on the left axis, and Y2 is plotted on the right axis. The second pair of plot requests (B*A and B2*A) produce another graph in which A is plotted on the horizontal axis, B is plotted on the left axis, and B2 is plotted on the right axis.
PLOT2 Statement
1355
Figure 45.9
Figure 45.10
For these types of plots, the PLOT2 statement should use a SYMBOL statement that species INTERPOL=NONE and VALUE=NONE.
1356
Examples
Chapter 45
axis. Because the Y variable and the Y2 variable contain different data, two sets of data points are displayed on the graph. For example, if Y is height and Y2 is weight, the plot is like Figure 45.11 on page 1356.
Figure 45.11 Right Axis with Different Values and Different Scale
Figure 45.12
To scale both axes the same, specify the same range of values either with the VAXIS= option in both the PLOT and PLOT2 statements, or with AXIS statements.
Examples
1357
Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
GPLBUBL1
This example shows a bubble plot in which each bubble represents a category of engineer. The plot shows engineers on the horizontal axis and average salaries on the vertical axis. Each bubbles vertical location is determined by the average salary for the category. Each bubbles size is determined by the number of engineers in the category: the more engineers, the larger the bubble.
Set the graphics environment.
goptions reset=all border;
1358
Chapter 45
Create the data set. The data set JOBS contains average salary data for several categories of engineer. It also indicates the number of engineers in each category.
data jobs; length eng $5; input eng dollars num; datalines; Civil 27308 73273 Aero 29844 70192 Elec 22920 89382 Mech 32816 19601 Chem 28116 25541 Petro 18444 34833 ;
Dene axis characteristics. The OFFSET= option species an offset for the tick marks so that bubbles near an axis are not clipped.
axis1 offset=(5,5);
Generate bubble plot. The HAXIS= option assigns the AXIS1 statement to the horizontal axis. The salary averages are assigned a dollar format.
proc gplot data=jobs; format dollars dollar9.; bubble dollars*eng=num / haxis=axis1; run; quit;
1359
AXIS statement
Sample library member: GPLBUBL2
This example modies the code in Example 1. It shows how BUBBLE statement options control the appearance of bubbles and their labels. It also shows how AXIS statements can modify the plot axes.
Set the graphics environment.
goptions reset=all border;
Create the data set. The data set JOBS contains average salary data for several categories of engineer. It also indicates the number of engineers in each category.
data jobs; length eng $5; input eng dollars num; datalines; Civil 27308 73273 Aero 29844 70192 Elec 22920 89382 Mech 32816 19601 Chem 28116 25541 Petro 18444 34833 ;
1360
Chapter 45
Dene axis characteristics. AXIS1 suppresses the horizontal axis label and uses the OFFSET= option to move the rst and last major tick mark values away from the vertical axes so bubbles are not clipped. AXIS2 uses the ORDER= option to set major tick mark intervals. This could be done with the VAXIS= option on the BUBBLE statement, but then you could not suppress the axis label and alter other axis characteristics.
axis1 label=none offset=(5,5); axis2 order=(0 to 40000 by 10000) label=none;
Generate bubble plot. The VMINOR= option species one minor tick mark for the vertical axis. The BLABEL option labels each bubble with the value of variable NUM. Thne BCOLOR= option species the color for the bubbles. The BLABEL option labels the bubbles with the value of the third variable, which in this case is the number of engineers in the job category. The BSIZE option species the size of the bubbles.
proc gplot data=jobs; format dollars dollar9. num comma7.0; bubble dollars*eng=num / haxis=axis1 vaxis=axis2 vminor=1 bcolor=darkred blabel bsize=3; run; quit;
1361
This example modies Example 2 on page 1358 to show how a BUBBLE2 statement generates a right vertical axis that displays the values of the vertical coordinates in a different scale from the scale that is used for the left vertical axis. Salary values are scaled by dollars on the left vertical axis and by yen on the right vertical axis. BUBBLE and BUBBLE2 statement options control the appearance of the graph. In particular, the VAXIS options calibrate the axes so that the data points are identical and only one set of bubbles appears. Note: If the data points are not identical, two sets of bubbles are displayed.
Create the data set JOBS2 and calculate variable YEN. The DATA step uses a SET statement to read the JOBS data set.
data jobs2; set jobs; yen=dollars*125; run;
1362
Chapter 45
Generate bubble plot with second vertical axis. In the BUBBLE statement, the HAXIS= option species the AXIS1 denition and the VAXIS= option scales the left axis. In the BUBBLE2 statement, the VAXIS= option scales the right axis. Both axes represent the same range of monetary values. The BUBBLE and BUBBLE2 statements ensure that the bubbles generated by each statement are identical by coordinating specications on any options in these statements.
proc gplot data=jobs2; format dollars dollar7. num yen comma9.0; bubble dollars*eng=num / haxis=axis1 vaxis=10000 to 40000 by 10000 hminor=0 vminor=1 blabel; bubble2 yen*eng=num / vaxis=1250000 to 5000000 by 1250000 vminor=1; run; quit;
GOPTIONS statement option: BORDER SYMBOL statement Sample library member: GPLVRBL1
1363
In this example, the PLOT statement uses a plot request of the type y-variable*x-variable to plot the variable HEIGHT against the variable WEIGHT. The plot shows that weight generally increases with size. This example then requests the same plot with some modications. As shown by the following output, the second plot request species a regression analysis with condence limits, and scales the range of values along the vertical and horizontal axes. It also displays the regression equation specied for the SYMBOL statement. Because the procedure supports RUN-group processing, you do not have to repeat the PROC GPLOT statement to generate the second plot.
1364
Chapter 45
1365
Dene symbol characteristics. The INTERPOL= option species a cubic regression analysis with condence limits for mean predicted values. The VALUE=and CV= options specify a plot symbol and color. The CI=, CO=, and WIDTH= options specify colors and a thickness for the interpolation and condence-limits lines.
symbol1 interpol=rcclm95 value=circle cv=darkred ci=black co=blue width=2;
Generate scatter plot with regression line. The HAXIS= and VAXIS= options dene the range of axes values. The HMINOR= option species one minor tick mark between major tick marks. The REGEQN option displays the regression equation specied on the SYMBOL1 statement.
plot height*weight / haxis=45 to 155 by 10 vaxis=48 to 78 by 6 hminor=1 regeqn; run; quit;
GOPTIONS statement option: BORDER SYMBOL statement Sample library member: GPLDTPT1
1366
Chapter 45
In this example, the PLOT statement uses a plot request of the type y-variable*x-variable to plot the variable HIGH against the variable YEAR to show the annual highs of the Dow Jones Industrial Average over several decades. This example uses a SYMBOL statement to specify a plot symbol and connect data points with a straight line. In addition, the example shows how PLOT statement options can add reference lines and modify the axes (AXIS statements are not used).
Set the graphics environment.
goptions reset=all border;
Create the data set. STOCKS contains yearly highs and lows for the Dow Jones Industrial Average and the dates of the high and low values each year.
data stocks; input year high low @@; datalines; 1956 521.05 1958 583.65 1960 685.47 1962 726.01 1964 891.71 1966 995.15 1968 985.21 1970 842.00 1972 1036.27 1974 891.66 1976 1014.79 1978 907.74
462.35 436.89 568.05 535.76 768.08 744.32 825.13 631.16 889.15 577.60 858.71 742.12
1957 520.77 1959 679.36 1961 734.91 1963 767.21 1965 969.26 1967 943.08 1969 968.85 1971 950.82 1973 1051.70 1975 881.81 1977 999.75 1979 897.61
419.79 574.46 610.25 646.79 840.59 786.41 769.93 797.97 788.31 632.04 800.85 796.67
1367
Dene symbol characteristics. Specifying INTERPOL=JOIN joins the data points with straight lines and the VALUE= option species the type of symbol used.
symbol1 interpol=join value=dot;
Generate the plot and modify the axis values. The VAXIS= option sets major tick marks for the vertical axis. The HMINOR= and VMINOR= options specify the number of tick marks between major tick marks.
proc gplot data=stocks; plot high*year / haxis=1955 to 1995 by 5 vaxis=0 to 6000 by 1000 hminor=3 vminor=1
Add reference lines. The VREF= option draws reference lines on the vertical axis at three marks. TheLVREF= option species the line style (dashed) for the lines.
vref=1000 3000 5000 lvref=2; run; quit;
1368
Chapter 45
In this example, one PLOT statement plots both the HIGH and LOW variables against the variable YEAR using two plot requests. The OVERLAY option on the PLOT statement determines that both plot lines appear on the same graph. The other PLOT options scale the vertical axis, add a reference line to the plot, and specify the number of minor tick marks on the axes. The SYMBOL, AXIS, and LEGEND statements modify the plot symbols, axes, and legend. Note: If the OVERLAY option is not specied, each plot request generates a separate graph. 4
1369
Create the data set. STOCKS contains yearly highs and lows for the Dow Jones Industrial Average and the dates of the high and low values each year.
data stocks; input year high low @@; datalines; 1956 521.05 462.35 1957 520.77 419.79 1958 583.65 436.89 1959 679.36 574.46 1960 685.47 568.05 1961 734.91 610.25 1962 726.01 535.76 1963 767.21 646.79 1964 891.71 768.08 1965 969.26 840.59 1966 995.15 744.32 1967 943.08 786.41 1968 985.21 825.13 1969 968.85 769.93 1970 842.00 631.16 1971 950.82 797.97 1972 1036.27 889.15 1973 1051.70 788.31 1974 891.66 577.60 1975 881.81 632.04 1976 1014.79 858.71 1977 999.75 800.85 1978 907.74 742.12 1979 897.61 796.67 1980 1000.17 759.13 1981 1024.05 824.01 1982 1070.55 776.92 1983 1287.20 1027.04 1984 1286.64 1086.57 1985 1553.10 1184.96 1986 1955.57 1502.29 1987 2722.42 1738.74 1988 2183.50 1879.14 1989 2791.41 2144.64 1990 2999.75 2365.10 1991 3168.83 2470.30 1992 3413.21 3136.58 1993 3794.33 3241.95 1994 3978.36 3593.35 1995 5216.47 3832.08 ;
Dene symbol characteristics. Each SYMBOL statement species a symbol type for the plot symbols, and connects the data points with a straight line.
symbol1 interpol=join value=dot color=_style_; symbol2 interpol=join value=C font=marker color=_style_ ;
1370
Chapter 45
major=(height=2) minor=(height=1) ; axis2 order=(0 to 6000 by 1000) offset=(0,0) label=none major=(height=2) minor=(height=1) ;
Dene legend characteristics. The LABEL= option suppresses the legend label. The POSITION= option centers the legend inside the top of the axis frame. The MODE= option shares the legend area with other graphics elements.
legend1 label=none position=(top center inside) mode=share;
Generate two plots and display them on the same set of axes. The OVERLAY option species that both plot lines appear on the same graph. The LEGEND= option assigns the LEGEND1 denition to the graph. The VAXIS= option sets major tick marks for the vertical axis. The HMINOR= and VMINOR= options specify the number of tick marks between major tick marks.
proc gplot data=stocks; plot high*year low*year / overlay legend=legend1 vref=1000 to 5000 by 1000 lvref=2 haxis=axis1 hminor=4 vaxis=axis2 vminor=1; run; quit;
PLOT statement options: AREAS= HAXIS= HMINOR= VAXIS= VMINOR= CAXIS= OVERLAY
Other features:
1371
This example uses the AREAS= option in the PLOT statement to ll the areas that are under the plot lines. As in the previous example, two plots are overlaid on the same graph.
Set the graphics environment. BORDER draws a border around the graph.
goptions reset=all border;
Create the data set. STOCKS contains yearly highs and lows for the Dow Jones Industrial Average and the dates of the high and low values each year.
data stocks; input year high low @@;
1372
Chapter 45
datalines; 1956 521.05 462.35 1958 583.65 436.89 1960 685.47 568.05 1962 726.01 535.76 1964 891.71 768.08 1966 995.15 744.32 1968 985.21 825.13 1970 842.00 631.16 1972 1036.27 889.15 1974 891.66 577.60 1976 1014.79 858.71 1978 907.74 742.12 1980 1000.17 759.13 1982 1070.55 776.92 1984 1286.64 1086.57 1986 1955.57 1502.29 1988 2183.50 1879.14 1990 2999.75 2365.10 1992 3413.21 3136.58 1994 3978.36 3593.35 ;
1957 1959 1961 1963 1965 1967 1969 1971 1973 1975 1977 1979 1981 1983 1985 1987 1989 1991 1993 1995
520.77 679.36 734.91 767.21 969.26 943.08 968.85 950.82 1051.70 881.81 999.75 897.61 1024.05 1287.20 1553.10 2722.42 2791.41 3168.83 3794.33 5216.47
419.79 574.46 610.25 646.79 840.59 786.41 769.93 797.97 788.31 632.04 800.85 796.67 824.01 1027.04 1184.96 1738.74 2144.64 2470.30 3241.95 3832.08
Dene symbol characteristics. The INTERPOL= option species a line to connect data points. The line creates the ll boundary.
symbol1 interpol=join;
Generate a plot with lled areas. The plot requests are ordered to draw the lowest plot rst. Area 1 occupies the space between the lowest (rst) plot line and the horizontal axis, and area 2 is below the highest (second) plot line. This arrangement prevents the pattern for area 1 from overlaying the pattern for area 2. AREAS=2 lls all the areas below the second plot line.
proc gplot data=stocks; plot low*year high*year / overlay haxis=axis1 hminor=4 vaxis=axis2 vminor=1
1373
PLOT classication variable PLOT statement options: HAXIS= HMINOR= LEGEND= VAXIS= VMINOR=
Other features:
GOPTIONS statement option: BORDER AXIS statement SYMBOL statement RUN-group processing
Sample library member: GPLVRBL2
This example shows that when your data contain a classication variable that groups the data, you can use a plot request of the form y-variable*x-variable=third-variable to generate a separate plot for every value of the classication variable, which in this case is CITY. With this type of request, all plots are drawn on the same graph and a legend
1374
Chapter 45
is automatically produced which identies the values of third-variable. The default legend uses the variable name CITY for the legend label and the variable values for the legend value descriptions. This example then modies the plot request. As shown in the following output, the plot is enhanced by using different symbol denitions and colors for each plot line, changing axes labels, and scaling the vertical axes differently.
Create the data set. CITYTEMP contains the average monthly temperatures of three cities: Raleigh, Minneapolis, and Phoenix.
data citytemp; input month faren city $ @@; datalines; 1 40.5 Raleigh 1 1 52.1 Phoenix 2 2 16.5 Minn 2 3 49.2 Raleigh 3 3 59.7 Phoenix 4 4 45.1 Minn 4 5 67.4 Raleigh 5 5 76.3 Phoenix 6 6 66.9 Minn 6 7 77.5 Raleigh 7 7 91.2 Phoenix 8 8 70.2 Minn 8 9 70.6 Raleigh 9 9 83.8 Phoenix 10
12.2 42.2 55.1 28.3 59.5 67.7 57.1 74.4 84.6 71.9 76.5 89.1 60.0 60.2
Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh
1375
10 11 11 12 ;
10 11 12 12
Dene symbol characteristics. This statement species that a straight line connect data point. Because no color is specied, the default color behavior is used and each line is a different color.
symbol1 interpol=join value=dot ;
Generate a plot of three variables that produces a legend. The plot request draws one plot on the graph for each value of CITY and produces a legend that denes CITY values.
proc gplot data= citytemp; plot faren*month=city / hminor=0; run;
Dene new symbol characteristics. SYMBOL statements are assigned to the values of CITY in alphabetical order. For example, the value Minn is assigned SYMBOL1.
symbol1 interpol=spline width=2 value=triangle c=steelblue ; symbol2 interpol=spline width=2 value=circle c=indigo ; symbol3 interpol=spline width=2 value=square c=orchid ;
1376
Chapter 45
Dene new axis characteristics. AXIS1 suppresses the axis label and species month abbreviations for the major tick mark labels. AXIS2 species a two-line axis label and scales the axis to show major tick marks at every 10 degrees from 0 to 100 degrees.
axis1 label=none value=("JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC") order = 1 to 12 by 1 offset=(2) ; axis2 label=("Degrees" justify=right "Fahrenheit") order=(0 to 100 by 10) ;
Generate the enhanced plot. Because the procedure supports RUN-group processing, you do not have to repeat the PROC GPLOT statement to generate the second plot.
plot faren*month=city / haxis=axis1 hminor=0 vaxis=axis2 vminor=1 legend=legend1; run; quit;
PLOT statement options: HAXIS= HMINOR= PLOT and PLOT2 statement options: VAXIS= VMINOR=
Other features:
1377
This example shows how a PLOT2 statement generates a right axis that displays the values of the vertical coordinates in a different scale from the scale that is used for the left axis. In this plot of the average monthly temperature for Minneapolis, temperature variables that represent degrees centigrade (displayed on the left axis) and degrees Fahrenheit (displayed on the right axis) are plotted against the variable MONTH. Although the procedure produces two sets of data points, it calibrates the axes so that the data points are identical and it displays only one plot. This example uses SYMBOL statements to dene symbol denitions. By default, the SYMBOL1 statement is assigned to the plot that is generated by the PLOT statement, and SYMBOL2 is assigned to the plot generated by the PLOT2 statement.
Set the graphics environment.
goptions reset=all border;
Create the data set and calculate centigrade temperatures. MINNTEMP contains average monthly temperatures for Minneapolis.
data minntemp; input @10 month @23 f2; /* fahrenheit temperature for Minneapolis */ c2=(f2-32)/1.8; /* calculate centigrade temperature */ /* for Minneapolis */ output; datalines; 01JAN83 1 1 40.5 12.2 52.1 01FEB83 2 1 42.2 16.5 55.1 01MAR83 3 2 49.2 28.3 59.7 01APR83 4 2 59.5 45.1 67.7 01MAY83 5 2 67.4 57.1 76.3 01JUN83 6 3 74.4 66.9 84.6 01JUL83 7 3 77.5 71.9 91.2
1378
Chapter 45
8 9 10 11 12
3 4 4 4 1
Dene symbol characteristics. INTERPOL=NEEDLE generates a horizontal reference line at zero on the left axis and draws vertical lines from the data points to the reference line. CI= species the color of the interpolation line and CV= species the color of the plot symbol.
symbol1 interpol=needle ci=blue cv=red ; value=star
Dene symbol characteristics for PLOT2. SYMBOL2 suppresses interpolation lines and plotting symbols; otherwise, they would overlay the lines or symbols displayed by SYMBOL1.
symbol2 interpol=none value=none;
Dene axis characteristics. In the AXIS2 and AXIS3 statements, the ORDER= option controls the scaling of the axes. Both axes represent exactly the same range of temperature, and the distance between the major tick marks on both axes represent an equivalent quantity of degrees (10 for centigrade and 18 for Fahrenheit).
axis1 label=none value=( "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC") order=(1 to 12 by 1) offset=(2) ; axis2 label=( "Degrees" justify=right " Centigrade") order=(-20 to 30 by 10) ; axis3 label=( "Degrees" justify=left "Fahrenheit") order=(-4 to 86 by 18) ;
Example 10: Creating Plots with Drill-down Functionality for the Web
1379
Generate a plot with a second vertical axis. The HAXIS= option species the AXIS1 denition. The VAXIS= option species AXIS2 and AXIS3 denitions in the PLOT and PLOT2 statements. Axis labels and major tick mark values use the default color. The VMINOR= option species the number of minor tick marks for each axis.
proc gplot data= minntemp; plot c2*month / haxis=axis1 hminor=0 vaxis=axis2 vminor=1; plot2 f2*month / vaxis=axis3 vminor=1; run; quit;
Example 10: Creating Plots with Drill-down Functionality for the Web
Procedure features:
GOPTIONS statement option: BORDER BY statement GOPTIONS statement Sample library member: GPLDRIL1
This example shows how to create a plot with simple drill-down functionality for the Web. If you display the plot in a Web browser, you can select any plot point or legend symbol to display a report on monthly temperatures for the selected city. The example explains how to use an ODS statement such as ODS HTML to generate a graph with drill-down links. It shows how to do the following actions: 3 explicitly name the HTML les and direct the different types of output to different les 3 use BY-group processing with ODS, and determine the anchor names for the different pieces of output 3 use the PATH= option to specify the destination for the HTML and GIF les created by the ODS statement 3 add an HTML HREF string to a data set to dene a link target 3 assign link targets with the HTML= and HTML_LEGEND= procedure options 3 suppress the titles in the GIF les and display them in the HTML le For more information on drill-down graphs, see Adding Links with the HTML= and HTML_LEGEND= Options on page 603.
1380
Example 10: Creating Plots with Drill-down Functionality for the Web
Chapter 45
This program modies the code from sample GPLVRBL2, which shows how to generate separate plots for the formatted values of a classication variable. In this example, the code implements drill-down capability for the plot, enabling you to select any plot point or legend symbol to drill down to a report on the yearly temperatures for the corresponding city. The following gure shows the drill-down plot as it is viewed in a browser.
The following gure shows the report that appears when you select any plot point or legend symbol that corresponds to the data for Raleigh.
Example 10: Creating Plots with Drill-down Functionality for the Web
1381
Close the ODS listing destination for output. To conserve system resources, use ODS LISTING to close the Listing destination for procedure output. Thus, the graphics output is not displayed in the GRAPH window, although it is written to the catalog.
ods listing close;
Create the data set CITYTEMP. CITYTEMP contains the average monthly temperatures for three cities.
data citytemp; input Month Fahrenheit City $ @@;
1382
Example 10: Creating Plots with Drill-down Functionality for the Web
Chapter 45
datalines; 1 40.5 1 52.1 2 16.5 3 49.2 3 59.7 4 45.1 5 67.4 5 76.3 6 66.9 7 77.5 7 91.2 8 70.2 9 70.6 9 83.8 10 50.0 11 50.0 11 59.8 12 18.6 ;
Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn
1 2 2 3 4 4 5 6 6 7 8 8 9 10 10 11 12 12
12.2 42.2 55.1 28.3 59.5 67.7 57.1 74.4 84.6 71.9 76.5 89.1 60.0 60.2 72.2 32.4 41.2 52.5
Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix Minn Raleigh Phoenix
Add the HTML variable to CITYTEMP and create the NEWTEMP data set. The HTML variable CITYDRILL contains the target locations to associate with the different values of the variable CITY. Each location for CITYDRILL references the le city_reports.html, which this program will create. Each location ends with the default anchor name (IDX1, IDX2, and IDX3) that ODS assigns to the target output when it creates that output in le city_reports.html.
data newtemp; set citytemp; length citydrill $ 40; if city="Minn" then citydrill="HREF=citciy_reports.html#IDX1"; else if city="Phoenix" then citydrill="HREF=city_reports.html#IDX2"; else if city="Raleigh" then citydrill="HREF=city_reports.html#IDX3";
Dene a title and footnote and a symbol denition for the plots.
title1 "Average Monthly Temperature"; footnote1 j=l " Click a data point or legend symbol" j=r "GPLDRIL1 "; symbol1 interpol=join value=dot;
Generate the plot. Both HTML= and HTML_LEGEND= specify CITYDRILL as the variable that contains the targets for the drill-down links. The HTML= option determines that each plot point will be a hot zone that links to target output, and the HTML_LEGEND= option determines that the legend symbols will be hot zones that link to target output. This GPLOT procedure generates the rst piece of output in this program; thus, the plot receives the rst default anchor name, which is IDX.
proc gplot data=newtemp; plot fahrenheit*month=city / hminor=0
Example 10: Creating Plots with Drill-down Functionality for the Web
1383
Change the HTML le.The BODY= option opens a new HTML le for storing the reports for city temperatures. The new le is assigned the name city_reports.html, which is the lename assigned above to variable CITYDRILL as part of its target-link locations. The reports that are generated later in this program are all written to this one HTML le.
ods html close; ods html path=odsout body="city_reports.html";
Print a report of monthly temperatures for each city. The BY statement determines that a separate report is generated for each city. Thus, the REPORT procedure generates three pieces of output. To assign anchor locations to this new output, ODS increments the last anchor name that was used (IDX), and therefore assigns the anchor names IDX1, IDX2, and IDX3 to the output. These are the anchor locations that were specied above as the anchor locations for variable CITYDRILL.
title1 "Monthly Temperatures in #byval(city)"; proc report data=newtemp nowindows; by city; column city month fahrenheit; define city / noprint group; define month / display group; define Fahrenheit / display group; run;
1384
1385
CHAPTER
46
The GPROJECT Procedure
Overview 1385 Concepts 1387 About the Input Map Data Set 1387 Input Map Data Sets that Contain Only Unprojected Values 1388 Input Map Data Sets that Contain Both Projected and Unprojected Values About Coordinate Values 1388 About Types of Map Projections 1389 Albers Equal-Area Projection 1390 Lamberts Conformal Projection 1391 Gnomonic Projection 1392 Procedure Syntax 1392 PROC GPROJECT Statement 1393 ID Statement 1397 Using the GPROJECT Procedure 1397 Selecting Projections 1397 Controlling Projection Criteria 1398 Clipping Map Data Sets 1398 Examples 1399 Example 1: Using Default Projection Specications 1399 Example 2: Emphasizing Map Areas 1402 Example 3: Clipping an Area from the Map 1404 Example 4: Projecting an Annotate Data Set 1405 References 1408
1388
Overview
The GPROJECT procedure processes traditional map data sets by converting spherical coordinates (longitude and latitude) into Cartesian coordinates for use by the GMAP procedure. The process of converting coordinates from spherical to Cartesian is called projecting. Many of the map data sets that are available with SAS/GRAPH contain unprojected longitude and latitude coordinates. When these coordinates are plotted by the GMAP procedure, which is designed to plot points on a two-dimensional plane, the resulting map is often reversed and distorted as a result of forcing the spherical map coordinates onto a at plane. The GPROJECT procedure enables you to use one of several map projection techniques to project the latitude and longitude coordinates onto a two-dimensional plane while attempting to minimize the distortion of area, distance, direction, and shape properties of the original sphere. The output map data set that is produced by the GPROJECT procedure contains Cartesian coordinates that can be displayed correctly using the GMAP procedure.
1386
Overview
Chapter 46
The GPROJECT procedure can also create a rectangular subset of the input map data set by excluding all points with longitude and latitude values that fall outside of a specied range. This provides a simple way to reduce the size of the map data set if you need only a portion of a larger map. The GPROJECT procedure does not produce any graphics output. Instead, it produces an output map data set, which can be used as the input map data set for the GMAP procedure (see Chapter 43, The GMAP Procedure, on page 1229). Figure 46.1 on page 1386 and Figure 46.2 on page 1387 illustrate the effect of using GPROJECT defaults (Albers projection with standard parallels that are calculated by the procedure) to project a typical map data set with coordinates that are stored as longitude and latitude. The program for the following maps can be seen in Example 1 on page 1399.
Figure 46.1
1387
Figure 46.2
Concepts
3 a numeric variable named X that contains the longitude coordinates of the map
boundary points.
3 a numeric variable named Y that contains the latitude coordinates of the map
boundary points.
3 one or more identication variables that uniquely identify the unit areas in the
map. These variables are listed in the ID statement. The X and Y variables contain the values that are to be projected. In addition, the input map data set can also contain these variables:
3 a numeric variable named DENSITY that can be used to affect the output from
PROC GPROJECT. See Clipping Map Data Sets on page 1398 for more information. Other variables in the input map data set do not affect the GPROJECT procedure.
1388
Chapter 46
Input Map Data Sets that Contain Both Projected and Unprojected Values
Most traditional map data sets contain both sets of variables (X, Y and LONG, LAT) for projected and unprojected maps. In these cases, the X and Y variables produce a projected map so you do not need to use the GPROJECT procedure. However, you might want to use the LONG and LAT variables to reproject the map using a different projection type. To do this you must rst rename the LONG and LAT variables as X and Y. It is necessary to rename the LONG and LAT variables because the GPROJECT procedure looks for variables that are named X and Y by default. You can create a new map data set using the OUT= option, drop the current X and Y variables, and rename the LONG and LAT variables as X and Y. Your new data set then contains unprojected values in X and Y. The following statements illustrate how to do this:
proc gproject data=maps.austral (drop=x y rename=(long=x lat=y)) out=newaust; id id; run;
For additional information on the supplied SAS/GRAPH map data sets, see About Map Data Sets on page 1234 and the METAMAPS data set in your maps data set directory.
1389
Figure 46.3
By default, the GPROJECT procedure assumes that the units for the input coordinate values are radians and that values for the horizontal coordinate increase from east to west across the map. If your map coordinates are stored as degrees of arc, use the DEGREE option in the PROC GPROJECT statement. If the horizontal coordinate values in the map increase west-to-east rather than east-to-west, use the EASTLONG option in the PROC GPROJECT statement. See Options on page 1393 for details about the DEGREE and EASTLONG options. The unprojected map data sets that are provided with SAS/GRAPH can be projected if you use the default procedure characteristics: coordinate units in the data sets are radians, and horizontal values increase east-to-west.
1390
Chapter 46
Figure 46.4
Albers Projection
The Albers projection is a conic projection from the surface of the sphere to a cone secant to the sphere, cutting it at two standard parallels of latitude. The axis of the cone coincides with an extension of the polar axis of the sphere. Each section of the resulting map bears a constant ratio to the area of the sphere. In general, distortion in shape tends to increase toward the poles in latitudes outside of the two standard parallels. Figure 46.4 on page 1390 illustrates an Albers equal-area projection of the northern hemisphere.* The Albers projection is suitable for portraying areas of large and small east-to-west extent and produces satisfactory results in most cases. However, both standard parallels must lie on the same side of the equator, so this method might not be suitable for map data sets of large north-to-south extent that span the equator. For those map data sets, use the gnomonic projection method.
* The projection examples in this topic include grid lines that were added with the Annotate facility. See the Samples area at
support.sas.com for an example of adding latitude and longitude lines to a map.
1391
Figure 46.5
Lamberts Projection
The Lamberts projection is obtained from a secant cone in the same manner as Albers projection. In the Lamberts projection, meridians of longitude are straight lines that radiate from the apex of the cone, while parallels of latitude are concentric circles. The Lamberts projection is somewhat better than the Albers projection at representing the original shape of projected unit areas, while the Albers projection is somewhat better at representing relative sizes of projected unit areas. Figure 46.5 on page 1391 illustrates a Lamberts conformal projection of Europe. The Lamberts projection is ideal for navigational charts and maps of relatively small east-to-west extent. However, as in the Albers projection, both standard parallels must lie on the same side of the equator, so this method might not be suitable for map data sets that span the equator. For those map data sets, use the gnomonic projection method.
1392
Procedure Syntax
Chapter 46
Gnomonic Projection
Figure 46.6
Gnomonic Projection
The gnomonic projection is a planar projection from the surface of the sphere directly onto an imaginary plane tangent to the sphere at the map projection pole. By default, the projection pole is placed at the center of the map data set that is to be projected, but you can specify the projection pole to be anywhere on the surface of the sphere. (See the POLELAT= and POLELONG= option on page 1396.) Figure 46.6 on page 1392 illustrates a gnomonic projection of Africa. In the gnomonic projection, distortion increases as the distance from the map pole increases. Because of this distortion, the PROC GPROJECT procedure deletes all of the observations that lie more than 85 degrees from the map pole. The gnomonic projection is best suited for mapping areas of small east-to-west extent.
Procedure Syntax
Requirements:
1393
Syntax
PROC GPROJECT <option(s)>; option(s) can be one or more options from any or all of the following categories:
3 projection options:
PARADIV=n PARALLEL1=latitude PARALLEL2=latitude POLELAT=latitude POLELONG=longitude PROJECT=ALBERS | GNOMON | LAMBERT | NONE
3 coordinate options:
DEGREES DUPOK EASTLONG NODATELINE
3 clipping options:
LATMIN=min-latitude LATMAX=max-latitude LONGMIN=min-longitude LONGMAX=max-longitude
Options
DATA=input-map-data-set
identies the map data set to be processed. By default, the procedure uses the most recently created SAS data set.
See also: About the Input Map Data Set on page 1387 and SAS Data Sets on
page 54
Featured in:
1394
Chapter 46
DEGREES
species that the units for the longitude (X variable) and latitude (Y variable) coordinates are degrees. By default, coordinate units are considered to be radians. The GPROJECT procedure stops processing the data set if coordinates are out of range. Alias: DEG
DUPOK
specify that observations be retained when their projected X and Y values are identical to those in the previous observation. By default, successive identical observations are deleted. Note: This option is useful when you want to add annotation to a map that contains duplicate coordinates. 4 Alias: ASIS
EASTLONG
species that the longitude (X variable) values in the input map data set increase to the east (that is, positive longitude values are east of the prime meridian.) By default, longitude values increase to the west. Alias: EAST
LATMAX=max-latitude
specify the maximum latitude that is included in the projection. Any unit areas that cross the selected latitude are clipped and closed along the specied parallels. The LATMAX= and LATMIN= options do not have to be paired; you can specify a maximum latitude without specifying a minimum. When PROJECT=ALBERS, LAMBERT, or GNOMON, the GPROJECT procedure treats the value of max-latitude as degrees. When PROJECT=NONE, the procedure treats the value as a Cartesian coordinate. Featured in: Example 3 on page 1404
LATMIN=min-latitude
specify the minimum latitude that is included in the projection. Any unit areas that cross the selected latitude are clipped and closed along the specied parallels. The LATMAX= and LATMIN= options do not have to be paired; you can specify a minimum latitude without specifying a maximum. When PROJECT=ALBERS, LAMBERT, or GNOMON, the GPROJECT procedure treats the value of min-latitude as degrees. When PROJECT=NONE, the procedure treats the value as a Cartesian coordinate. Featured in: Example 3 on page 1404
LONGMAX=max-longitude
specify the maximum longitude to be included in the projection. Any unit areas that cross the selected longitude are clipped and closed along the specied meridians. The LATMAX= and LATMIN= options do not have to be paired; you can specify a maximum longitude without specifying a minimum. When PROJECT=ALBERS, LAMBERT, or GNOMON, the GPROJECT procedure treats the value of max-longitude as degrees. When PROJECT=NONE, the procedure treats the value as a Cartesian coordinate. Featured in: Example 3 on page 1404
LONGMIN=min-longitude
specify the minimum longitude to be included in the projection. Any unit areas that cross the selected longitude are clipped and closed along the specied meridians. The LATMAX= and LATMIN= options do not have to be paired; you can specify a minimum longitude without specifying a maximum.
1395
When PROJECT=ALBERS, LAMBERT, or GNOMON, the GPROJECT procedure treats the value of min-longitude as degrees. When PROJECT=NONE, the procedure treats the value as a Cartesian coordinate.
Featured in: NODATELINE
enables contiguous projections for maps that cross the line between 180 degrees and -180 degrees longitude. For example, if you project a map of Asia, then the eastern tip of the continent might be projected on the left side of the map by default. The NODATELINE option enables the entire continent to be projected as a contiguous area.
OUT=output-map-data-set
names the new map data set, which contains the coordinates of the new unit areas that are created by the GPROJECT procedure. By default, the GPROJECT procedure names the new data set that uses the DATAn naming convention. That is, the procedure uses the name WORK.DATAn, where n is the next unused number in sequence. Thus, the rst automatically named data set is DATA1, the second is DATA2, and so on.
Featured in: PARADIV=n
species the divisor that computes the values used for standard parallels for the Albers or Lamberts projections when explicit values are not provided. By default PARADIV=4, which causes the standard parallels to be set at 1/4 and 3/4 of the range of latitude values in the input map data set.
See also:
PARALLEL1=latitude PARALLEL2=latitude
specify values for the standard parallels that are used in the Albers or Lamberts projection. Latitude must be in degrees. Positive values indicate north of the equator, and negative values indicate south of the equator. These options are ignored for the gnomonic projection. By default, the GPROJECT procedure calculates values for the standard parallels. The defaults are chosen to minimize the distortion inherent in the projection process. The algorithm used is as follows: PARALLEL1 = minlat + R / PD PARALLEL2 = maxlat - R / PD where: R is the range of latitude values in the input map data set. PD is the PARADIV= value (see the discussion of the PARADIV= option). minlat is the minimum latitude value in the input map data set. maxlat is the maximum latitude value in the input map data set. If you do not use PARALLEL1= or PARALLEL2=, or you omit either option, the GPROJECT procedure uses the calculated value for the missing parameter. The standard parallels, whether explicitly specied or supplied by the procedure, must lie on the same side of the equator. If they do not, PROC GPROJECT prints an error message and stops (the procedure might calculate standard parallels that lie on opposite sides of the equator). When projecting a map data set that contains unit
1396
Chapter 46
areas that cross the equator, you might have to explicitly specify standard parallels that both lie on the same side of the equator. If this causes excessive distortion of the map, you might be able to use the gnomonic projection instead of the Albers or Lamberts projection because the gnomonic technique has no such limitations at the equator. Alias: PARALEL1, PARALEL2
POLELAT=latitude POLELONG=longitude
specify a projection pole to use for the gnomonic projection. The projection pole is the point at which the surface of the sphere touches the surface of the imaginary plane onto which the map is projected. The POLELAT= option species the latitude of the projection point. Units for latitude are degrees; positive values indicate north of the equator, and negative values indicate south of the equator. The POLELONG= option gives the longitude for the projection point. Units for longitude are degrees; positive values indicate west of the prime meridian, and negative values indicate east of the prime meridian (unless EASTLONG also has been used in the PROC GPROJECT statement). If you do not use the POLELAT= or POLELONG= option, or you omit either option, PROC GPROJECT uses values for the position of the center of the unit areas that are dened by the DATA= data set for the missing parameter. Note: The map that is dened by the input map data set should not contain points more than 85 degrees (1.48353 radians) from the projection pole; all points that exceed this value are deleted from the output map data set. 4 Featured in: Example 2 on page 1402
PROJECT=ALBERS | LAMBERT | GNOMON | NONE
species the projection method to apply to the map data set. Values for the PROJECT= option are as follows: ALBERS species Albers equal-area projection with two standard parallels. LAMBERT species Lamberts conformal projection with two standard parallels. GNOMON species the gnomonic projection, which is an azimuthal projection. NONE species that no projection should be performed. Use this option in conjunction with the LATMIN=, LATMAX=, LONGMIN=, and LONGMAX= options to perform clipping without projection. By default, PROJECT=ALBERS. Note: There are several additional projections available. They are: ADAMS, AITOFF, APIANUS, ARAGO, BEHRMANN, BRAUN, CYLINDRI, ECKERT1, ECKERT3, ECKERT5, EQUIRECT or MARINUS, GALL, HAMMER, KVRSKY7, MILLER1, MILLER2 , ORTHO, PARABOLI, PETERS, PUTNINS4, ROBINSON, STEREO, WINKEL2. 4 See also: About Types of Map Projections on page 1389 Featured in: Example 2 on page 1402
Selecting Projections
1397
ID Statement
Identies the variable or variables that dene the hierarchy of the current unit areas in the input map data set. At least one id-variable is required. Featured in: Example 1 on page 1399.
Requirements:
Syntax
ID id-variable(s);
Required Arguments
id-variable(s)
species one or more variables in the input map data set that identify unit areas. Id-variable can be either numeric or character. Each group of observations with a different ID variable value is evaluated as a separate unit area.
Selecting Projections
Except when projecting map data sets that cover large areas, all three types of projections (Albers, Lamberts, and gnomonic) produce relatively similar results when you use default projection criteria, so you usually do not need to be concerned about which projection method to use when you produce maps of small regions. However, the default projection criteria might be unsuitable in some circumstances. In particular, the default specications fail when the map that is being projected extends on both sides of the equator. On other occasions, you might want to select a projection method to achieve a particular effect. For the Albers and Lamberts projections, the two standard parallels must both lie on the same side of the equator. PROC GPROJECT stops and gives an error message if this condition is not met, regardless of whether you explicitly specify parallel values or let the procedure calculate default values. See the descriptions of the PARALEL1= and PARALEL2= options on page 1395 for more information on how to specify the two standard parallels.
1398
Chapter 46
1399
To produce a clipped area with a rectangular shape, use PROC GPROJECT in two steps:
1 Project the map using the appropriate projection method and projection criteria. 2 Project the map using PROJECT=NONE, and use the LATMIN=, LATMAX=,
LONGMIN=, and LONGMAX= options to clip the map. See Example 3 on page 1404, for an example of clipping an area from an unprojected map data set.
Examples
The following examples illustrate major features of the GPROJECT procedure.
ID statement
Sample library member: GPJDEFLT
This example demonstrates the effect of using PROC GPROJECT on an unprojected map data set without specifying any options. Because the PROJECT= option is not used in the PROC GPROJECT statement, the Albers equal-area projection method is used by default. PROC GPROJECT supplies defaults for the standard parallels that minimize the distortion of the projected map areas.
Figure 46.7
1400
Chapter 46
Figure 46.7 on page 1399 illustrates the output produced by the US48 map data set, which contains unprojected values in the X and Y variables. Output 46.1 shows the variables in the data set.
Output 46.1 The US48 Data Set
US48 Data Set OBS 1 2 3 . . . STATE 1 1 1 SEGMENT 1 1 1 DENSITY 3 3 3 X 1.48221 1.48226 1.48304 Y 0.56286 0.56234 0.56231
The GPROJECT procedure is used with the US48 map data set as input to create the projected map data set, US48PROJ. The values for X and Y in this new data set are projected (Cartesian). Output 46.2 shows the variables in the data set.
Output 46.2 The US48PROJ Data Set
US48PROJ Data Set OBS 1 2 3 . . . X 0.16068 0.16069 0.16004 Y -0.073470 -0.073993 -0.074097 DENSITY 3 3 3 STATE 1 1 1 SEGMENT 1 1 1
The new projected map data set, US48PROJ, is used to create the projected map, Figure 46.8 on page 1401.
1401
Figure 46.8
Create a reduced continental U.S. map data set and remove Alaska, Hawaii, and Puerto Rico.
data us48; set maps.states; if state ne 2 and state ne 15 and state ne 72; run;
1402
Chapter 46
Project the map data set using all default criteria. The ID statement identies the variable in the input map data set that denes unit areas.
proc gproject data=us48 out=us48proj; id state; run;
PROC GPROJECT options: POLELAT= POLELONG= PROJECT= Sample library member: GPJEMPHS
1403
This example uses the gnomonic projection method to create a map in which the east coast of the United States appears disproportionately large compared to the west coast.
Set the graphics environment.
goptions reset=all border;
Create a reduced continental U.S. map data set and remove Alaska, Hawaii, and Puerto Rico.
data us48; set maps.states; if state ne 2 and state ne 15 and state ne 72; if density<4; run;
Project the map onto a plane centered in the Pacic. The PROJECT= option species the projection method for the map data set. The POLELONG= and POLELAT= option specify a projection pole for the gnomonic projection. In this example, the pole is positioned in the Pacic Ocean.
proc gproject data=us48 out=skew project=gnomon polelong=160 polelat=45; id state; run;
1404
Chapter 46
GPJCLIPP
1405
This example uses the clipping capabilities of PROC GPROJECT to create a map of the states in the United States that border the Gulf of Mexico. Because the PROJECT= option is not used in the GPROJECT procedure, the Albers equal-area projection method is used by default.
Set the graphics environment.
goptions reset=all border;
Clip and project a rectangular subset of the map. The LONGMIN= and LONGMAX= options specify the minimum and maximum longitudes to be included in the map projection.The LATMIN= and LATMAX= options specify the minimum and maximum latitudes to be included in the map projection.
proc gproject data=maps.states out=gulf longmin=81 longmax=98 latmin=25 latmax=33; where density<5; id state; run;
1406
Chapter 46
OUT= ID statement
Other features:
This example illustrates how to project an Annotate data set for use with a map data set. It labels the locations of Charleston, Boston, and Bangor on the map shown in the second example. Because the X and Y variables in the USCITY data set already have been projected to match the US data set, they cannot be used with the map that is produced by the second example. To properly label the projected map, the example uses the same projection method for the city coordinates that is used for the map coordinates. This example illustrates how to use the same projection method for both data sets.
Set the graphics environment.
goptions reset=all border;
Create a reduced continental U.S. map data set and remove Alaska, Hawaii, and Puerto Rico.
data us48; set maps.states; if state ne 2 and state ne 15 and state ne 72; if density<4; run;
1407
Create the Annotate data set CITIES from the MAPS.USCITY data set. The unprojected LONG and LAT variable values are converted to radians and substituted for the projected X and Y variable values. LONG and LAT are converted by multiplying them by the arccosine of -1 and dividing that amount by 180. The value of STATE is modied for each label to insure that it is unique.
data cities; set maps.uscity(keep=lat long city state); length function style color $ 8 position $ 1 text $ 20; retain function "label" xsys ysys "2" hsys "1" when "a"; if (state=45 and city="Charleston") or (state=25 and city="Boston") or (state=23 and city="Bangor"); state+100; color="black"; size=8; text="V"; position="5"; style="marker"; x=long*arcos(-1)/180; y=lat*arcos(-1)/180; output; state+1; color="black"; size=5; text=" "||city; position="6"; style="swissb"; output; run;
Create the data set ALL by combining the data set US48 and the data set CITIES.
data all; set us48 cities; run;
Project the ALL data set. The DATA= option species the data set to be projected. The OUT= option species the name of the new projected data set that is created. The ID statement identies the variable in the input map data set that denes map areas.
proc gproject data=all out=allp project=gnomon polelong=160 polelat=45; id state; run;
Separate the projected data set into the CITIESP Annotate data set and the US48P map data set. The annotate observations have STATE values that are greater than 100.
data citiesp us48p; set allp; if state > 100 then output citiesp; else output us48p; run;
1408
References
Chapter 46
Show the annotated map. The CHORO statement displays the projected map and annotates it using the projected Annotate data set.
proc gmap data=us48p map=us48p all; id state; choro state / nolegend levels=1 annotate=citiesp; run; quit;
References
Pearson, F., II (1977), Map Projection Equations, Report Number TR-3624, Naval Surface Weapons Center, Dahlgren Laboratory, March, 1977. Richardus, P. and Adler, R.K. (1972), Map Projections, Amsterdam: North-Holland Publishing Company; New York: American Elsevier Publishing Company. Robinson, A.H. (1978), Elements of Cartography, New York: John Wiley & Sons, Inc.
1409
CHAPTER
47
The GRADAR Procedure
Overview 1409 Calculating Weighted Statistics 1410 Procedure Syntax 1411 PROC GRADAR Statement 1411 CHART Statement 1412 Examples 1425 Example 1: Generating the Data Set for the GRADAR Examples 1425 Example 2: Producing a Basic Radar Chart 1427 Example 3: Overlaying Radar Charts 1428 Example 4: Tiling Radar Charts 1429 Example 5: Using Multiple Classication Variables in Radar Charts 1430 Example 6: Modifying the Appearance of Radar Charts 1431 Example 7: Creating a Windrose Chart 1433 Example 8: Creating a Calendar Chart 1434
Overview
The GRADAR procedure creates radar charts that show the relative frequency of data measures in quality control or market research problems. Radar charts are sometimes also called star charts. On a radar chart, the chart statistics are displayed along spokes that radiate from the center of the chart. The charts are often stacked on top of one another with reference circles, thus giving them the look of a radar screen. By default, the chart verticesthe points where the statistical values intersect the spokesare based on the frequencies associated with the levels of a single numeric variable. Non-integer values of the chart variable are truncated to integers. The measures can be displayed in decreasing order, the order in which they appear in the input data, increasing order of internal values, or lexicographic order of variable names. Note: The GRADAR procedure is not supported by the Java device drivers.
1410
Chapter 47
1411
Procedure Syntax
At least one CHART statement is required. Global Statements: AXIS, FOOTNOTE, GOPTIONS, TITLE Reminder: The procedure can include the BY, FORMAT, LABEL, and WHERE statements as well as SAS/GRAPH NOTE statement. Supports: RUN-group processing Restriction: Not supported by Java
Requirements:
PROC GRADAR <DATA=input-data-set> <GOUT=< libref.>output-catalog> <ANNOTATE=Annotate-data-set>; CHART chart-variable </ option(s)>;
Syntax
PROC GRADAR <DATA=input-data-set> <GOUT=< libref.>output-catalog> <ANNOTATE=Annotate-data-set>;
Options
PROC GRADAR statement options affect all graphs produced by the procedure.
ANNOTATE=Annotate-data-set
species a data set to add annotate elements to all graphs that are produced by the GRADAR procedure. To add annotate elements to individual graphs, use ANNOTATE= in the CHART statement. Alias: ANNO= Restriction: The GRADAR procedure does not support coordinate systems 2 or 8. See Coordinate Systems on page 652. See also: Chapter 29, Using Annotate Data Sets, on page 643
DATA=input-data-set
species the SAS data set that contains the variable(s) to chart. By default, the procedure uses the most recently created SAS data set.
GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output produced by the GRADAR procedure.
1412
CHART Statement
Chapter 47
CHART Statement
Creates the radar charts in which the length of the vertices along the spines represent the values of the chart statistic for the data categories. At least one chart variable is required. Global statements: AXIS, FOOTNOTE, and TITLE as well as the SAS/GRAPH NOTE statement
Requirements:
Syntax
CHART chart-variable < / option(s)>; option(s) can be one or more options from any or all of the following categories:
3 chart options
ACROSSVAR=variable CALENDAR DOWNVAR=variable FREQ=variable MODE=SHARE | PROTECT | RESERVE MISSING NCOLS=n NLEVELS=n NROWS=n NZEROREF ORDERACROSS=FREQ | DATA | INTERNAL | FORMATTED | EXTERNAL OTHER=variable OVERLAY=overlay-variable STARTYPE=CORONA | POLYGON | RADIAL | SPOKE | WEDGE SPEED=speed-variable SUMVAR=summary-variable WINDROSE 3 axis options STARAXIS= (AXIS<1...99><, . . . ,AXIS<1...99>>) WAXIS=n 3 appearance options ANNOTATE=Annotate-data-set CAXIS=grid-color CFRAME=background-color | (variable) CFRAMESIDE=color CFRAMETOP=color CSPOKES=spoke-color CSTARCIRCLES=color | (colors-list) CSTARFILL=color | (colors-list)
CHART Statement
1413
CSTARS=color | (colors-list) CTEXT=text-color CTILES=(variable) | color FONT=font FRAME | NOFRAME HEIGHT=height IFRAME=leref | external-image-le IMAGESTYLE=TILE | FIT INBORDER INHEIGHT=value INTERTILE=value LSPOKE=linetype LSTARCIRCLES=(linetypes) LSTARS=(linetypes) MAXNVERT=n MAXVERT=n NOLEGEND SPIDERWEB SPKLABEL=CATEGORY | NONE SPOKESCALE = CATEGORY | VERTEX STARCIRCLES=(values) STARFILL= lists of (SOLID | EMPTY) one for each star STARINRADIUS=value STARLEGEND=CLOCK | CLOCK0 | NUMBER | DEGREES | NONE STARLEGENDLAB=legend-label STAROUTRADIUS=value STARSTART=value TILELEGEND=(variable) TILELEGLABEL=label WFRAME=n WINDROSECIRCLES= WSPOKES=n WSTARCIRCLES=(line-widths) WSTARS=line-widths | (line-widths)
3 ODS options
HTML=variable HTML_LEGEND=variable
1414
CHART Statement
Chapter 47
Required Arguments
chart-variable(s)
species one or more variables that dene the categories of data to be charted. The values of the chart variable determine the spokes in the corresponding radar chart. These values are the observations in the input data set for the chart variable. You must have at least three observations in the data set as it takes three points to dene a plane. Technically, you can create a GRADAR chart with only one or two observations, but a true radar chart is not displayed.
Options
Options in a CHART statement affect all graphs produced by that statement. You can specify as many options as needed and list them in any order.
ACROSSVAR=variable
generates a radar chart for each value of the specied variable and displays the charts from left-to-right across the output area. If used with the DOWN= option, the charts are drawn in left-to-right and top-to-bottom order. To limit the number of columns or rows that are displayed, specify the NCOLS= and NROWS= options. Alias: ACROSS= Restriction: This option is not valid with CALENDAR chartsuse the OVERLAY option instead. See also: DOWNVAR=, NCOLS=, NROWS=, ORDERACROSS= Featured in: Example 4 on page 1429 and Example 5 on page 1430
ANNOTATE=Annotate-data-set
species a data set to add annotate elements to charts produced by the CHART statement. Alias: ANNO= Restriction: The GRADAR procedure does not support coordinate systems 2 or 8. See Coordinate Systems on page 652. See also: Chapter 29, Using Annotate Data Sets, on page 643
CALENDAR
produces a radar chart displaying 12 equal-sized segments, one for each month of the year January through December. The color shading of each segment represents the magnitude of the frequency variable. Use the OVERLAY variable to subdivide each segment, for example, by year. Restriction: When you specify the CALENDAR option, you must also specify the OVERLAYVAR= option. See also: NLEVELS=, OVERLAYVAR= Featured in: Example 8 on page 1434
CAXIS=grid-color
species a color for the chart frame outline and the spokes or grid lines of the chart. The specied color must be a valid SAS/GRAPH color name. If you omit the CAXIS= option, the default color is retrieved from the current style or from the rst color in the color list if the NOGSTYLE system option is specied. Alias: CAXES=, CA= Style reference: Color attribute of the GraphAxisLines element See also: CFRAME= Restriction: Not supported by ActiveX
CHART Statement
1415
CFRAME=background-color | (variable)
lls the frame area with the specied color. You can specify a valid SAS/GRAPH color name, or a character variable of length eight whose value is the background color.
Alias:
CFR=
species the color for lling the frame area for the row labels displayed along the left side of a chart. The specied color must be a valid SAS/GRAPH color name or a character variable of length eight whose value is a valid SAS/GRAPH color name. If a label is associated with the classication variable, the specied color is also used to ll the frame area for this label. By default, these areas are not lled.
Restriction: The CFRAMESIDE= option is ignored unless you also specify the
DOWNVAR= option.
CFRAMETOP=color | (variable)
species the color for lling the frame area for the column labels that are displayed across the top of a chart. The specied color must be a valid SAS/GRAPH color name, or a character variable of length eight whose value is a valid SAS/GRAPH color name. If a label is associated with the classication variable, the specied color is also used to ll the frame area for this label. By default, these areas are not lled.
Restriction: The CFRAMESIDE= option is ignored unless you also specify the
ACROSSVAR= option.
CSPOKES=spoke-color | (variable)
species a color to use for the spokes in a chart. The specied color must be a valid SAS/GRAPH color name, or a character variable of length eight whose value is the color. The default color is specied by the current style or is the rst color in the color list if the NOGSTYLE option is specied.
Alias:
CSPOKE=
CSTARCIRCLES=color | (colors-list)
species a color or list of colors for the circles that are requested with the STARCIRCLES= option. All specied colors must be valid SAS/GRAPH color names, or a character variable of length eight whose value is the color. By default, the color specied with the CSTARS= option is used. If the CSTARS= option is omitted, the default color is specied by the current style or is the rst color in the color list if the NOGSTYLE option is specied.
Alias:
Featured in:
CSTARFILL=color | (color-list)
species a color or colors for lling the interior of stars when STARFILL= is set to SOLID. All specied colors must be valid SAS/GRAPH color names. If STARFILL is set to SOLID, the GRADAR procedure lls the stars with the rst set of colors it nds from the following list:
1 the color(s) specied on the CSTARFILL= option 2 the color(s) specied on the CSTARS= option 3 the color(s) specied by the current style or, if the NOGSTYLE option is
specied, the colors in the device color list. The number of colors that you specify depends on the number of stars in the chart.
3 If the OVERLAY= option is not used, all stars are lled with the same color.
Specify a single ll color. If the ACROSSVAR= option or the DOWNVAR= option are used, the specied color is applied to each star in the tiled display.
1416
CHART Statement
Chapter 47
3 If the OVERLAY= option is used, the chart contains multiple overlaid stars. In
that case, specify a list of colors in parentheses. Make sure that there are at least as many colors in the list as there are stars in the chart. If you do not specify enough colors for each star to have a different color, the GRADAR procedure assigns colors from the current style (or the device color list) to the remaining stars. (If the NOGSTYLE option is specied, the color for the star positioned at subgroup n on the chart is the value of the color corresponding to the color at position n in the device color list.) If the CSTARFILL= option is specied and the CSTARS= option is not specied for the outline, then the outline is the same as the CSTARFILL option. If the STARFILL= option is not set or is set to EMPTY, then the CSTARFILL= option sets only the outline color. You can also use the CSTARS= option to set the outline color. See also: CSTARS=
CSTARS=color | (color-list)
species a color or list of colors for the outlines of stars. All specied colors must be valid SAS/GRAPH color names. The GRADAR procedure uses the rst set of colors it nds from the following list: 1 the color(s) specied on the CSTARS= option 2 the color(s) specied on the CSTARFILL= option 3 the color(s) specied by the current style or, if the NOGSTYLE option is specied, the colors in the device color list, starting with the second color. The number of colors that you specify depends on the number of stars in the chart. 3 If the OVERLAY= option is not used, all stars are lled with the same color. Specify a single ll color. If the ACROSSVAR= option or the DOWNVAR= option are used, the specied color is applied to each star in the tiled display. 3 If the OVERLAY= option is used, the chart contains multiple overlaid stars. In that case, specify a list of colors in parentheses. Make sure that there are at least as many colors in the list as there are stars in the chart. If you do not specify enough colors for each star to have a different color, the GRADAR procedure assigns colors from the current style (or the device color list) to the remaining stars. (If the NOGSTYLE option is specied, the color for the star positioned at subgroup n on the chart is the value of the color corresponding to the color at position n in the device color list.) CSTAR= See also: CSTARFILL= Featured in: Example 6 on page 1431
Alias: CTEXT=color
species a color for all text on the chart. The specied color must be a valid SAS/ GRAPH color name. If you omit the CTEXT= option, the GRADAR procedure uses the rst color it nds in the following list. 1 the CTEXT= option in a GOPTIONS statement 2 the color specied by the current style or, if the NOGSTYLE option is specied, then the default color is black for the ActiveX devices and the second color in the color list for all other devices Style reference: Color attribute of the GraphValueText element
CTILES=(variable) | color
species either a character variable of length eight whose values are the ll colors for the tiles or a single color that is the ll color for all tiles. By default, the tiles are not lled.
CHART Statement
1417
If you specify a variable, the values of the specied variable must be identical for all observations with the same level of the classication variables. The same color can be used to ll more than one tile. Use the special value, EMPTY, to indicate that a tile is not to be lled. The CTILES= option cannot be used in conjunction with the NOFRAME option or the CFRAME= option. You can use the TILELEGEND= option in conjunction with the CTILES= option to add an explanatory legend for the CTILES= option colors at the bottom of the chart. Alias: CTILE= Restriction: Not supported by ActiveX
DESCRIPTION=description
species a description of the output. The maximum length for description is 256 characters. The description does not appear in the output. The descriptive text is shown in each of the following: 3 the chart description for Web output (depending on the device driver). See Chart Descriptions for Web Presentations on page 598 for more information. 3 the Table of Contents that is generated when you use the CONTENTS= option on an ODS HTML statement, assuming the output is generated while the contents page is open. 3 the description and the properties for the output in the Results window. 3 the description and properties for the catalog entry in the Explorer. 3 the Description eld of the PROC GREPLAY window. The description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed. Alias: DES= Default: RADAR CHART OF chart-variable
DOWNVAR=variable
generates a radar chart for each value of the specied variable, and displays the charts from top-to-bottom. If used with the ACROSS= option, the charts are drawn in left-to-right and top-to-bottom order. To limit the number of columns or rows that are displayed, use the NCOLS= option or the NROWS= option. Alias: DOWN= Restriction: This option is not valid with CALENDAR chartsuse OVERLAY instead. Featured in: Example 5 on page 1430
FONT=font
species the font for all text strings in the radar chart. If you omit the FONT= option, the font that is specied by the FTEXT= graphics option is used. If neither option is specied, the default font is specied by the current style or, if the NOGSTYLE option is specied, by the current device. Style reference: Font attribute of the GraphValueText elements
FRAME | NOFRAME
species whether a frame is drawn around the chart. FRAME draws a frame inside the border specied by INBORDER (if INBORDER is specied). NOFRAME suppresses the frame. By default, the frame color is specied by the current style or, if the NOGSTYLE option is specied, is the rst color in the color list. If you want to specify a different
1418
CHART Statement
Chapter 47
color for the frame, use the CFRAME= option for a lled frame and CAXIS= for only the frame outline color. Default: FRAME Restriction: The NOFRAME option cannot be specied with the CFRAME= option or the CTILES= option. This option is not supported by ActiveX. See also: CAXIS=, CFRAME= Featured in: Example 7 on page 1433
FREQ=numeric-variable
species a variable whose values weight the contribution of each observation in the computation of the chart statistic. Each observation is counted the number of times that are specied by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The statistics are not affected by applying a format to numeric-variable. See also: Calculating Weighted Statistics on page 1410 Featured in: Example 2 on page 1427, Example 3 on page 1428, andExample 4 on page 1429
HEIGHT=height
species the height in cells for labels and legends. The HEIGHT= option overrides the HTEXT= option in a GOPTIONS statement. This does not change the size of titles or footnotes Alias: HLABEL=
HTML=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. See also: Adding Custom Data Tips with the HTML= Option on page 600 and Adding Links with the HTML= and HTML_LEGEND= Options on page 603
HTML_LEGEND=variable
identies the variable in the input data set whose values create links in the HTML le created by the ODS HTML statement. These links are associated with a legend value and point to the data or graph you want to display when the user drills down on the value. The maximum length for the value of this variable is 1024 characters. See also: Adding Links with the HTML= and HTML_LEGEND= Options on page 603
IFRAME=leref | external-image-le
species an image le to use on the charts frame. Fileref must be a valid SAS leref up to eight characters long and must have been previously assigned with a FILENAME statement. External-image-le must specify the complete lename of the image le you want to use. The format of external-image-le varies across operating environments. For more information, see Displaying an Image in Graph Frame on page 182. Restriction: Not supported by ActiveX
IMAGESTYLE=TILE | FIT
species the way to display the image le that is specied on the IFRAME= option. TILE copies the image as many times as needed to t the frame. FIT stretches the image so that a single copy ts within the frame. Note: When used with the IFRAME option, the IMAGESTYLE option must be within the PROC statement. When used with the IBACK option , the IMAGESTYLE option goes on the GOPTIONS statement. 4
CHART Statement
1419
INBORDER
generates a inside border around the chart. This border is inside the border created by the BORDER option on the GOPTIONS statement, if it is specied.
Restriction: Not supported by ActiveX INHEIGHT=value
species the height for spoke labels. The default unit is PCT, which is percentage of graphics output area. The INHEIGHT= option overrides the HTEXT= option in a GOPTIONS statement. This option does not change the size of titles or footnotes.
Restriction: Not supported by ActiveX INTERTILE=value
species the distance (in cells) between tiles in a chart, and is used only with the ACROSSVAR= option and the DOWNVAR= option. By default, the tiles are contiguous (value=0).
Alias:
LSPOKES=linetype
species one or more line types for the circles requested with the STARCIRCLES= option. If the number of line types specied with LSTARCIRCLES= matches the number of circles requested with STARCIRCLES=, then the line types are paired with the circles in the order specied. If you request more circles than you specify lines types for, SAS/GRAPH uses the line types that you specify and defaults to 1 (solid) for the remaining circles.
Alias:
LSTARCIRCLE=
species the line types for the outlines of stars that are produced for a radar chart. By default, the outlines rotate through the list of line types. The default line type for the star positioned at subgroup n is the value of the line type corresponding to the position n in the list of line types. The number of line types that you specify depends on the number of stars in the chart.
3 If the OVERLAY= option is not used, all stars use the same line type. Specify a
single ll line type. If the ACROSSVAR= option or the DOWNVAR= option are used, the specied line type is applied to each star in the tiled display.
3 If the OVERLAY= option is used, the chart contains multiple overlaid stars. In
that case, specify a list of line types in parentheses. Be sure that there are at least as many line types in the list as there are stars in the chart. To specify line colors, use the CSTARS= option.
Alias:
species the maximum number of vertices, from 1 to 360, in the radar chart.
Alias:
MAXVERT=
1420
CHART Statement
Chapter 47
MISSING
accepts a missing value as a valid midpoint for the chart variable. By default, observations with missing values are ignored. Missing values are always valid for the overlay variables.
MODE=SHARE | PROTECT | RESERVE
species the display mode for a radar chart. SHARE PROTECT shares the drawing space between the text and the graph. shares the drawing space but maintains a solid rectangle (using the background color) behind the text. This is useful when the text is illegible because of the image specied with the IFRAME= option or the color specied with the CFRAME= option. reduces the size of the text and graph in order to accommodate both.
RESERVE
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default name is RADAR. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, RADAR1.
NCOLS=n
species the number of columns in a chart. You can use the NCOLS= option in conjunction with the NROWS= option. NCOLS=2 and NROWS=2 if two classication variables are specied. If used with the ACROSSVAR= or DOWNVAR= options, the default number of columns or rows is calculated from the number of classications for the variables that are listed on the ACROSSVAR= or DOWNVAR= options. In that case, you can use the NCOLS= option and NROWS= option to limit the number of columns and rows that are specied. NCOL= Default: 1 if one classication variable is specied
Alias: Restriction: Not supported by ActiveX See also: NROWS= Featured in: NLEVELS=n
species the number of colors used in the calendar chart to represent the magnitude of the frequency variable. The colors are shown in the legend as a color ramp ranging from white to the full intensity of one color.
Default: 6 NOLEGEND
turns off the zero reference circle when negative values are plotted. When a negative value is plotted, a dashed circle indicates the zero position. You cannot change the appearance of this zero reference circle, but you can turn it off with the NOZEROREF option. The zero reference circle does not appear if there are no negative values plotted.
CHART Statement
1421
NROWS=n
species the number of rows in a chart. You can use the NROWS= option in conjunction with the NCOLS= option. See NCOLS= for details. Alias: NROW= Default: 1 Restriction: Not supported by ActiveX See also: NCOLS= Featured in: Example 5 on page 1430
ORDERACROSS=FREQ | DATA | INTERNAL | FORMATTED | EXTERNAL
species the display order for the values of the ACROSS= option variable. Restriction: Not supported by ActiveX
OTHER=category
species a new category that merges all categories not selected because of the MAXNVERT= option. The category should be specied as a formatted value of the chart variable. Restriction: The OTHER= option is ignored unless you also specify the MAXNVERT= option.
OVERLAYVAR=overlay-variable
creates a comparative radar chart using the levels of the overlay variable. All charts are displayed in the same set of spokes. A maximum of 24 overlays can be displayed in a single radar chart. Alias: OVERLAY= Restriction: This option cannot be used with the ACROSSVAR= option or the DOWNVAR= options. Featured in: Example 3 on page 1428, Example 7 on page 1433, and Example 8 on page 1434
SPEED=speed-variable
displays lines connecting the points where tick marks would be instead of displaying the tick marks, using the same number of points for all axes as for the rst axis. The default number of web lines is three. If there is an AXIS statement in effect, then the web gets its values (such as number, thickness, and color) from the MAJOR= values for the axis drawn at the rst position. (The default rst position is 12 oclock.) Alias: SPIDER
SPKLABEL=CATEGORY | NONE
labels the chart spokes with the category of the variable that is being charted. NONE suppresses the labels. The default is CATEGORY; however, if the STARLEGEND= option is specied, the default is NONE. Default: CATEGORY
SPOKESCALE=CATEGORY | VERTEX
species whether every spoke is drawn to the same scale, or whether each spoke is drawn to a different scale. When you specify the SPOKESCALE=CATEGORY option (or you do not specify the SPOKESCALE option), the GRADAR procedure determines the minimum and maximum value of all the spokes. Then, the vertices of all the spokes have that same maximum value and minimum value. When you specify the SPOKESCALE=VERTEX option, each vertex has its own maximum value and minimum value, and each vertex is labeled at the tick marks.
1422
CHART Statement
Chapter 47
OVERLAYVAR= option.
STARAXIS= (AXIS<1...99><, . . . ,AXIS<1...99>>)
assigns one or more axis denitions to the axis spokes in the radar chart. GRADAR displays axis spokes clockwise, starting at the 12 oclock position. The axis denitions that are specied using the STARAXIS= option are assigned consecutively to the spokes, starting from the rst spoke. AXIS statements are assigned in clockwise order. For example, the STARAXIS=(AXIS3, AXIS1, AXIS2) option assigns the AXIS3 statements denition to the rst axis spoke (at the 12 oclock position), the AXIS1 statements denition to the second axis spoke, and the AXIS2 statements denition to the third axis spoke. The axis denitions are assigned consecutively, and you cannot skip a spoke. For example, to assign a denition to the seventh spoke, you must also assign denitions to the rst six spokes. However, you do not have to assign denitions to all of the spokes. Any remaining axis spokes on the GRADAR chart are displayed with the default settings. For example, if the STARAXIS= option species three denitions and the chart has more than three axis spokes, the fourth and remaining spokes are displayed with the default settings. If there are more denitions specied than there are axis spokes in the chart, the excess denitions are ignored. Alias: STARAXES=
STARCIRCLES=(values)
species reference circles that are superimposed on the stars that are produced for a radar chart. All of the circles are displayed and centered at each point plotted on the primary chart. The value determines the diameter of the circle. A value of 0.0 species a circle with the inner radius, which displays a circle at the minimum data value. A value of 1.0 species a circle with the outer radius, which is the length of the spokes in the chart. In general, a value of h species a circle with a radius equal to inradius + h2(outradius - inradius). For example, the values 0.0 and 1.0 correspond to an inner circle and an outer circle. The value 0.5 species a circle with a radius of inradius + 0.52( outradius inradius), or a circle halfway between the inner circle and the outer circle. Likewise, the value 0.25 species a circle one-fourth of the way from the inner circle to the outer circle. To specify the line types for the circles, use the LSTARCIRCLES= option. To specify colors for the circles, use the CSTARCIRCLES= option. Alias: STARCIRCLE= Featured in: Example 3 on page 1428
STARFILL= lists of (SOLID | EMPTY) one for each star
determines whether the stars in the radar chart are empty or lled with a solid color. Valid values are EMPTY (the default) and SOLID. If there are multiple stars in the chart, specify, in parentheses, a separate value for each star. If the STARFILL=(SOLID) option and the CSTARFILL= option are not specied, then each star is lled with the colors specied on the CSTARS= option. If the CSTARS= option is not specied, then the ll colors are determined by the current style or, if the NOGSTYLE option is specied, by the device color list. If STARFILL= is not set or is set to EMPTY, then CSTARFILL= is ignored.
STARINRADIUS=percent
species inner radius of stars as a percent from 0 to 100. The inner radius of a star is the distance from the center of the star to the circle that represents the lower limit of the standardized vertex variables. The lower limit can correspond to the minimum value, a multiple of standard deviations below the mean, or a lower specication limit. The value must be less than the value that is specied with the STAROUTRADIUS= option. The default value is one-third of the outer radius.
CHART Statement
1423
Restriction: Not supported by ActiveX See also: STAROUTRADIUS= STARLEGEND=CLOCK | CLOCK0 | NUMBER | DEGREES | NONE
species the style of the legend used to identify the vertices of stars that are produced for a radar chart. CLOCK CLOCK0 NUMBER DEGREES NONE
Featured in:
identies the vertex variables by their positions on the clock (starting with 12:00). identies the vertex variables by their positions on the clock (starting with 0:00 corresponding to 12:00). identies the vertex variables by numbers, with 1 corresponding to 12 oclock. Legend entries are assigned in clockwise order. identies the vertex variables by angles in degrees, with 0 degrees corresponding to 12 oclock. suppresses the legend. This is the default. Example 4 on page 1429
STARLEGENDLAB=legend-label
species the label displayed to the left of the legend for stars requested with the STARLEGEND= option. The label can be up to 16 characters and must be enclosed in quotes. The default label is Vertices:.
Featured in:
STAROUTRADIUS=value
species outer radius of stars as a percent up to 100. The value must be greater than the value of the STARINRADIUS= option. The inner radius of a star is the distance from the center of the star to the circle that represents the lower limit of the standardized vertex variables. The lower limit can correspond to the minimum value, a multiple of standard deviations below the mean, or a lower specication limit.
Restriction:
species the vertex angle for the rst variable that is specied on the CHART statement. Vertex angles for the remaining variables are uniformly spaced clockwise and assigned in the order listed. You can specify the value in the following ways:
3 Clock position: If you specify the value as a time literal (between 0:00T and
12:00T), the corresponding clock position is used for the rst vertex variable. For example, 12:00T indicates the 12 oclock position, 03:00T the 3 oclock position (90 degrees), and 09:00T the 9 oclock position (270 degrees).
species the style of the stars that are produced for a radar chart. The following keywords are available: CORONA polygon with star-vertices emanating from the inner circle
1424
CHART Statement
Chapter 47
closed polygon rays emanating from the center rays emanating from the inner circle closed polygon with rays from the center to the full spoke length.
SUMVAR=summary-variable
species a numeric variable to be used to construct weighted radar charts. The values of summary-variable can be positive, negative, zero, or missing. If SUMVAR= is not specied, the weights applied to the chart variable are assumed to be one. The chart is not affected by applying a format to numeric-variable.
See also: Calculating Weighted Statistics on page 1410 TILELEGEND=(variable)
species a variable used to add a legend for CTILES= colors. The variable can have a formatted length less than or equal to 32. If a format is associated with the variable, then the formatted value is displayed. The TILELEGEND= option must be used in conjunction with the CTILES= option for lling the tiles in a chart. If CTILES= is specied and TILELEGEND= is not specied, a color legend is not displayed. The values of the CTILES= and TILELEGEND= variables should be consistent for all observations with the same level of the classication variables. The value of the TILELEGEND= variable is used to identify the corresponding color value of the CTILES= variable in the legend.
Restriction: Not supported by ActiveX TILELEGLABEL="label"
species a label displayed to the left of the legend that is created when you specify a TILELEGEND= variable. The label can be up to 16 characters and must be enclosed in quotes. The default label is Tiles:.
Restriction: Not supported by ActiveX WFRAME=n
WAXIS=
species creation of a windrose chart. The windrose chart is named for charts of wind speed and direction. Windrose charts are a type of histogram which are useful when the extreme values of the histograms midpoint variable are related. Typical applications include histograms involving direction, clock time, or other cyclical values.
Featured in:
WINDROSECIRCLES=n
WSPOKE=
Default: 1
1425
WSTARCIRCLES=(line-widths)
species the width in pixels of the outline of circles requested by the STARCIRCLES= option. Alias: WSTARCIRCLE= Default: 1 Restriction: This option is ignored unless the STARCIRCLES= option is specied.
WSTARS=line-width | (line-widths)
species the width in pixels of the outline of stars that are produced for a radar chart. Alias: WSTAR= Default: 1 Featured in: Example 6 on page 1431
Examples
Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
Most of the GRADAR procedure examples use the FAILURE data set. You must submit this code before you can run any of the examples that use the FAILURE data set. During the manufacture of a metal-oxide semiconductor (MOS) capacitor, different cleaning processes were used by two manufacturing systems that were operating in parallel. Process A used a standard cleaning solution, while Process B used a different cleaning mixture that contained less particulate matter. For ve consecutive days the causes of failure with each process were observed, recorded, and saved in the SAS data set called FAILURE.
data failure; label Cause input Process datalines; Process A March Process A March Process A March Process A March Process A March Process A March Process A March = "Cause of Failure" ; $ 1-9 Day $ 13-19 Cause $ 23-36 Count 40-41; 1 1 1 1 1 1 1 Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect 15 2 1 2 3 8 1
1426
Chapter 47
Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process Process
A A A A A A A A A A A A A A A A A A A A A A A A A A A A B B B B B B B B B B B B B B B B B B B B B B B B B B
March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March March
2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4
Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous
16 3 1 3 1 9 2 20 1 1 0 3 7 2 12 1 1 0 0 10 1 23 1 1 0 1 8 2 8 2 1 4 2 10 3 9 0 1 2 4 9 2 4 1 1 0 0 10 1 2 2 1 0 3
4
7 1 1 3 1 0 1 8 2
1427
Process Process Process Process Process Process Process Process Process run;
B B B B B B B B B
4 4 5 5 5 5 5 5 5
Oxide Defect Silicon Defect Contamination Corrosion Doping Metallization Miscellaneous Oxide Defect Silicon Defect
FREQ= Data set: FAILURE (see Example 1 on page 1425) Sample library member: GRRBASIC
In a radar chart, the vertices are determined by the levels of a single variable, which is specied on the CHART statement. In this example, the variable CAUSE is specied as the chart variable. The spokes in the chart start at the twelve oclock position and go in a clockwise order. The output shows that Contamination and Oxide Defects are the most frequently occurring problems. The FREQ= option species variable COUNT to score vertex lengths. Thus, the values of COUNT weigh the contribution of each observation in the computation of the chart statistic.
goptions reset=all; proc gradar data=failure;
1428
Chapter 47
FREQ= OVERLAYVAR= Data set: FAILURE (see Example 1 on page 1425) Sample library member: GRROVER
The most typical way that radar charts are displayed is to overlay the charts on top of each other. To produce an overlay chart, use the OVERLAY= option on the CHART statement. On the OVERLAY= option, specify the classication variable whose values determine the charts to be overlaid. This example shows two blocks of code. For overlay charts with multiple stars, the lines for the stars are rotated through different line styles and colors so that the different stars can be easily seen. In the following example, the OVERLAY= option species variable DAY as the overlay variable.
goptions reset=all border; proc gradar data=failure; chart cause / freq=count overlayvar=day; run;
1429
quit;
ACROSSVAR= FREQ= STARLEGEND= STARLEGENDLAB= Data set: Example 1 on page 1425 Sample library member: GRRTILE
As an alternative to overlaying multiple radar charts (see Example 3 on page 1428), you can tile charts horizontally, vertically, or in both directions (see Example 5 on page 1430) using the ACROSSVAR= or DOWNVAR= options. Each cell in the output corresponds to a level of the classication variable. By default, the cells are arranged in alphabetical order of the values of the variable from top to bottom. The key cell is the left cell (corresponding to PROCESS = Process A in this example). The output in this example shows that the main difference in the frequencies for Process A and Process B is a drop in contamination using Process B. This example features the following options: 3 ACROSSVAR= species variable PROCESS as the categorical variable whose values determine the number of charts that are tiled. 3 STARLEGEND=CLOCK generates a legend that identies spoke positions. Value CLOCK determines that the positions are identied using a clock metaphor. 3 STARLEGENDLAB= species the category-legend label Failure Causes.
1430
Chapter 47
goptions reset=all border; proc gradar data=failure; chart cause / acrossvar=process freq=count starlegend=clock starlegendlab="Failure Causes"; run; quit;
ACROSSVAR= DOWNVAR= FREQ= STARTYPE= NCOLS= NROWS= STARLEGEND= Data set: FAILURE (see Example 1 on page 1425) Sample library member: GRRTWOWY
You can study the effects of two classications simultaneously with a two-way comparative radar chart. This arrangement provides the opportunity to discover both one-way marginal effects and interaction effects. To produce the chart, use both the ACROSSVAR= and DOWNVAR= options. This example features the following options:
1431
3 The ACROSSVAR= option species variable DAY as the variable whose values
determine the rows in the chart matrix.
3 STARTYPE= determines that the stars are displayed with rays emanating from
the inner circle. 3 NROWS= and NCOLS= specify the number of rows and columns in the chart. 3 STARLEGEND= CLOCK generates a legend that identies spoke positions. Value CLOCK determines that the positions are identied using a clock metaphor.
goptions reset=all border; proc gradar data=failure; chart cause / acrossvar=day downvar=process freq=count startype=spoke nrows=2 ncols=5 starlegend=clock; run; quit;
CSTARS= FREQ= LSTARS= OVERLAYVAR= STARCIRCLES= WSTARS= Data set: FAILURE (see Example 1 on page 1425) Sample library member: GRRAPEAR
1432
Chapter 47
For overlay charts with multiple stars, the lines for the stars are rotated through different line styles and colors so that the different stars can be easily seen. Rather than relying on the default rotation patterns, you can control the line colors, widths, and styles with the CSTARS=, LSTARS=, and WSTARS= options. This example features the following options: 3 CSTARS= species a different color for each of the star outlines in the chart. 3 WSTARS= species the width of the line for each star outline.
3 LSTARS= species a solid line as the line style for each star outline. 3 STARCIRCLES= determines that two reference circles are superimposed on the
star charts. The value 1.0 determines that a circle with a radius equal to the spoke length is displayed. The value 0.5 determines that a circle is displayed half way between the outer circle and the smallest circle (value 0.0) that could be drawn for the chart. The value 0.0 would display a circle at the minimum data value, which does not mean that it is actually 0. For example, for data values of 4, 8, 10, and 12, STARCIRCLES=(0.0 1.0) would draw circles at 4 and 12.
goptions reset=all border; proc gradar data=failure; chart cause / freq=count overlayvar=process cstars=(red, blue) wstars=2 2 lstars=1 1 starcircles=(0.5 1.0); run; quit;
1433
The windrose chart is named for charts of wind speed and direction. Windrose charts are a type of histogram which are useful when the extreme values of the histograms midpoint variable are related. Typical applications include histograms involving direction, clock time, or other cyclical values.
goptions reset=all border; data wind; input Direction $ Speed datalines; N 1-9 1.7 N 10-19 1.0 NE 10-19 .8 E 1-9 2.4 SE 1-9 1.2 SE 10-19 .4 S 10-19 1.6 SW 1-9 3.7 W 1-9 3.1 W 10-19 3.4 NW 10-19 1.7 run;
$ Percent @@; NE E S SW NW 1-9 10-19 1-9 10-19 1-9 1.4 1.4 2.7 3.2 2.1
1434
Chapter 47
The CALENDAR option produces a radar chart displaying 12 equal-sized segments, one for each month of the year JAN through DEC. The color shading of each segment represents the magnitude of the frequency variable. Use the OVERLAY variable to subdivide each segment, for example, by year.
goptions reset=all border; data climate; input Year Month $ Temperature @@; datalines; 2006 Jan 16 2006 Feb 19 2006 Mar 22 2006 Apr 33 2006 May 41 2006 Jun 60 2006 Jul 55 2006 Aug 41 2006 Sep 38 2006 Oct 30 2006 Nov 27 2006 Dec 20
1435
2007 Jan 18 2007 Feb 23 2007 Mar 20 2007 Apr 27 2007 May 33 2007 Jun 52 2007 Jul 55 2007 Aug 38 2007 Sep 38 2007 Oct 27 2007 Nov 26 2007 Dec 19 run; proc gradar data=climate; chart month / freq=temperature calendar overlayvar=year cstars=red; run; quit;
1436
1437
CHAPTER
48
The GREDUCE Procedure
Overview 1437 Concepts 1439 About the Input Map Data Set 1439 About Unmatched Area Boundaries 1439 Procedure Syntax 1440 PROC GREDUCE Statement 1440 ID Statement 1442 Using the GREDUCE Procedure 1442 Specifying Density Levels 1442 Subsetting a Map Data Set 1444 Examples 1444 Example 1: Reducing the Map of Canada 1445 References 1447
Overview
The GREDUCE procedure processes map data sets so that they can draw simpler maps with fewer boundary points. It creates an output map data set that contains all of the variables in the input map data set plus a new variable named DENSITY. For each observation in the input map data set, the procedure determines the signicance of that point for maintaining a semblance of the original shape and gives the observation a corresponding DENSITY value. You can then use the value of the DENSITY variable to create a subset of the original map data set. The observations in the subset can draw a map that retains the overall appearance of the original map but contains fewer points, requires considerably less storage space, and can be drawn much more quickly. GREDUCE does not produce any graphics output. Instead, it produces an output map data set that can become either
3 the input map data set for the GMAP procedure 3 the input map data set for a DATA step that removes points from the map.
Figure 48.1 on page 1438 and Figure 48.2 on page 1438 illustrate the effect of reduction on a typical map data set. Figure 48.1 on page 1438 uses observations with all DENSITY values as input to the GMAP procedure.
1438
Overview
Chapter 48
Figure 48.1
Figure 48.2 on page 1438 uses only those observations with a DENSITY value of 0 to 2 as input to the GMAP procedure.
Figure 48.2
The program for these maps is in Example 1 on page 1445. The reduced map shown in Figure 48.2 on page 1438 retains the overall shape of the original but requires only 463 observations compared to the 4302 observations that are needed to produce the map in Figure 48.1 on page 1438.
1439
Note: Many of the map data sets that are supplied by SAS Institute already have been processed by GREDUCE. If the map data set contains a DENSITY variable, you do not need to process the data set using GREDUCE. 4 See also Chapter 49, The GREMOVE Procedure, on page 1449 for more information on how to
3 combine groups of unit areas into larger unit areas to create regional maps 3 remove some of the boundaries in a map and create a subset of a map that
combines the original areas.
Concepts
3 a numeric variable named X that contains the horizontal coordinates of the map
boundary points.
3 a numeric variable named Y that contains the vertical coordinates of the map
boundary points.
3 one or more identication variables that uniquely identify the unit areas in the
map. These variables are listed in the ID statement. It also can contain
3 one or more variables that identify groups of unit areas (for BY-group processing) 3 the variable SEGMENT, which distinguishes nonconterminous segments of the
unit areas. Any other variables in the input map data set do not affect the GREDUCE procedure.
1440
Procedure Syntax
Chapter 48
For example, if the map data set APPROX has horizontal and vertical coordinate values for interior boundaries of unit areas that are exactly equal only to three decimal places, then this DATA step creates a new map data set, EXACT, that will be better suited for use with PROC GREDUCE:
data exact; set approx; if x ne . then x=round(x,.001); if y ne . then y=round(y,.001); run;
See About Map Data Sets on page 1234 for additional information on map data sets.
Procedure Syntax
Exactly one ID statement is required. Reminder: The procedure can include the BY statement.
Requirements:
Syntax
PROC GREDUCE <option(s)>; option(s) can be one or more options from any or all of the following categories: 3 data set options: DATA=input-map-data-set OUT=output-map-data-set 3 level options: E1=min-distance E2=min-distance E3=min-distance E4=min-distance E5=min-distance N1=max-points N2=max-points N3=max-points
1441
N4=max-points N5=max-points
Options
DATA=input-map-data-set
identies the map data set that you want to process. By default, the procedure uses the most recently created SAS data set.
See also: About the Input Map Data Set on page 1439 and SAS Data Sets on
page 54.
E1=min-distance E2=min-distance E3=min-distance E4=min-distance E5=min-distance
specify the minimum distance that a point must lie from a straight line segment to be included at density level 1, 2, 3, 4, or 5, respectively. That is, in a reduced curve of three points, the middle point is at least a distance that is min-distance from a straight line between the two outside points. Express min-distance values in the units for the coordinate system of the input map data set. For example, if the input map data set contains coordinates that are expressed in radians, express the min-distance values in radians. Specify the En= values in decreasing order. For example, the E2= value should be less than the E1= value and so on.
N1=max-points N2=max-points N3=max-points N4=max-points N5=max-points
specify that for density level 1, 2, 3, 4, or 5, the boundary of a unit area should contain no more than max-points points. Specify the Nn= values in increasing order. For example, the N2= value should be greater than or equal to the N1= value and so on. By default, if you omit Nn= and En = , the GREDUCE procedure calculates values for the ve Nn = parameters using this formula:
Nn = n2 2 Nmax=36
Here Nmax is the maximum number of points in any unit area in the input map data set. However, the restriction that the number of points for any level cannot be less than the number of points in level 0 still applies.
OUT=output-data-set
names the new map data set, which contains all of the observations and variables in the original map data set plus the new DENSITY variable. If the input map data set contains a variable named DENSITY, the GREDUCE procedure replaces the values of the variable in the output map data set. The original values of the DENSITY variable from the input map data set are not included in the output map data set. By default, the GREDUCE procedure names the new data set that uses the DATAn naming convention. That is, the procedure uses the name WORK.DATAn,
1442
ID Statement
Chapter 48
where n is the next unused number in sequence. Thus, the rst automatically named data set is DATA1, the second is DATA2, and so on.
ID Statement
Identies the variable or variables that dene the hierarchy of the current unit areas in the input map data set.
Requirements: Featured in:
Syntax
ID id-variable(s);
Required Arguments
id-variable(s)
species one or more variables in the input map data set that identify unit areas. Id-variable(s) can be either numeric or character. Each group of observations with a different ID variable value is evaluated as a separate unit area.
3 the maximum number of observations for each DENSITY level 3 the minimum distance that an intermediate point must lie from a line between
two end points to be included in the level. If you do not explicitly specify criteria, the procedure computes and uses default values. GREDUCE creates seven density levels, numbered 0 through 6. Specify criteria for density levels 1 through 5. You cannot dene criteria for level 0, which is reserved for map vertex points, such as common corners of unit areas. You also cannot dene criteria for level 6, which is assigned to those points that do not meet the criteria for any lower level. Specify the maximum number of observations per density level using Nn= in the PROC GREDUCE statement, and specify the minimum point distance using En= . You must have knowledge of the X and Y variable values in the particular input map data
1443
set to determine appropriate values for En=. See the En= and Nn= option on page 1441 for details. Figure 48.3 on page 1443 illustrates how to use the minimum distance parameter to determine which points belong in a particular density level. At density level n, only point C lies at a distance greater than the En= value (70) from a line between points A and B. Thus, after reduction only point C remains between points A and B at density level n, and the resulting reduced boundary is shown in Figure 48.4 on page 1443. See Douglas and Peucker (1973) for details of the algorithm used.
Figure 48.3
B(60,10)
(55,40)
(57,42) C(50,90)
A(10,10)
En=70
Figure 48.4
B(60,10)
C(50,90)
A(10,10)
En=70
GREDUCE uses the usual Euclidean distance formula to determine the distance between points. For example, the distance d between the points (x0,y0) and (x1,y1) is GREDUCE uses the usual Euclidean distance formula to determine the distance between points. For example, the distance d between the points (x0,y0) and (x1,y1) is
d=
If this distance function is not suitable for the coordinate system in your input map data set, transform the X and Y values to an appropriate coordinate system before using GREDUCE. An example of inappropriate coordinates is latitude and longitude
1444
Chapter 48
values around one of the poles. In this case, the data values should be projected before they are reduced. See Chapter 46, The GPROJECT Procedure, on page 1385 for more information on map projection. If you specify both Nn= and En= values for a density level, GREDUCE attempts to satisfy both criteria. However, the number of points for any level is never reduced below the number of points in density level 0. If you specify a combination of Nn= or En= values such that the resulting DENSITY values are not in order of increasing density, a note is printed in the SAS log, and the DENSITY values are calculated in increasing order of density.
Note: GREDUCE does not reduce the size of the output map data set compared to the input map data set. By default, the output map data set from PROC GREDUCE will be larger than the input map data set because it contains all of the variables and observations from the original data set, with the addition of the DENSITY variable if it was not present in the original data set. If the input map data set already had a DENSITY variable, the output map data set will be the same size as the input map data set. 4
Examples
The following example illustrates major features of the GREDUCE procedure. Because the example uses one of the map data sets that are supplied with SAS/GRAPH, you may need to replace SAS-data-library in the LIBNAME statement with the actual location of the SAS data library that contains the Institute-supplied map data sets on your system. Contact your SAS Software Consultant for the location of the map data sets at your site. If your site automatically assigns the libref MAPS to the SAS data
1445
library that contains the Institute-supplied map data sets, delete the LIBNAME statement in this example.
ID statement
Sample library member: GRDCANAD
In this example, the GREDUCE procedure creates the DENSITY variable for the CANADA2 map data set that is provided with SAS/GRAPH. First, the map is displayed at its original density by using the GMAP procedure. Second, the map is displayed by using density values of 0 to 2.
1446
Chapter 48
Show the unreduced map. The ID statement species the variable in the map data set that denes unit areas.
proc gmap map=maps.canada2 data=maps.canada2 all; id province; choro province / nolegend; run;
The GREDUCE procedure creates a new map data set, CAN2, containing a DENSITY variable. The ID statement species the variable in the map data set that denes unit areas.
proc greduce data=maps.canada2 out=can2; id province;
References
1447
run;
Show reduced map with density levels 0-2. The DENSITY= option species the density levels that are used.
proc gmap map=can2 data=can2 all density=2; id province; choro province / nolegend; run; quit;
References
Douglas, D.H. and Peucker, T.K. (1973), Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or Its Caricature, The Canadian Cartographer, 10, 112122.
1448
1449
CHAPTER
49
The GREMOVE Procedure
Overview 1449 Concepts 1450 About the Input Map Data Set 1451 About the Output Map Data Set 1451 About Unmatched Area Boundaries 1451 Procedure Syntax 1452 PROC GREMOVE Statement 1452 BY Statement 1454 ID Statement 1455 Examples 1455 Example 1: Removing State Boundaries from U.S. Map Example 2: Creating an Outline Map of Africa 1460
1455
Overview
The GREMOVE procedure processes a map data set that is used as input. It does not produce any graphics output. Instead, it produces an output data set that typically becomes the input map data set for the GMAP procedure (see Chapter 43, The GMAP Procedure, on page 1229). The GREMOVE procedure combines unit areas dened in a map data set into larger unit areas by removing shared borders between the original unit areas. For example, Figure 49.1 on page 1450 and Figure 49.2 on page 1450 show combined unit areas in a typical map data set by removing state boundaries to create regional census divisions.
1450
Concepts
Chapter 49
Figure 49.1
Figure 49.2
Concepts
The GREMOVE procedure processes the input map data set to remove internal boundaries and creates a new map data set. The PROC GREMOVE statement
1451
identies the input and output map data sets. The ID statement identies the variable or variables in the input map data set that dene the current unit areas. The BY statement identies the variable or variables in the input map data set that dene the new unit areas.
3 a numeric variable named X that contains the horizontal coordinates of the map
boundary points.
3 a numeric variable named Y that contains the vertical coordinates of the map
boundary points.
3 one or more variables that uniquely identify the current unit areas in the map.
These variables are listed in the ID statement. Each group of observations with a different ID variable value is evaluated as a separate unit area.
3 one or more variables that identify the new unit areas to be created in the output
map data set. These variables are listed in the BY statement. It might also contain the variable SEGMENT, which is used to distinguish non-conterminous segments of the same unit areas. Other variables might exist in the input map data set, but they do not affect the GREMOVE procedure and they will not be carried into the output map data set.
3 all boundaries that are not shared, such as islands and lakes 3 all boundaries that are shared by two different BY groups.
1452
Procedure Syntax
Chapter 49
using the DATA step function ROUND. See SAS Language Reference: Dictionary for information on the ROUND function. For example, if you have a map data set named APPROX in which the horizontal and vertical coordinate values for interior boundaries of unit areas are exactly equal only to three decimal places, this DATA step creates a new map data set, EXACT, that is better suited for use with the GREMOVE procedure:
data exact; set approx; if x ne . then x=round(x,.001); if y ne . then y=round(y,.001); run;
You can also use the FUZZ option to specify a level of tolerance so that the boundaries do not need to match precisely.
Procedure Syntax
Requirements:
PROC GREMOVE < DATA=input-map-data-set> <FUZZ=fuzz-factor> <OUT=output-map-data-set> <NODECYCLE>; BY <DESCENDING>variable-l <...< DESCENDING>variable-n> <NOTSORTED>; ID variable(s);
Syntax
PROC GREMOVE < DATA=input-map-data-set> <FUZZ=fuzz-factor> <OUT=output-map-data-set> <NODECYCLE>;
1453
Options
DATA=input-map-data-set
species the map data set that is to be processed. By default, the procedure uses the most recently created SAS data set. The GREMOVE procedure expects the observations in the input map data set to be sorted in ascending order of the BY-variable values. See also: About the Input Map Data Set on page 1451 and SAS Data Sets on page 54. Featured in: Example 2 on page 1460.
FUZZ=fuzz-factor
species a tolerance for possible error in the data. This allows for points that are very close but not quite equal to be considered as the same point. The fuzz-factor can be any non-negative number. A fuzz-factor of 0.0 would indicate that the points have to be exactly the same. The unit represented by the fuzz-factor (degrees, radians, feet, meters, kilometers, miles) is the same as that represented by the X and Y values of the points. The error is computed the same in both X and Y directions using the following formula:
Point_is_equal = (ABS(x1 - x2) <= fuzz-factor) && (ABS(y1 - y2) <= fuzz-factor)
NODECYCLE | NC
tells PROC GREMOVE to use a topological algorithm for closing the resulting polygons. By default, PROC GREMOVE simply removes internal boundaries without using any polygon information. This might cause errors in closing the resulting polygons in certain casesspecically when two resulting polygons intersect at a single point. Using a topological algorithm allows PROC GREMOVE to traverse the resulting polygons for proper closure of the polygons. When the single point intersection is encountered, the algorithm uses the topology to correctly interpret which existing segment to choose in closing the polygon. The use of NODECYCLE, thus, requires that the data be topologically correct (that is, polygons do not overlap themselves or each other and there are no anomalies in the boundaries such as a repeated series of points). Certain SAS/GRAPH procedures, such as PROC GREDUCE, which have no knowledge of topology and do not maintain topology, can produce topologically incorrect polygons. Therefore, it is recommended that you not use PROC GREDUCE if you are going to use PROC GREMOVE with NODECYCLE specied.
OUT=output-data-set
names the new map data set, which contains the coordinates of the new unit areas created by the GREMOVE procedure. By default, the GREMOVE procedure names the new data set using the DATAn naming convention. That is, the procedure uses the name WORK.DATAn, where n is the next unused number in sequence. Thus, the rst automatically named data set is DATA1, the second is DATA2, and so on. See also: About the Output Map Data Set on page 1451. Featured in: Example 2 on page 1460.
1454
BY Statement
Chapter 49
BY Statement
Lists the variable or variables that identify the new unit areas.
Requirements: Featured in:
Syntax
BY < DESCENDING>variable-l <...< DESCENDING>variable-n> <NOTSORTED>;
Required Arguments
variable(s)
identies one or more variables in the input map data set that dene the new unit areas. Variable(s) can be either numeric or character. The BY variables in the input map data set become the ID variables for the output map data set.
Options
DESCENDING
indicates that the input map data set is sorted in descending order. By default, the GREMOVE procedure expects all BY-variable values to appear in ascending order. This option affects only the variable that immediately follows the option.
NOTSORTED
indicates that observations with the same BY-variable values are to be grouped as they are encountered without regard for whether the values are in alphabetical or numerical order. NOTSORTED can appear anywhere in the BY statement. It affects all of the variables that are specied in the statement. NOTSORTED overrides DESCENDING if both appear in the same BY statement.
Ordering Observations
To sort the input map data set, use the SORT procedure in Base SAS, for example
/* arrange the observations in desired order */ proc sort data=mapdata out=mapsort; by state; run; /* remove the county boundaries */ proc gremove data=mapsort out=newmap; by state;
1455
id county; run;
Notice that the GREMOVE procedure uses the same BY statement as the SORT procedure. See the Base SAS Procedures Guide for further information on the SORT procedure. Note: If an observation is encountered for which the BY-variable value is out of the proper order, the GREMOVE procedure stops and issues an error message. 4
ID Statement
Identies the variable or variables that dene the hierarchy of the current unit areas in the input map data set.
Requirements:
Syntax
ID id-variable(s);
Required Arguments
id-variable(s)
species one or more variables in the input map data set that identify the unit areas to be combined. These variables are not included in the output map data set. Id-variable(s) can be either numeric or character.
See also: About the Input Map Data Set on page 1451.
Examples
The following examples illustrate major features of the GREMOVE procedure.
BY statement ID statement
1456
Chapter 49
Other features:
SORT procedure MERGE statement LIBNAME statement Sample library member: GRMUSMAP
This example processes the MAPS.US map data set, supplied with SAS/GRAPH, to produce a new map data set containing boundaries for the U.S. Bureau of the Census divisions. Because the MAPS.US map data set does not contain a variable to identify any unit area other than states, this example creates a map data set that contains the census divisions and that can be processed with the GREMOVE procedure. The STATE variable in the MAPS.US data set, containing numeric FIPS codes for each state, is used as the BY-variable to merge the CBSTATES and MAPS.US data sets. Output 49.1 shows some of the variables that are present in the data set before using the GREMOVE procedure:
Output 49.1 The MAPS.US Data Set
MAPS.US Data Set SEGMENT X 1 1 1 0.16175 0.12305 0.12296
STATE 1 1 1
56 56 56
1 1 1
And Figure 49.3 on page 1457 shows the map before processing:
1457
Figure 49.3
Output 49.2 shows the variables that are present in the data set after you use the GREMOVE procedure. Notice that the new map data set contains a new variable called DIVISION:
Output 49.2 The REMSTATE Data Set
REMSTATE Data Set Y SEGMENT 0.17418 0.17820 0.18045 1 1 1
DIVISION 1 1 1
8 8 8
9 9 9
Figure 49.4 on page 1458 shows the new map after PROC GREMOVE has removed interior state boundaries.
1458
Chapter 49
Figure 49.4
Create data set CBSTATES. This data set includes a variable, DIVISION, that contains the number of the U.S. Bureau of the Census division for the state. This data step converts letter codes to numeric FIPS codes that match those in the STATE variable of MAPS.US.
data cbstates; length state 8 stcode input stcode division state=stfips(stcode); drop stcode; datalines; CT 1 MA 1 ME 1 NH 1 RI 1 MN 4 MO 4 ND 4 NE 4 SD 4 AL 6 KY 6 MS 6 TN 6 AR 7 WY 8 AK 9 CA 9 HI 9 OR 9 ;
$ 2 division 4; @@;
VT DC LA WA
1 PA 2 NJ 2 NY 2 IL 3 IN 3 MI 3 OH 3 WI 3 IA 4 KS 4 5 DE 5 FL 5 GA 5 MD 5 NC 5 PR 5 SC 5 VA 5 WV 5 7 OK 7 TX 7 AZ 8 CO 8 ID 8 MT 8 NM 8 NV 8 UT 8 9
Sort data set in FIPS-code order. Create a sorted data set, CBSORT. It can be properly match-merged with the MAPS.US map data set, which is already sorted in FIPS-code order.
proc sort data=cbstates out=cbsort; by state; run;
1459
Add DIVISION variable to map data set by merging the CBSORT data set with MAPS.US. Create a new map data set, USCB, that contains all of the state boundary coordinates from the MAPS.US data set plus the added variable DIVISION.
data uscb; merge cbsort maps.us; by state; run;
Sort data set in DIVISION order. Sort USCB by the DIVISION variable to create the DIVSTATE data set.
proc sort data=uscb out=divstate; by division; run;
Remove interior boundaries within divisions. BY species the variable, DIVISION, in the input map data set that identies the new unit areas. ID species the variable, STATE, in the input map data set that identies the current unit areas.
proc gremove data=divstate out=remstate; by division; id state; run;
1460
Chapter 49
Show the regional map. ID species the variable, DIVISION, that identies the unit areas in the processed data set. CHORO species DIVISION as the response variable.
proc gmap map=remstate data=remstate all; id division; choro division / nolegend levels=1; run; quit;
GMAP procedure
Sample library member: GRMAFRIC
This example processes the MAPS.AFRICA map data set, supplied with SAS/ GRAPH, to produce a new map data set that contains no internal boundaries. This is done by adding a new variable, REGION, to the map data set and setting it equal to 1. Unit areas from the input map data set that have the same BY-variable value are combined into one unit area in the output map data set. Output 49.3 shows some of the variables that are present in the original map data set:
Output 49.3 The MAPS.AFRICA Data Set
MAPS.AFRICA Data Set SEGMENT X 1 1 1 0.57679 0.57668 0.58515
1 1 1
1461
Figure 49.5
The new AFRICA map data set is created with a new variable, REGION. Output 49.4 shows the variables that are present in the new map data set created by the GREMOVE procedure:
Output 49.4 The AFRICA Data Set
AFRICA Data Set Y 1.02167 1.02714 1.03752
SEGMENT 1 1 1
REGION 1 1 1
3 3 3
1 1 1
1462
Chapter 49
Figure 49.6 on page 1462 shows the new map after PROC GREMOVE has removed all of the interior boundaries:
Figure 49.6
Create the NEWAF data set. This new map data set contains all the variables in the SAS/ GRAPH supplied MAPS.AFRICA map data set plus the added variable REGION.
data newaf; set maps.africa; region=1; run;
Remove the unit areas from the AFRICA data set. DATA= species the input map data set and OUT= species the output map data set. The input map data set has a variable called REGION that is used as the BY-variable to identify the new unit areas. The ID statement species the current unit areas from the input map data set.
proc gremove data=newaf out=africa; by region; id id; run;
1463
Display the map with no boundaries. ID species the variable, REGION, that identies the unit areas in the processed data set.
proc gmap data=africa map=africa; id region; choro region / nolegend levels=1; run; quit;
1464
1465
CHAPTER
50
The GREPLAY Procedure
Overview 1466 Concepts 1467 Catalog Entries 1467 Displaying the List of Templates Provided By SAS/GRAPH 1468 Duplicate Entry Names 1468 Ways to Use the GREPLAY Procedure 1469 Sizing and Naming Your Graphs for Replay (Best Practice) 1469 Procedure Syntax 1469 PROC GREPLAY Statement 1471 ? Statement 1473 BYLINE Statement 1474 CC Statement 1474 CCOPY Statement 1475 CDEF Statement 1476 CDELETE Statement 1477 CMAP Statement 1477 COPY Statement 1478 DELETE Statement 1478 DEVICE Statement 1479 FS Statement 1479 GOUT Statement 1480 GROUP Statement 1480 IGOUT Statement 1481 LIST Statement 1481 MODIFY Statement 1482 MOVE Statement 1483 NOBYLINE Statement 1483 PREVIEW Statement 1484 QUIT Statement 1484 REPLAY Statement 1485 TC Statement 1485 TCOPY Statement 1486 TDEF Statement 1487 TDELETE Statement 1490 TEMPLATE Statement 1490 TREPLAY Statement 1491 Using the GREPLAY Procedure Windows 1492 GREPLAY Window Commands 1492 PROC GREPLAY Window 1493 PRESENTATION Window 1493 DIRECTORY Window 1493
1466
Overview
Chapter 50
TEMPLATE DESIGN Window 1494 COLOR MAPPING Window 1494 Commands For Using The GREPLAY Procedure Windows 1495 Running the GREPLAY Procedure Using Code-based Statements 1496 Managing Catalogs, Color Maps, and Templates 1496 Managing GRSEG Catalog Entries 1497 Replaying Catalog Entries 1497 Creating Custom Templates 1498 Replaying Graphics Output in a Template 1498 Creating Color Maps 1499 Examples 1500 Example 1: Creating a Template 1500 Example 2: Replaying GSLIDE Procedure Output in a Template 1502 Example 3: Replaying Graphs Into a Template 1504 Example 4: Creating a Color Map 1506
Overview
The GREPLAY procedure displays and manages graphics output that is stored in SAS catalogs. The GREPLAY procedure also creates templates and color maps that you can use when you replay your graphics output. The GREPLAY procedure operates in line mode, batch mode, and in the SAS windowing environments. With the GREPLAY procedure, you can perform any of the following actions:
3 Layout multiple graphs on one page; this output can be used to create dashboards. 3 Select one or more catalog entries from the same catalog for replay, and direct this 3 3 3 3 3
output to your display or other devices such as plotters and printers. Use, create, or modify templates. Use templates to describe positioning on a single display, for graphics output stored in one or more graph catalog entries. Create new graphics output by replaying one or more catalog entries into panels within a template. Use, create, or modify color maps. Use color maps to map current colors to different colors. List templates in SASHELP.TEMPLT. Manage GRSEG, TEMPLATE, and CMAP entries in SAS catalogs by doing the following: 3 Rearranging or creating logical groupings of catalog entries that contain graphics output.
Catalog Entries
1467
Figure 50.1
Concepts
Catalog Entries
The GREPLAY procedure can perform actions on three types of catalog entries: GRSEG entries store output from SAS/GRAPH procedures. The GREPLAY procedure uses two types of graphics catalogs: the input-catalog and the output-catalog. The input-catalog is the catalog that contains the graphics output that you want to replay. The output-catalog is the catalog in which graphics output that is produced by the template facility is stored. Both of these catalogs are GSEG catalogs. The same GSEG catalog can be used as the input-catalog and the output-catalog. TEMPLATE entries store templates created with the GREPLAY procedure. The catalog in which template entries are stored is referred to as the template catalog. SAS provides sample templates in SASHELP.TEMPLT. TEMPLATE entries can also be stored in GSEG catalogs. You can use templates directly from SASHELP.TEMPLT to replay your graphics output, or you can copy these templates to a different catalog and edit the copied entries. Graphics output replayed using a template creates a new GRSEG entry.
1468
Chapter 50
CMAP entries store color maps created with the GREPLAY procedure. The catalog in which color map entries are stored is referred to as the color map catalog. CMAP entries can be stored in GSEG catalogs. They can also be stored in other catalogs. You can copy, edit, or use these color maps to replay your graphics output. Graphics output replayed using a color map does not create a GRSEG entry. You can store all of the previous entry types in a single SAS catalog, or you can store them in separate catalogs and use a different catalog for each type of entry. A single SAS catalog may contain graphics output, color maps, and templates. Because the GREPLAY procedure operates on catalog entries, you must assign at least one catalog before you perform any tasks. The GREPLAY procedure has several ways to assign catalogs shown in Table 50.1 on page 1468.
Table 50.1
Catalog input
Assigning Catalogs
How to Assign IGOUT= option in the PROC GREPLAY statement IGOUT statement IGOUT eld in the PROC GREPLAY window
output
GOUT= option in the PROC GREPLAY statement GOUT statement GOUT eld in the PROC GREPLAY window
template
TC= option in the PROC GREPLAY statement TC statement TC eld in the PROC GREPLAY window
color map
CC= option in the PROC GREPLAY statement CC statement CC eld in the PROC GREPLAY window
Note: Image entries can exist in catalogs, but are not recognized by the GREPLAY procedure. 4
Procedure Syntax
1469
3 For entry names greater than or equal to eight characters, the procedure drops the
number of characters needed to add a numeric sufx. The total number of characters is limited to eight. For example, if you copy an entry TITLEONE to a catalog that already contains an entry with that name, the procedure assigns the name TITLEON1 to the copied entry. Note: The GREPLAY procedure uses the same naming conventions for entries created by the template facility. 4
3 by browsing or editing the elds in the GREPLAY procedure windows (if you are
running SAS in a windowing environment). For more information, see Using the GREPLAY Procedure Windows on page 1492. If you are in the SAS windowing environment, you can toggle between the windows and code-based statements while you run the GREPLAY procedure. For more information, see the FS Statement on page 1479 and the NOFS option.
3 Select or create a template to replay your graphs. Determine the size of each
panel contained in the template. Dene the size of each graph to correspond to the size of a panel contained in the template. Size each graph with GOPTIONS such as the XPIXELS= and YPIXELS= options or the HSIZE= and VSIZE= options. If the graphs that you are replaying are too large for the panels in the template, SAS/GRAPH attempts to resize the images.
3 Ensure that the GRSEG entry names that you want to replay match the names in
your GREPLAY procedure statements. If you run a procedure multiple times without updating your GREPLAY statements, the original output is replayed, not the most current output. See Duplicate Entry Names on page 1468 and Example 3 on page 1504.
Procedure Syntax
Requirement:
Use the NOFS option in the PROC GREPLAY statement when running in a non-windowing environment, batch mode, or in line mode in a windowing environment. At least one statement is required.
Note: Write access to a catalog is needed to modify, add, or delete catalog entries. Only GRSEG entry types can be replayed with the GREPLAY procedure. Restriction: Supports:
1470
Procedure Syntax
Chapter 50
PROC GREPLAY <BYLINE> <CC=color-map-catalog> <CMAP=color-map-entry> <FS> <GOUT=< libref.>output-catalog> <IGOUT=< libref.>input-catalog> <IMAGEMAP=output-data-set> <NOBYLINE> <NOFS> <PRESENTATION> <TC=template-catalog> <TEMPLATE=template-entry>; ? required-argument; BYLINE; CC color-map-catalog; CCOPY <color-map-catalog.>color-map-entry<.CMAP>; CDEF color-map-entry <color-denition(s)> <DES="description">; CDELETE color-map-entry(s) | _ALL_ ; CMAP color-map-entry; COPY entry-id(s) | _ALL_ ; DELETE entry-id(s) | _ALL_ ; DEVICE device-name; FS; GOUT <libref.>output-catalog; GROUP entry-id(s); IGOUT <libref.>input-catalog ; LIST required-argument; MODIFY modify-pair(s); MOVE entry-id-1 AFTER | BEFORE entry-id-2; NOBYLINE; PREVIEW template-entry(s) | _ALL_ ; QUIT | END | STOP; REPLAY entry-id(s) | _FIRST_ | _LAST_ | _ALL_ ; TC template-catalog; TCOPY <template-catalog.>template-entry<.TEMPLATE>; TDEF template-entry < panel denition(s)> <DES="description">; TDELETE template-entry(s) | _ALL_ ; TEMPLATE template-entry; TREPLAY select-pair(s);
1471
Syntax
PROC GREPLAY <BYLINE> <CC=color-map-catalog> <CMAP=color-map-entry-type> <FS> <GOUT=<libref.>output-catalog> <IGOUT=<libref.>input-catalog> <IMAGEMAP=output-data-set> <NOBYLINE> <NOFS> <PRESENTATION> <TC=template-catalog> <TEMPLATE=template-entry>;
Options
BYLINE
species that the BY statement information for the SAS catalog entries should be displayed. Default: BY statement information is displayed
CC=color-map-catalog
species the color map catalog where the color map entries are stored. Note: To replay graphics output using a color map, you must specify a color map catalog with the CC= option and a color map entry with the CMAP= option. Featured in: Example 4 on page 1506
CMAP=colormap-entry-type
species the type of catalog entry to use with the GREPLAY procedure. A color map entry option must have a catalog entry type of CMAP. Note: To replay graphics output using a color map entry, you must specify a color map catalog with the CC= option and a color map entry with the CMAP= option. Featured in: Example 4 on page 1506
FS
species that the GREPLAY procedure should use full-screen windows. Default: If your device supports windows, the GREPLAY procedure uses windows. If your device does not support windows, the procedure begins execution in line mode, and the FS option has no effect.
GOUT=<libref.>output-catalog
species the graphics output catalog. New GRSEG entries or GRSEG entries from other catalogs can be copied to an output catalog. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary WORK library, and creates the GSEG catalog if it does not exist.
1472
Chapter 50
Note:
The output catalog can be the same catalog specied in the IGOUT= option.
species the input catalog that stores the graphics output that you want to use with the GREPLAY procedure. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary WORK library.
Note:
The input catalog can be the same catalog specied in the GOUT= option. Example 2 on page 1502
Featured in:
IMAGEMAP=output-data-set
used with the REPLAY statement (see REPLAY Statement on page 1485). The IMAGEMAP= option creates a temporary SAS data set that contains information about the graph. The graph is replayed from the graphics catalog. The image map data set contains the following information about the graph:
3 the shapes of the elements 3 the coordinates of the elements 3 the values that are associated with those element; in variables that are
identied in the HTML= option
3 the values that are associated with those element; in variables that are
identied in the HTML_LEGEND= option The image map data set can be used to generate an HTML image map in an HTML output le using the IMAGEMAP macro. The IMAGEMAP macro takes two arguments: the image map data set name and the name or leref of an HTML output le, as shown in this example:
%imagemap(imgmapds, myimgmap.html);
See also: Adding Links with the HTML= and HTML_LEGEND= Options on page
603
NOBYLINE
species that the BY statement information for the SAS catalog entries should be suppressed.
Default: BY statement information is displayed NOFS
PRESENTATION
species that the GREPLAY procedure should open the PRESENTATION window, and use the catalog specied by the IGOUT= option as the input catalog. The PRESENTATION option is often used in applications to prevent the application users from deleting or reordering catalog entries. You can only replay graphics output from the PRESENTATION window.
Note:
TC=template-catalog
species the template catalog to use with the GREPLAY procedure, and identies the template catalog where the template entry is stored to replay your graphics.
Note:
To replay graphics output using a template catalog, you must also assign the template entry with the TEMPLATE= option.
? Statement
1473
Featured in:
TEMPLATE=template-entry
identies the template entry to use with the GREPLAY procedure. The template entry must have a catalog entry type of TEMPLATE. Note: To replay graphics output using a template entry, you must also assign a current template catalog with the TC= option. If the template entry is not in the template catalog, an error message is written to the SAS log. Featured in: Example 2 on page 1502
Environment windowing
windowing nonwindowing
You can toggle back and forth between windows and line mode within a session.
? Statement
Writes the current value of certain PROC GREPLAY options, or of the current device driver to the SAS log. If the value is not assigned, the GREPLAY procedure issues a message to the SAS log.
Syntax
? requiredargument(s); CC CMAP DEVICE GOUT IGOUT TC TEMPLATE
1474
BYLINE Statement
Chapter 50
Required Arguments
CC
DEV
BYLINE Statement
Displays BY statement information directly beneath the primary description of the catalog entries when you list the input catalog contents.
Note:
Syntax
BYLINE;
CC Statement
Species a color map catalog, and enables you to change the color map catalog without exiting the procedure.
CCOPY Statement
1475
Syntax
CC libref.color-map-catalog;
Required Arguments
color-map catalog
identies the SAS catalog where color map entries are stored. Style element:
CCOPY Statement
Copies a color map from one color map catalog to another color map catalog. Creates a duplicate color map within the color map catalog.
Requirements:
Syntax
CCOPY < libref.>< colormap-catalog.>color-map-entry.< .CMAP>;
Required Arguments
<libref.><color-map-catalog.>color-map-entry<.CMAP>
identies the color map entry to be copied. color map catalog is the color map catalog that contains the color map to be copied. color map entry is the name of the color map entry. CMAP is the color map entry type. See also: CC Statement on page 1474 If a color map entry with the same name exists in the color map catalog, duplicate entry names are resolved as described in Duplicate Entry Names on page 1468.
Details
To copy a color map from one catalog to another catalog, use the CC statement to identify the target catalog. The following statements copy HP.CMAP from the catalog named ONE.CCAT to the catalog named TARGET.CLRMAP:
LIBNAME target "SAS library"; LIBNAME one "SAS library"; proc greplay nofs;
1476
CDEF Statement
Chapter 50
To create a duplicate color map, omit the name of the color map catalog from your CCOPY statement. The following statement creates a duplicate of hp.cmap named hp2.cmap:
ccopy hp.cmap;
CDEF Statement
Denes or modies a color map in the color map catalog.
Requirements:
Syntax
CDEF color map entry <color-denition(s)> <DES="description">; color-denition has the following form: color-number / from-color:to-color color-denition has the following form: color-number / from-color:to-color
Required Arguments
color-map-entry
identies a color map entry. If the color map entry is not in the color map catalog, then the procedure creates a color map entry. If the color map entry exists in the color map catalog, then the GREPLAY procedure modies or adds to that color map entry.
See also: CC statement Featured in:
Options
color-number / from-color:to-color
species a color pair and how it is dened. color-number species the number of a color pair. from-color:to-color denes the colors that are being mapped.
CMAP Statement
1477
from-color is the color to be mapped. to-color is the new color that replaces from-color in the replayed graphics output.
DES="description"
species a catalog entry description for the color map entry. Maximum length for the description is 256 characters. Default: NEW COLOR MAP
CDELETE Statement
Deletes one or more color map entries from the current color map catalog.
Caution: The GREPLAY procedure does not prompt you to conrm your request to delete color maps entries.
Syntax
CDELETE color map entry(s) | _ALL_ ;
Required Arguments
color map entry(s)
identies one or more color map entries to delete from the color map catalog. You can submit one entry, or a list of entries in one delete statement.
_ALL_
deletes all of the color map entries from the color map catalog. Alias: CDEL
CMAP Statement
Assigns a color map entry to be used when replaying graphics output.
Requirements: See also: CC Featured in: Example 4 on page 1506.
Syntax
CMAP color-map-entry;
1478
COPY Statement
Chapter 50
Required Arguments
color-map-entry
identies the color map entry, contained in the current color map catalog, to use when replaying your graphics output. If the color map entry is not in the current color map catalog, the GREPLAY procedure issues an error message.
COPY Statement
Copies one or more GRSEG catalog entries from the input catalog to the output catalog.
Requirements: Assign an input catalog and an output catalog before using the COPY statement. Note: The COPY statement cannot create a duplicate catalog entry that contains graphics output in the same catalog. See also: GOUT Statement on page 1480 andIGOUT Statement on page 1481
Syntax
COPY entry-id(s) | _ALL_ ;
Required Arguments
entry-id(s)
is the number (in the order in which they were created) or name of a catalog entry or group of entries to be copied from the input catalog to the output catalog. Entries must contain graphics output. Multiple catalog entries can contain both numbers and names.
_ALL_
copies all graphics output entries in the input catalog to the output catalog.
DELETE Statement
Deletes SAS catalog entries containing graphics output from the current input catalog.
Caution: The GREPLAY procedure does not prompt you to conrm your request to delete an entry containing graphics output.
Syntax
DELETE entry-id(s) | _ALL_ ;
FS Statement
1479
Required Arguments
entry-id(s)
is the number (in the order in which they were created) or name of a catalog entry or a group of entries to be deleted from the input catalog. Entries must contain graphics output. Multiple catalog entries can contain both numbers and names.
_ALL_
deletes all graphics output entries in the input catalog. Alias: DEL
DEVICE Statement
Species the device driver.
Requirements: You must specify a device driver that your graphics device can support, and is available to your SAS session.
Syntax
DEVICE device-name;
Required Arguments
device-name
species the device driver to use when you replay graphics output. The device driver that you specify becomes the current device. It is used for subsequent replays and the output of other graphics procedures.. This device driver remains in effect until you change the device driver. Alias: DEV
FS Statement
Toggles from line mode to the GREPLAY procedure windows. Device must support windows See also: NOFS on page 1472
Requirements:
Syntax
FS;
1480
GOUT Statement
Chapter 50
GOUT Statement
Assigns the SAS output catalog used by the GREPLAY procedure.
Note: You can change the output catalog without exiting the procedure by using the GOUT statement.
Syntax
GOUT <libref.>output-catalog;
Required Arguments
<libref.>output-catalog
GROUP Statement
Creates groups of entries in the current input catalog.
Syntax
GROUP entry-id(s);
Required Arguments
entry-id(s)
is the number (in the order in which they were created) or name of a catalog entry. All entries specied in the GROUP statement are included in one group, and identied with a group header. You can submit one catalog entry or a list of catalog entries with one GROUP statement. A list of catalog entries can contain both catalog entry numbers and catalog entry names.
Details
Only one group can be created per group statement. The default name for a group header is GROUP. The default description for the group header is REPLAY GROUP.
LIST Statement
1481
Duplicate entry names are resolved as described in Duplicate Entry Names on page 1468. To change the name or description of a group, use the MODIFY statement. To manage and display groups of entries use the DELETE, COPY, and REPLAY statements.
IGOUT Statement
Assigns the SAS input catalog used by the GREPLAY procedure.
Note: You can change the input catalog without exiting the procedure by using the IGOUT statement.
Syntax
IGOUT <libref.>input-catalog;
Required Arguments
<libref.>input-catalog
identies the SAS catalog with entries that contain graphics output that you want to replay.
LIST Statement
Lists entries in the input, template, and color map catalogs, as well as the contents of templates and color maps in the SAS log.
Note: Entries are listed in creation date order. Featured in: Example 4 on page 1506
Syntax
LIST required-argument; required-argument must be one of the following: CC CMAP IGOUT TC TEMPLATE
1482
MODIFY Statement
Chapter 50
Required Arguments
CC
lists the color maps that are in the current color map catalog.
CMAP
lists the number, name, and description of the entries in the input catalog that contain graphics output. In addition, the type of graphics output (dependent or independent) is shown.
TC
MODIFY Statement
Changes the name, description, and BY statement information of entries or group headers in the input catalog.
Syntax
MODIFY modify-pair(s); modify-pair or pairs has the following form: entry-id / description(s)
Required Arguments
entry-id / description(s)
species the entry to modify. entry-id species the number (in the order in which they were created) or name of a catalog entry or a group of entries in the input catalog. Entries must contain graphics output. Multiple entry ids can contain both numbers and names. description(s) BYLINE="character-string" species a character string that can be used for additional information or for BY statement information. A character string can be up to 40 characters long, and must be enclosed in quotation marks. BY statement information appears directly beneath the primary description of the catalog entry.
NOBYLINE Statement
1483
NAME="entry-name" species the entry name. Maximum length for an entry name is eight characters. Duplicate entry names are resolved as described Duplicate Entry Names on page 1468 DES="description" species the graphs description. Maximum length for entry description is 256 characters. The description does not appear on the graph.
MOVE Statement
Rearranges entries in the input catalog by moving entries before or after other entries.
Syntax
MOVE entry-id-1 AFTER | BEFORE entry-id-2;
Required Arguments
entry-id-1
species the number (in the order in which they were created) or name of a catalog entry or a group header that is to be moved.
entry-id-2
is the number (in the order in which they were created) or name of a catalog entry or a group header.
AFTER | BEFORE
Details
To move an entire group, use the group name for entry-id-1. To move an entry into a group, move the entry after a group header, or before or after an entry in the group. This statement moves the entry CHART3 into the group named NEW_SALES:
move chart3 after new_sales;
NOBYLINE Statement
Suppresses BY statement information.
See also: BYLINE Statement on page 1474
1484
PREVIEW Statement
Chapter 50
Syntax
NOBYLINE;
PREVIEW Statement
Displays the panel outlines for one or more templates using the current device. Use the TC statement to specify the template catalog before using the PREVIEW statement.
Tip: When previewing templates, press END or ENTER, to move to the next template in the list. Note: When a template is previewed, graphics output is produced, and stored in a catalog named WORK.GTEM. The temporary catalog is deleted when you end your session.
Syntax
PREVIEW template-entry(s) | _ALL_ ;
Required Arguments
template-entry(s)
identies one or more template entries contained in the template catalog. You can preview one entry or a list of entries with one PREVIEW statement.
_ALL_
QUIT Statement
Exits the GREPLAY procedure.
Aliases:
END, STOP
Syntax
QUIT;
TC Statement
1485
REPLAY Statement
Identies one or more entries for replay from the input catalog.
Note: If any entry specied in a REPLAY statement is not found in the input catalog, the GREPLAY procedure issues a message to the SAS log. The GREPLAY procedure continues to replay valid entries. Alias:
PLAY
Syntax
REPLAY entry-id(s) | _FIRST_ | _LAST_ | _ALL_ ;
Required Arguments
entry-id(s)
is the number (in the order in which they were created) or name of a catalog entry or a group of entries in the input catalog. Entries must contain graphics output. Multiple entries can contain both numbers and names. This statement species both the entry named GRAPH, and the third entry in the catalog:
replay graph 3;
_ALL_
TC Statement
Species the template catalog for the GREPLAY procedure.
Tip: Use the TC statement to change the template catalog without exiting the procedure. Note: SAS supplies several templates in the SASHELP.TEMPLT catalog.
Syntax
TC template-catalog;
1486
TCOPY Statement
Chapter 50
Required Arguments
template-catalog
identies the SAS catalog where templates are to be stored or identies the name of a SAS catalog that contains templates.
TCOPY Statement
Copies templates from a catalog to the template catalog, or creates a duplicate of a template within the template catalog.
Requirements:
Syntax
TCOPY < template-catalog.>template-entry<.TEMPLATE>;
Required Arguments
<template-catalog.>template-entry<.TEMPLATE>
identies the template entry to be copied. template-catalog is the SAS catalog that contains the template to be copied. template-entry is the template entry name. TEMPLATE is the catalog entry type. Duplicate entry names are resolved as described in Duplicate Entry Names on page 1468.
Details
To copy a template from one catalog to another catalog, specify template-catalog as the source catalog. To copy NEWTEMP.TEMPLATE from the catalog named ONE.TEMPLT to the catalog named TARGET.TEMPLT submit the following statements:
LIBNAME target "SAS-data-library"; LIBNAME one "SAS-data-library"; proc greplay nofs; tc target.templt; tcopy one.templt.newtemp.template; quit;
To create a duplicate of a template, simply omit template-catalog from your TCOPY statement. For example, to create a duplicate of a template named NEWTEMP within the TEMPLAT catalog, submit the following:
TDEF Statement
1487
tcopy newtemp.template;
TDEF Statement
Denes or modies templates in the template catalog. Assign a template catalog before using the TDEF statement. See also: TC statement Featured in: Example 1 on page 1500
Requirements:
Syntax
TDEF template-entry <panel-denition(s)> <DES="description">; panel-denition has the following form: panel-number / <panel-option(s)> panel-option(s) can be one or more of the following: CLIP COLOR=border-color COPY=panel-number DEF DELETE LLX=x LLY=y LRX=x LRY=y PANEL NUMBER= ROTATE=degrees SCALEX=factor SCALEY=factor ULX=x ULY=y URX=x URY=y XLATEX=distance XLATEY=distance
Required Arguments
template-entry
identies an existing or new template. If the template is not in the template catalog, it is created by the GREPLAY procedure. If the template-entry is in the template catalog, it is modied by the procedure. Only one template entry is required, but if you specify only the template name without any option, modications are not made, and a template is not created.
1488
TDEF Statement
Chapter 50
Options
CLIP
species that any panel behind this panel should be clipped. Only the graphics output to be placed in the CLIP panel can appear in the space that the panel occupies. If a previous panel occupies all or part of that space, CLIP is ignored.
COLOR=border-color
species the panel border color. If you do not specify a border color, then no border is displayed around the panel when you replay graphics output in the panel. A template that contains a panel without a border color is assigned a color when previewed. The GREPLAY procedure creates output with borders.
COPY=panel-number
DELETE
DEL
DES="description"
species the template entry description. The maximum length for the template entry description is 256 characters. By default, the procedure uses *** new template *** for the description.
LLX=x
species the X coordinate of the lower-left corner of the panel. Units for x are a percentage of the graphics output area.
LLY=y
species the Y coordinate of the lower-right corner of the panel. Units for y are a percentage of the graphics output area.
LRX=x
species the X coordinate of the lower-right corner of the panel. Units for x are a percentage of the graphics output area.
LRY=y
species the Y coordinate of the lower-right corner of the panel. Units for y are a percentage of the graphics output area.
PANEL-NUMBER=
TDEF Statement
1489
ROTATE=degrees
species the rotation angle for the panel. Panel corner coordinates are automatically adjusted.
SCALEX=factor
species the scale factor for the X coordinates in the panel. Use this scale factor to increase or decrease the panel size in the X direction, or to reverse the X coordinates for the panel.
SCALEY=factor
species the scale factor for Y coordinates in the panel. Use this scale factor to increase or decrease the panel size in the Y direction, or to reverse the Y coordinates for the panel.
ULX=x
species the X coordinate upper-left corner of the panel. Units for x are a percentage of the graphics output area.
ULY=y
species the Y coordinate upper-left corner of the panel. Units for y are a percentage of the graphics output area.
URX=x
species the X coordinate upper-rignt corner of the panel. Units for x are a percentage of the graphics output area.
URY=y
species the Y coordinate upper-rignt corner of the panel. Units for y are a percentage of the graphics output area.
XLATEX=distance
species the distance to move the X coordinates of the panel. Units for distance are a percentage of the graphics output area.
XLATEY=distance
species the distance to move the Y coordinates of the panel. Units for distance are a percentage of the graphics output area.
Details
To zoom in on the graphics output, use coordinate values less than 0 and greater than 100. These values can be used with the LLX= option, LLY= option, LRX= option, LRY= option, ULX= option, ULY= option, URX= option, and the URY= option. You can see the replayed graphics output portion in the graphics output area in the range from 0 to 100 percent. The values that you specify for the SCALEX= option, and the SCALEY= option are used to change the size and panel orientation. The scale factors are used for the corresponding X and Y panel coordinates. If you submit:
scalex=.5 scaley=2
the X coordinates are scaled to half the original size, and the Y coordinates are scaled to twice the original size. If you supply a scale factor of 0, all of the coordinates are set to the same value. If you use a scale factor of 1, nothing happens. If you use a scale factor greater than 1, the values of the coordinates are increased and hence the size of the panel increases. If you use a scale factor less than 1 but greater than 0, the values of the coordinates are reversed, and the panel (and any graphics output replayed in the panel) is reversed.
1490
TDELETE Statement
Chapter 50
TDELETE Statement
Deletes templates from the template catalog.
Alias:
TDEL
Caution: The GREPLAY procedure does not prompt you to conrm your request to delete templates.
Syntax
TDELETE template-entry(s) | _ALL_ ;
Required Arguments
template-entry(s)
identies a template entry to be deleted from the template entry catalog. You can submit one entry or a list of entries in one TDELETE statement.
_ALL_
TEMPLATE Statement
Assigns a template to use when replaying graphics output.
Requirements:
Note: If you specify a template that is not in the template catalog, before you assign a template entry catalog, the GREPLAY procedure issues an error message.
Syntax
TEMPLATE template-entry;
Required Arguments
template-entry
identies an existing template to use when replaying graphics output. Use the TREPLAY statement to replay graphics output in the template.
Featured in:
TREPLAY Statement
1491
TREPLAY Statement
Replays graphics entries into template panels. TREPLAY copies one or more entries from the graphics input catalog into a template-entry in the graphics output catalog, using positioning information provided by the template.
Requirements: Before issuing the TREPLAY statement, specify a graphics input catalog with the IGOUT Statement on page 1481, assign a template entry catalog with the TC Statement on page 1485, and choose a template with the TEMPLATE Statement on page 1490. Alias:
TPLAY
Syntax
TREPLAY select-pairs< DES="description" NAME="entry-name">; select-pairs follow this form: template-panel-number1:entry-id1 <...template-panel-numberN:entry-idN>
Required Arguments
template-panel-number:entry-id
species the template panel number and the name of the template entry. template-panel-number species the number of the panel in the template into which you want to replay the entry. This number determines the position of the graph in the new entry in the graphics output catalog. entry-id species the name or number of the entry in the graphics input catalog that is to be added to the new entry in the graphics output catalog.
Options
DES="entrydescription"
adds a description to the entry in the graphics output catalog. Descriptions are truncated after 256 characters.
NAME="entry-name"
names the entry in the graphics output catalog. The name must begin with a letter, and continue with up to seven more letters, numbers, or underscores. Duplicate entry names are resolved as described in Duplicate Entry Names on page 1468.
Default: TEMPLATE
1492
Chapter 50
Details
When you replay GRSEG entries in a template, the GREPLAY procedure creates and stores graphics output in the designated output catalog. You can replay multiple entries in one TREPLAY statement as shown here:
treplay 1:plot1 2:plot2 3:chart1;
PLOT1 is placed in panel 1 of the current template. PLOT2 is placed in panel 2. CHART1 is placed in panel 3. Specify the entry name or entry number.
SAS/GRAPH then opens the PROC GREPLAY window. The GREPLAY procedure has ve windows: 3 PROC GREPLAY window 3 PRESENTATION window 3 DIRECTORY window 3 TEMPLATE DESIGN window 3 COLOR MAPPING window Figure 50.2 on page 1492 shows how these windows relate to each other. Each window can be scrolled backward or forward as needed to display additional elds and information.
Figure 50.2
EDITentry.CMAP BROWSEentry.CMAP
EDITentry.TEMPLATE BROWSEentry.TEMPLATE
COLOR MAPPING
TEMPLATE DESIGN
DIRECTORY Window
1493
and information. You can navigate, and manipulate GREPLAY windows by entering commands on the command line. For a complete description of each window and its elds, open the help for the GREPLAY windows. You can open the help by pressing the F1 key or by selecting Help I Using This Window. For information on navigating among these windows, see Commands For Using The GREPLAY Procedure Windows on page 1495.
Figure 50.3
PRESENTATION Window
This window replays graphics output without modifying or deleting entries, templates, or color maps. Once you have created and organized your catalog, you can use the PRESENTATION window in an application for replaying graphics output.
DIRECTORY Window
This window lists the catalog entry names, gives a brief description of each entry, and indicates the date each entry was created or last modied. Although all catalog entry types are displayed in the DIRECTORY window, you can manage only entries of the type CMAP and TEMPLATE from this window.
1494
Chapter 50
Figure 50.4
Directory Window
Figure 50.5
1495
Figure 50.6
1496
Chapter 50
Command Place an S beside the name of an existing template. OR Issue the following command: edit template-name.template
Place an S beside the name of an existing color map. OR Issue the following command: edit color-map-name.cmap
Once you submit the PROC GREPLAY statement, you can enter and submit statements without resubmitting the PROC GREPLAY statement. To exit the GREPLAY procedure you can submit any of the following: 3 an END, QUIT, or STOP statement 3 another PROC statement or DATA step
1497
Task assign a template to use when you replay graphics output replay an entry in a template panel
Table 50.5
Task
copy GRSEG entries from an input catalog to an output catalog* group GRSEG entries move GRSEG entries delete GRSEG entries modify GRSEG entry names or descriptions in an input catalog replay GRSEG entries from an input catalog replay GRSEG entries into template panels
IGOUT= option.
3 Specify the entry or entries you want to replay (GCHART in the example that
For example, the following statements replay the GRSEG entry named GCHART from the catalog WORK.GSEG, which is assigned with the IGOUT= option:
proc greplay igout=work.gseg nofs; replay gchart; quit;
1498
Chapter 50
To replay all the graphics output stored in the WORK.GSEG catalog submit this code:
proc greplay nofs; igout work.gseg; replay _all_ ; quit;
Note: Graphics output is created only when you use the GREPLAY procedure with a template. 4
3 control the layout of multiple graphs on one page, which is useful for dashboards 3 replay graphics output from several catalog entries, or from the same catalog, on
one display or page
3 change the shape of your graphics output 3 change the size of your graphics output
To dene and view a custom template:
1 Start the GREPLAY procedure with the NOFS option. 2 Assign a template catalog with the TC= option. 3 Dene a template with the TDEF statement. 4 Preview the template with the PREVIEW statement. 5 End the GREPLAY procedure with the QUIT statement.
Before you create a template, you must assign a template catalog. If you are use the GREPLAY procedure in line mode, use the TDEF statement to dene a template and the PREVIEW statement to preview a template. For example, the following statements dene and preview a template named TEMPLT:
proc greplay nofs tc=sasuser.cat; tdef templt 1/def; preview templt; quit;
GCHART1).
2 Start the GREPLAY procedure with the NOFS option specied.
1499
3 Dene the input catalog with the IGOUT= option (WORK.GSEG). 4 Assign the template catalog with the TC= option (SASHELP.TEMPLT contains the
template entries).
5 Assign a template to replay your graphs with the TEMPLATE statement (V2). 6 Assign the graphs you want to replay with the TREPLAY statement (GCHART
GCHART1).
7 End the GREPLAY procedure with the QUIT statement.
For example, the following statements replay the entries GRAPH1 and GRAPH2 into the V2 template, which is stored in the catalog SASHELP.TEMPLT. The TC statement species the catalog that contains the template, and the TEMPLATE statement species the template. The TREPLAY statement assigns each entry to a panel. (The V2 template has two panels, so there is an assignment for panel 1 and panel 2.)
proc gchart data=sashelp.class; hbar age/discrete; run; hbar height; run; quit; proc greplay igout=work.gseg nofs; tc sashelp.templt; template v2; treplay 1:gchart 2:gchart1; quit;
Note: If the GOUT= option is not specied when creating the charts, then the output is stored in the temporary WORK.GSEG catalog. 4 When you replay graphics output in a template, the new GRSEG output that is created by the GREPLAY procedure is automatically provided a default name, Template, and it is stored in the output catalog WORK.GSEG. The default GRSEG description is Graphics Replay.
Before you create a color map, you must assign a color map catalog. The following example denes a color map named CLRMAP:
proc greplay cc=clrmap gout=work nofs; cdef clrmap 1 / cyan : blue; quit;
1500
Examples
Chapter 50
When you assign a color map and replay graphics output the following occurs: 3 The stored GRSEG entry or entries, retain the original foreground colors. 3 The colors used to replay the graphics are not saved with the original graphics output. 3 Graphics output is not created when you replay graphics output using a color map.
Examples
The following examples illustrate major GREPLAY procedure features. Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
GREPLAY statement options: NOFS TC= option TDEF statement TEMPLATE statement Sample library member: GRECRTM1
This example creates a template with ve panels. Four panels are small and equal in size. The fth panel is a larger, full-size panel that can be used to display a common title or footnote for the entire template. In this example, the LIST statement displays the template contents in the SAS log. Output 50.1 shows the template denition written to the SAS log le. The template dened here is also used in Example 2 on page 1502.
Set the graphics environment.
goptions reset=all border;
Start the GREPLAY procedure. NOFS starts the procedure in line-mode. The TC= option assigns TEMPCAT as the template catalog.
proc greplay tc=work.tempcat nofs;
Dene a template with ve panels. The TDEF statement denes a template named NEWTEMP, and places it in the previously dened template catalog. Each denition identies the panel number, and species the four corners coordinates. The COLOR= option draws a border for each panel in the specied color.
tdef newtemp des="Five panel template" Panel 1: Lower Left Quadrant
1501
1/llx=0 lly=10 ulx=0 uly=50 urx=50 ury=50 lrx=50 lry=10 color=navy Panel 2: Upper Left Quadrant 2/llx=0 lly=50 ulx=0 uly=90 urx=50 ury=90 lrx=50 lry=50 color=lime Panel 3: Upper Right Quadrant 3/llx=50 lly=50 ulx=50 uly=90 urx=100 ury=90 lrx=100 lry=50 color=yellow Panel 4: Lower Right Quadrant 4/llx=50 lly=10 ulx=50 uly=50 urx=100 ury=50 lrx=100 lry=10 color=cyan Panel 5: Container for Title and Panels 1--4 5/llx=0 lly=0 ulx=0 uly=100 urx=100 ury=100 lrx=100 lry=0 color=lipk;
Assign the template. The TEMPLATE statement assigns the created template NEWTEMP as the template.
template newtemp;
1502
Chapter 50
Output 50.1
. . . 64 65
Dening a Template
/* list template contents */ list template; Five panel template Ll-x Ll-y Ul-x Ul-y Ur-x Ur-y Lr-x Lr-y
NEWTEMP Pan Clp Color 1 2 3 4 5 66 . . . NAVY LIME YELLOW CYAN LIPK quit;
0.0 10.0 0.0 50.0 50.0 50.0 10.0 0.0 50.0 0.0 90.0 50.0 90.0 50.0 50.0 50.0 50.0 50.0 90.0 100.0 90.0 100.0 50.0 50.0 10.0 50.0 50.0 100.0 50.0 100.0 10.0 0.0 0.0 0.0 100.0 100.0 100.0 100.0 0.0
GREPLAY statement options: GOUT= option IGOUT= option TEMPLATE= option TREPLAY statement
Other features:
PROC GSLIDE
Sample library member: GRERGOT1
The TREPLAY statement replays into the template GRFTMPLT, the four catalog entries that contain graphics output. It contains four equally sized panels, and one large, full-size panel. Note that assignments are made to all but one panel. Because the fourth panel is not listed in the TREPLAY statement, it does not appear in the graphics output. The HSIZE= option, and the VSIZE= option are adjusted, to reect the overall output dimension. Alternatively, you could use XPIXELS= and YPIXELS= to adjust the graphics output size.
1503
Figure 50.7
Set the graphics environment.The HSIZE= option, and the VSIZE= option are set for the overall output dimensions.
goptions reset=all border hsize=5.14in vsize=4.13in;
Generate three graphs in the WORK.GRAFCAT catalog. The GSLIDE procedure creates three text slides, and stores them in GRAFCAT as specied by the GOUT= option. These are stored as GSLIDE, GSLIDE1, and GSLIDE2.
proc gslide gout=grafcat; title c=navy "Graph Number Three"; run; title c=lime "Graph Number One"; run; title c=orange "Graph Number Two"; run;
Generate a text slide with PROC GSLIDE and output to GRAFCAT. Dene a title and a footnote for the container output.
proc gslide gout=grafcat; title c=purple "Common Title"; footnote c=blue "Common Footnote"; run;
1504
Chapter 50
Start the GREPLAY procedure. The IGOUT= option, assigns GRAFCAT as the input catalog. The GOUT= option assigns EXCAT as the output catalog. The TC=TEMPCAT option assigns the template catalog for the GREPLAY procedure. The TEMPLATE=NEWTEMP option assigns NEWTEMP as the current template.
proc greplay igout=grafcat gout=excat tc=tempcat nofs; template=newtemp;
Replay three graphs into template. The TREPLAY statement assigns three entries to panels in the NEWTEMP template. Each assignment is a panel number, and the name of a graphics output entry. Names are the default names assigned by the GSLIDE procedure.
treplay 1:gslide 2:gslide1 3:gslide2 5:gslide3; quit;
GREPLAY statement options: GOUT= IGOUT= NOFS TC= TEMPLATE= DEVICE statement TREPLAY statement Sample library member: GREGRSEG
1505
Display 50.1
Prepare the data for the graphs. Drop variables NAME and SEX, and add a variable called GENDER. Change variable values, and sort the data for the line graph.
data sasuser.class (drop=name ); length Gender $ 6; set sashelp.class; if sex="F" then Gender="Female"; else Gender="Male"; run; proc sort data=sasuser.class out=sasuser.class; by weight height; run;
Dene the size of each individual graph. Each graph is replayed into a separate panel in the template.
goptions reset=all hsize=2.75in vsize=2.06in;
1506
Chapter 50
Generate the graphs, and store them in the SASUSER.EXCAT catalog. Generate a vertical bar chart, a horizontal bar chart, a pie chart, and a subgrouped plot.
proc gchart data=sasuser.class gout=sasuser.excat; vbar age/discrete hminor=0 subgroup=gender inside=freq raxis=axis1 maxis=axis2 noframe legend=legend1; run; hbar age/ discrete sumvar=height mean meanlabel="Avg.Height" vminor=0 raxis=axis1 maxis=axis2; run; pie gender/ noheading legend=legend1 percent=inside; run; proc gplot data=sasuser.class gout=sasuser.excat; plot height*weight=gender/ vminor=1 vaxis=axis3 haxis=axis4 legend=legend2; run; quit;
Dene the size of each the template. Each graph is replayed into a separate panel in the template. The template size accommodates the four smaller graphs.
goptions reset=all hsize=5.5in vsize=4.12in;
Replay the graphs with a template to create one graph. The graphs stored in SASUSER.EXCAT are replayed to create one graph. The graph is also stored in the SASUSER.EXCAT catalog.
proc greplay gout=sasuser.excat igout=sasuser.excat nofs tc=sashelp.templt template=l2r2; device win; treplay 1:gchart 2:gchart1 3:gchart2 4:gplot; quit;
GREPLAY statement options: CC= option GOUT= option CDEF statement CMAP statement LIST statement
Sample library member: GRECRCM1
This example uses the CDEF statement to dene a color map. The LIST statement is used in this example to display the color map denition in the SAS log. Output 50.2 shows a partial SAS log listing.
1507
Start the GREPLAY procedure. The CC= option assigns CLRMAP as the color map catalog. The GOUT= option assigns EXCAT as the graphics output catalog. Both options must be assigned for the color map to be created.
proc greplay cc=clrmap gout=excat nofs;
Dene a color map. The CDEF statement denes a color map named MYCOLOR that contains three color pairs.
cdef mycolor des="Special Color Map" 1 / pink : red 2 / cyan : blue 3 / lig : green;
Specify a current color map, and write contents to the SAS log. The CMAP statement assigns MYCOLOR as the current color map. The contents of CMAP are listed in the SAS log.
cmap mycolor; list cmap; quit;
Output 50.2
. . 75 76
1508
1509
CHAPTER
51
The GSLIDE Procedure
Overview 1509 About Text Slides 1509 About Annotate Output 1510 Procedure Syntax 1510 PROC GSLIDE Statement 1511 Examples 1514 Example 1: Producing Text Slides 1514 Example 2: Displaying Annotate Graphics
1516
Overview
The GSLIDE procedure is useful for creating text slides for presentations. You can overlay text slides on other graphics output with the GREPLAY procedure. The GSLIDE procedure produces graphics output that consists of text and straight lines that are generated by TITLE, FOOTNOTE, and NOTE statements. In addition, the procedure provides an easy way to add titles, notes, and footnotes to output that is produced entirely with an Annotate data set.
Figure 51.1
1510
Chapter 51
Figure 51.2 Output from an Annotate Data Set Displayed with the GSLIDE Procedure (GSLANNOT)
Procedure Syntax
Requirements: At least one of these is required: a TITLE, FOOTNOTE, or NOTE statement; an appearance option; the BORDER graphics option.
FOOTNOTE, TITLE Reminder: The procedure can include the SAS/GRAPH NOTE statement.
Global statements:
1511
Syntax
PROC GSLIDE <option(s)>; option(s) can be one or more options from any or all of the following categories:
3 appearance options:
ANNOTATE=Annotate-data-set BORDER CFRAME=frame-color FRAME IFRAME= leref | external-le IMAGESTYLE = TILE | FIT LFRAME=line-type WFRAME=n
3 description options:
DESCRIPTION=entry-description GOUT=<libref.>output-catalog NAME=entry-name
3 HTML option:
<IMAGEMAP=output-data-set>
Options
You can specify as many options as you want and list them in any order.
ANNOTATE=Annotate-data-set
species a data set that includes Annotate variables that identify graphics commands and parameters.
See also: Chapter 29, Using Annotate Data Sets, on page 643 Alias:
draws a border around the graphics output area, which includes the title area, the footnote area, and the procedure output area. A color specication for the border is searched for in the following order:
1 the CTITLE= option in a GOPTIONS statement. 2 the CTEXT= option in a GOPTIONS statement. 3 the color of the current style. If the NOGSTYLE option is specied, then the
1512
Chapter 51
CFRAME=frame-color
draws a frame around the procedure output area in the specied color. If you use both the CFRAME= and FRAME options, the FRAME option is ignored. If you use the IFRAME= option, the specied image lls the background of the slide. Note: The CFRAME= option does not color the background of the slide.
See also: Adding Frames, Borders, and Images on page 1513. Featured in:
DESCRIPTION=entry-description
species the description of the catalog entry for the slide . The maximum length for entry-description is 256 characters. By default, the GSLIDE procedure assigns the description GRAPHICS TEXT SLIDE. The descriptive text is shown in each of the following:
3 the description portion of the Results window 3 the catalog-entry properties that you can view from the Explorer window 3 the Description eld of the PROC GREPLAY window
Alias: FRAME
DES=entry-description
draws a frame around the procedure output area. By default, the frame color is the color of the current style; if the NOGSTYLE option is specied, then the color is the rst color in the devices color list. If you want to specify a different color for the frame, use the CFRAME= option instead. The FRAME option is overridden by the IFRAME= option, which lls the backplane frame with an image.
See also: Adding Frames, Borders, and Images on page 1513 GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output produced by the GSLIDE 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: Specifying the Catalog Name and Entry Name for Your GRSEGs on
page 100
IFRAME=leref | external-le
identies the image le you want to apply to the backplane of the plot. See also the IMAGESTYLE= option. The IFRAME= option is overridden by the NOIMAGEPRINT goption.
IMAGEMAP=output-data-set
creates a temporary SAS data set that is used to generate an image map in an HTML output le. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identied to the GSLIDE procedure with the HTML= or HTML_LEGEND= options or both. The %IMAGEMAP macro generates the image map in the HTML output le. The macro takes two arguments, the name of the image map data set and the name or leref of the HTML output le, as shown in the following example:
%imagemap(imgmapds, myimgmap.html);
See also: Adding Links with the HTML= and HTML_LEGEND= Options on page
1513
IMAGESTYLE=TILE | FIT
species whether to tile the image specied with the IFRAME= option to ll the backplane or to stretch the image to t the backplane. The TILE value is the default. See also the IFRAME= option.
LFRAME=line-type
species the line type for a frame and draws a frame around the procedure output area. Values for line-type are 1 through 46. Line types are shown in Figure 14.22 on page 276. By default, the line type is specied by the current style. LFRAME=1, which produces a solid line, is the default.
NAME=entry-name
species the name of the GRSEG catalog entry and the name of the graphics output le, if one is created. The name can be up to 256 characters long, but the GRSEG name is truncated to eight characters. Uppercase characters are converted to lowercase, and periods are converted to underscores. The default GRSEG name is GSLIDE. If the name duplicates an existing name, then SAS/GRAPH adds a number to the name to create a unique namefor example, GSLIDE1.
WFRAME=n
species the width of the frame where n is a number. The thickness of the frame increases directly with n, but the thickness of the line can vary from device to device. By default, the line width is specied by the current style. WFRAME=1, which is the thinnest line, is the default. The WFRAME= option also draws the frame. See also: Adding Frames, Borders, and Images on page 1513 Featured in: Example 1 on page 1514
1514
Examples
Chapter 51
graphics output area. The range is 0 to 100. Some of the output might not be displayed. In this case, use the GANNO procedure, which can scale the output to t the available space. See also Chapter 33, The GANNO Procedure, on page 913 for details
Examples
Note: When using procedures that support RUN-group processing, include a QUIT statement after the last RUN statement. Using the QUIT statement is especially important when the procedure is supposed to completely terminate within the boundaries of an ODS destination (for example, ODS HTML; procedure-code; ODS HTML CLOSE;). See RUN-Group Processing on page 56 for more information. 4
PROC GSLIDE options: BORDER CFRAME= WFRAME= Other features: NOTE Statement Sample library member: GSLTEXTS
1515
This example uses FOOTNOTE, NOTE, and TITLE statements to produce a text slide. PROC GSLIDE statement options add both a border and a frame.
Set the graphics environment.
goptions reset=all cback=blue border;
Generate the slide and dene additional text. The BORDER option draws a box around the entire graphics output area. The CFRAME= option draws a red box around the procedure output area. The WFRAME= option species the thickness of the frame. The COLOR= option species the color of the note text. The rst NOTE statement, which has no text, simply leaves a large blank line above the text specied by the second NOTE statement. The second JUSTIFY= option causes a line break.
proc gslide border cframe=red wframe=4; note height=5; note height=3 justify=center color="white" "Goals and strategies" justify=center "for the coming year"; run; quit;
1516
Chapter 51
In this example, the GSLIDE procedure displays Annotate graphics along with current TITLE and FOOTNOTE denitions. See Chapter 29, Using Annotate Data Sets, on page 643 for information on creating Annotate data sets.
Set the graphics environment.
goptions reset=all border;
Create the Annotate data set, ART. ART contains the commands that draw the design of triangles.
data art; length function color style $ 8; input function $ x y color $ style $; xsys="5"; ysys="5"; datalines; poly 30 20 blue solid polycont 50 20 . . polycont 40 50 . . poly 50 20 green x1 polycont 70 50 . . polycont 60 50 . .
1517
40 60 50
50 50 80
red . .
l1 . .
Dene the title and footnotes displayed by the procedure. FOOTNOTE statements 4 and 5 have no text and are angled vertically to add space on the left and right sides between the border of the output and the frame that surrounds the procedure output area.
title "Number 17"; footnote1 h=2 "Art is anything you can get away with."; footnote2 j=r "D. H. Benson "; footnote4 angle=90; footnote5 angle=-90;
Display the annotate graphics on the slide with the title and footnotes. The GSLIDE procedure displays the graphics elements drawn by the commands in the Annotate data set specied by the ANNOTATE= option.
proc gslide annotate=art border wframe=6 cframe=red; run; quit;
1518
1519
CHAPTER
52
The GTILE Procedure
Overview 1519 Concepts 1519 Chart Variables 1519 Missing Values, Negative Values, and Zero Values 1520 Assigning Colors 1520 Procedure Syntax 1521 PROC GTILE Statement 1521 FLOW, TILE, and TOGGLE Statements 1522 Examples 1528 Example 1: Simple GTILE with the COLORVAR= Option 1528 Example 2: Specifying the COLORRAMP= Option, and Setting the DETAILLEVEL= Option
1530
Overview
The GTILE procedure creates charts that consist of a rectangle or a square divided into tile-shaped segments. These charts represent the relative sizes of tiles to one another and to the whole. The GTILE procedure provides three statements you can use to dene the layout in order to visualize your data. The statements require one numeric variable. This variable denes the top level of the chart. The TILEBY= statement is followed by any number of numeric or character variables that are delineated by a comma or a blank space. By providing multiple TILEBY variables, and specifying either a JAVA or ACTIVEX device with the DEVICE= option, you can use the GTILE procedure to create interactive charts.These charts enable you to display subsets (or levels) of your data. You can assign an additional numeric variable as a color variable using the COLORVAR= option.
Concepts
Chart Variables
The GTILE procedure produces charts based on the values of the charts size variable, and the values of a TILEBY level variable. The charts sizevariable must be numeric. All the values are treated as discrete. The sum of the charts size variable variable determines the size of each tile. The charts size variable is also used to color each tile, unless a color variable is specied with the COLORVAL= option.
1520
Chapter 52
At least one TILEBY= variable is required. The values of this variable or variable list determine the tile categories, as well as the chart levels (or subsets). The levels are visually represented in the chart by line colors and line style. The top level is indicated by a thick line and the darkest color. The next level is represented by a thinner line and the darkest color. The third level and any subsequent levels are represented by the thickest line and the darkest color. Each level is also represented in the navigation status bar in the top-left corner of the chart. Note: For Java, an indicator to the left of the legend identies the name of the charts size variable. 4
3 The charts size variable requires non-missing, positive values to create a tile for
that observation. If the value of the size variable is missing, a negative value, or a zero value, the observation is not included in the chart.
3 The TILEBY= variable displays tiles with missing values, negative values, and
zero values. Each tile is included in the chart, with its value displayed on the tile and in the charts data tip.
Assigning Colors
The COLORRAMP= option enables you to customize the charts colors. You can specify colors for the tiles using any of the color-naming schemes supported by SAS/GRAPH.
Table 52.1 Examples of Specifying Colors
Color-Naming Scheme RGB CMYK HLS HSV Gray Scale SAS Registry Colors CNS Color Names
Example COLORS=(cx98FB98 cxDDA0DD cxFFDAB9 cxDB7093 cxB0E0E6) COLORS=("FF00FF00" "00FFFF00" "FFFFFF00") COLORS=(H14055FF H0F060FF H0B485FF H07880FF) COLORS=(V0F055FF v010FFFF v03BFFFF v12C55E8) COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3) COLORS=(palegreen plum peachpuff palevioletred powderblue) COLORS=("very light purplish blue" "light vivid green" "medium strong yellow" "dark grayish green")
1521
For information about color naming schemes, see Chapter 12, SAS/GRAPH Colors and Images, on page 165.
Procedure Syntax
Requirements:
3 an ODS statement to close the listing destination 3 an ODS statement to open the output destination 3 at least one FLOW, TILE or TOGGLE statement 3 at least one TILEBY= variable 3 an ODS statement to close the output destination 3 an ODS statement to open the listing destination
Global Graph Statements: FOOTNOTE, GOPTIONS , TITLE Global Procedure Statements: FORMAT, LABEL, WHERE, ODS Supports:
PROC GTILE< DATA=input-data-set>; FLOW | TILE | TOGGLE size-variable TILEBY=(variable) | (variable-list) < / option(s)>;
Syntax
PROC GTILE< DATA=input-data-set>;
Options
PROC GTILE statement options affect all graphs produced by the procedure.
DATA=input-data-set
species the SAS data set that contains the variables to chart. By default, the procedure uses the most recently created SAS data set.
See:
1522
Chapter 52
required.
Global Graph Statements: FOOTNOTE, GOPTIONS, TITLE Supports:
Drill-down functionality
Description
The FLOW, TILE, and TOGGLE statements specify the type of layout, the variables that dene the chart levels, and the tile sizes used to display the data. One of the following display layouts is required: FLOW creates a chart that honors data order and can be read from left to right. TILE creates a chart that orders data by value, descending from left-bottom to top-right. TOGGLE creates a chart that honors data order and can be read from left to right. When changing levels, the display toggles from one row to one column.
Syntax
FLOW | TILE | TOGGLE size-variable TILEBY=(levels-variable) | (levels-list) variable list delimiter can be either a blank space or a comma < /option(s)>; option(s) can be one or more of the options from any or all of the following categories: 3 appearance options: 3 CMISSING=missing-value-color 3 COLORRAMP=color-ramp-color-list 3 COLORVAR=data-set-variable 3 DETAILLEVEL=number-of-levels-to-show-in-detail 3 LABELLEVEL=number-of-levels-to-label
Required Arguments
SIZE VARIABLE
species a numeric variable from the input data set. The values of this variable are used to determine the size of each tile. If the COLORVAR= option is not specied, then the sizevariable is used to assign a color to each tile.
1523
TILEBY=(levels-variable)|( levels-variable-list)
species the variable, or a list of variables, that dene the tile-segments and the chart levels. The variables can be character or numeric. Variable must be enclosed in parenthesis and you can use either commas or blank spaces as delimiters.
Options
The options in a GTILE statement affect all chart levels. Specify as many options as you want and list them in any order.
BASELINE=midpoint
species the color to be assigned to tiles when the COLORVAR= value is missing. The color used to identify missing values is represented by a missing color indicator to the right of the legend.
Figure 52.1
CMISSING=yellow
Alias:
CMISS=
species the colors to be distributed continuously across the range of data values. The three-color gradient legend provides a key to the value of the colors plotted on the chart. The legend label is the variable used to color the tiles. The legend displays the variables minimum value, the maximum value, and the midpoint value. Two colors are required to create a color ramp; however, the number of colors that can be provided is not limited. These values specify the minimum, and the maximum values of the color ramp. If only two colors are specied, the legend midpoint is not be labeled. The delimiter can be either blank spaces or commas. All of the color-naming schemes supported by SAS/GRAPH are valid.
1524
Chapter 52
Figure 52.2
COLORRAMP=(cxbcd3aa cxae9aeb)
Figure 52.3
Alias:
RAMP=
species a numeric variable whose values determine the color of the tiles. The smallest value of this variable is assigned to the rst color in the color ramp. The largest value of this variable is assigned the last color in the color ramp. Each value is assigned a color from the gradient list of colors between the rst, and the last colors in the color ramp.
1525
Figure 52.4
COLORVAR=cylinders
DESCRIPTION="description"
species the description of the chart. The maximum length for description is 256 characters. The descriptive text is displayed as follows: 3 the description in the Results window 3 the description in the Table of Contents that is generated when you use the CONTENTS= ODS option 3 the chart description in the HTML le when the output destination is ODS HTML and DEVICE=ACTXIMG or DEVICE=JAVAIMG DES= Default: Tile chart of tileby Restriction: Partially supported by Activex and Java.
Alias: DETAILLEVEL=1-to-the-number-of-variables-specied-by-TILEBY=
species the number of levels to display. The valid values for the DETAILLEVEL= option are from one to the number of variables listed in the TILEBY= levels list. Each level has a unique outline. As you drill down through the levels, the second level lines are thinner in weight and lighter in color. As you drill down to the third and lower levels, the outlines are the same as the top level. The levels are listed above the chart on the left. The DETAILLEVEL= option does not affect the drill-down functionality.
1526
Chapter 52
Figure 52.5
If the DETAILLEVEL=1, only the rst level of detail is initially displayed. Only the details of the current level are displayed at any given point in the navigation.
Figure 52.6
DETAILLEVEL=1
Alias:
DLEVEL=
Default: 3 LABELLEVEL=1-to-the-number-of-levels-variables-specied-by-TILEBY=
species the number that corresponds to the level of labels to display. The valid values for the LABELLEVEL= option are from one to the number of variables listed in the TILEBY=levels list. The levels are listed above the chart, on the left. The LABELLEVEL= option does not affect the drill-down functionality. If the LABELLEVEL= option is omitted, level 1 labels are initially displayed.
1527
Figure 52.7
if LABELLEVEL=3, the third level labels are displayed. Once you navigate past the LABELLEVEL specied, subsequent levels display their respective labels.
Figure 52.8
LABELLEVEL=3
Alias:
LLEVEL=
Default: 1 NAME=entry
species the name of any graphics output le created. The name can be up to 256 characters long. If the name duplicates an existing lename, SAS/GRAPH adds a number, or increments the last number used to create a unique graph namefor example, graph1.png.
Default: graph.png
1528
Examples
Chapter 52
Examples
PROC GTILE statement TILE statement TILEBY=( levels-list) COLORVAR= option Data Set: SASHELP.SHOES Sample Library Member: GTLSIMPL
PROC GTILE generates a chart for the SASHELP.SHOES data set. The size of each tile represents the number of stores. The COLORVAR=SALES option species that the color of each tile represents the sales revenue for that tile. The visualization of the data with the GTILE procedure makes it easy to see the data extremes for sales revenue relative to the number of stores.
Display 52.1 GTILE Chart of SASHELP.SHOES (gtlsimpl)
The following chart shows the result of drilling down on the region labeled Canada. The region was selected to further explore the data. This region displayed the largest area of red, indicating a greater amount of shoe sales.
1529
Display 52.2
The chart variable STORES species the size of the tiles. The TILE layout arranges the tiles. The TILEBY=(levels-list) variable list denes the tile segments and the chart levels. The COLORVAR=SALES option species the variable to use to color the tiles.
proc gtile data=sashelp.shoes; tile stores tileby=(region subsidiary) / colorvar=sales ; run; quit;
1530
Example 2: Specifying the COLORRAMP= Option, and Setting the DETAILLEVEL= Option
Chapter 52
Example 2: Specifying the COLORRAMP= Option, and Setting the DETAILLEVEL= Option
Procedure features:
SASHELP.ORSALES Subset
PROC GTILE generates this chart displaying a subset of the SASHELP.ORSALES data set. The FLOW statement denes the layout of the data. The size of each tile indicates the number of items sold. The color of each tile indicates the prot. The visualization of the data with the GTILE procedure makes it easy to see the data extremes for prot relative to the number of items sold.
Display 52.3 Tile Chart of a Subset of SASHELP.ORSALES (gtlcolor)
Clicking on the "Skates" product_group subsets the "Skates" observations by year. The updated display provides information on the "Skates" prots by year.
Example 2: Specifying the COLORRAMP= Option, and Setting the DETAILLEVEL= Option
1531
Display 52.4
Subset the data, format the quantity variable, and the prot variable.
data sports_only; set sashelp.orsales; if product_line="Sports"; format profit dollar12.; format quantity comma12.; run;
1532
Example 2: Specifying the COLORRAMP= Option, and Setting the DETAILLEVEL= Option
Chapter 52
The chart variable QUANTITY species the size of the tiles. The FLOW layout arranges the tiles. The TILEBY=(levels-list) variable list denes the tile segments and the chart levels. The COLORVAR=PROFIT option species the variable to use to color the tiles. The DETAILLEVEL=1 option denes the level of display detail. The COLORRAMP= option reverses the colors. Blue represents the highest value. Red represents the lowest value.
proc gtile data=sports_only; flow quantity tileby=(product_group year) / colorvar=profit /* display less details */ detaillevel=1 /* reverse the colors so that blue is highest */ colorramp=(CXDD6060 CXFFFFFF CX6497EB); run; quit;
1533
CHAPTER
53
The G3D Procedure
Overview 1533 Surface Plots 1533 Scatter Plots 1534 Concepts 1535 G3D Procedure Terms 1535 The Input Data Set 1536 Data for Surface Plots 1536 Data for Scatter Plots 1536 Changing Data Ranges 1537 Rotating and Tilting the Plot 1537 Controlling the Axes 1537 Procedure Syntax 1538 PROC G3D Statement 1538 PLOT Statement 1539 SCATTER Statement 1546 Examples 1552 Example 1: Generating A Surface Plot 1552 Example 2: Generating a Rotated Surface Plot 1553 Example 3: Generating a Tilted Surface Plot 1554 Example 4: Generating a Scatter Plot 1555 Example 5: Generating a Scatter Plot with Modied Shapes 1557 Example 6: Generating a Scatter Plot with Modied Shapes and a Grid 1558 Example 7: Generating a Rotated Scatter Plot with Modied Axes 1559 References 1561
Overview
The G3D procedure enables you to produce three-dimensional plots. The surface plot in the following section displays various depths of a lake. The dimensions of the lake are plotted on the X-Y axes. The Z variable is plotted as the third dimension. The coordinates of each point correspond to the values of the three numeric variable values in an observation from the selected input data set.
Surface Plots
Surface plots represent the shape of the surface that is described by the values of three variables, X, Y, and Z. The values of the X and Y variables are plotted to form a horizontal plane. The values of the Z variable, create a vertical axis that is
1534
Scatter Plots
Chapter 53
perpendicular to the X-Y plane. Combined, these three axes, form a three-dimensional surface.
Figure 53.1
With the PLOT statement, you can do the following actions: 3 show the three-dimensional shape of your data (useful for examining data trends).
3 change the data ranges that are displayed. 3 rotate and tilt the plot to enhance viewing angles. 3 customize the axes.
Featured in Example 1 on page 1552. For more information on producing surface plots, see the PLOT Statement on page 1539.
Scatter Plots
Scatter plots represent the data as points. As with surface plots, the values of the X and Y variables are plotted to form a horizontal plane. The values of the Z variable create a vertical axis that is perpendicular to the X-Y horizontal plane. The values of the Z variable are represented as individual symbols. By default, these symbols are connected to the horizontal plane with lines, referred to as needles.
1535
Figure 53.2
3 3 3 3 3
change the symbols used to represent your data points categorize your data with colors, shapes, sizes change the data ranges that are displayed rotate and tilt the plot to enhance the viewing angles customize the axes
For more information on producing scatter plots, see the SCATTER Statement on page 1546.
Concepts
1536
Chapter 53
Figure 53.3
vertical axis
1537
Figure 53.4
Note: Certain combinations of the TILT= option, and the ROTATE= option can cause the tick mark values to overlap. 4
1538
Procedure Syntax
Chapter 53
The G3D procedure supports AXIS denitions for Java and ActiveX only; however, you can use the functionality of PLOT and SCATTER statements to:
3 3 3 3 3 3
suppress the axes suppress axis labels suppress tick mark values specify the number of tick marks specify minimum and maximum values for the Z axis specify whether grid lines connect axis tick marks
The font and height of the graphs text can be changed with the GOPTIONS FTEXT= option and the GOPTIONS HTEXT= option, respectively. The GOPTIONS FBY= option can be used to specify the font for the BY-labels for BY-group graphs.
Procedure Syntax
Requirements:
At least one PLOT or SCATTER statement is required. AXIS, BY, FOOTNOTE, GOPTIONS, NOTE, TITLE
The procedure can include the FORMAT, LABEL, and WHERE statements. The AXIS statement is partially supported by the Java and ActiveX devices
only.
PROC G3D <DATA=input-data-set> <ANNOTATE=annotate-data-set> <GOUT=< libref.>output-catalog>; PLOT plot-request< /option(s)>; SCATTER plot-request< /option(s)>;
Syntax
PROC G3D <DATA=input-data-set> <ANNOTATE=annotate-data-set> <GOUT=< libref.>output-catalog>;
Options
Proc G3D statement options affect all graphs produced by the procedure.
PLOT Statement
1539
ANNOTATE=annotate-data-set
species an annotate data set to annotate all of the graphs that are produced by the G3D procedure. To annotate individual graphs, use the ANNOTATE= option in the action statement.
Alias:
ANNO=
See also: Chapter 29, Using Annotate Data Sets, on page 643 DATA=input-data-set
species the SAS data set that contains the variables to plot. By default, the G3D procedure uses the most recently created SAS data set. See also: SAS Data Sets on page 54 and The Input Data Set on page 1536
GOUT=<libref.>output-catalog
species the SAS catalog in which to save the graphics output that is produced by the G3D procedure. If you omit the libref, the output is placed in the temporary catalog WORK.GSEG. The temporary output catalog is created if it doesnt already exist. See also: Chapter 7, SAS/GRAPH Output, on page 87
PLOT Statement
Creates three-dimensional surface plots using values of three numeric variables from the input data set.
Requirements:
AXIS, BY, FOOTNOTE, GOPTIONS, NOTE, TITLE Reminder: The procedure can include the FORMAT, LABEL, and WHERE statements.
Global statements: Restriction:
The AXIS statement is partially supported by the Java and ActiveX devices
only.
Description
The PLOT statement species one plot request that identies the three numeric variables to plot. The statement also does the following actions: 3 scales the axes to include the minimum data values and the maximum data values for each of the plotted variables X, Y, and Z 3 labels each axis with the name of the variable or its associated label
Syntax
PLOT y*x=z </option(s)>; Option(s) can be one or more options from any or all of the following categories:
3 appearance options:
ANNOTATE=annotate-data-set CBOTTOM=bottom-surface-color CTOP=top-surface-color
1540
PLOT Statement
Chapter 53
ROTATE=angle-list SIDE TILT=angle-list XYTYPE=0 |1 | 2 | 3 3 axes options: CAXIS=axis-color CTEXT=text-color GRID NOAXIS | NOAXES NOLABEL XAXIS=axis <1...99> XTICKNUM=number-of-major-tick-marks YAXIS=axis <1...99> YTICKNUM=number-of-major-tick-marks ZAXIS=axis <1...99> ZMAX=maximum-value ZMIN=minimum-value ZTICKNUM=number-of-major-tick-marks 3 catalog entry description options: DESCRIPTION=entry-description" NAME=name"
Required Arguments
y*x=z;
species the three numeric variables from the input data set: Y is the horizontal variable whose values are plotted on the Y axis X is the horizontal variable whose values are plotted on the X axis Z is the vertical variable whose values are plotted on the Z axis
Options
Options in a PLOT statement affect all graphs that are produced by that statement. You can specify as many options as you want, and list them in any order.
ANNOTATE=annotate-data-set
species an annotate data set to annotate plots that are produced by the PLOT statement. Alias: ANNO= See also: Chapter 29, Using Annotate Data Sets, on page 643
CAXIS=axis-color
species a color for all the axes lines and tick marks. Style reference: Color attribute of the GraphAxisLines element
PLOT Statement
1541
Restriction: The AXIS statement is partially supported by Java and ActiveX. If the
AXIS statement species general axis colors with the COLOR= option; the CAXIS= option overrides the AXIS statement general COLOR= option.
CBOTTOM=bottom-surface-color
species a color for the axis labels and axis tick mark values. The G3D procedure uses the rst color it nds from the following list:
1 colors specied for labels and values on assigned AXIS statements, which
override the CTEXT= option on the PLOT statement. (Colors specied on AXIS statements are supported by the Java and ActiveX devices only.)
2 the color specied by the CTEXT= option in the PLOT statement 3 the color specied by the CTEXT= option in a GOPTIONS statement 4 the color specied in the current style, or the rst color in the color list for all of
the other devices if the NOGSTYLE system option is specied, the CTEXT= option color is assigned as follows:
3 for the Java and ActiveX devices the default color is black 3 for all other devices, the rst color in the devices color list
Note: If you use a BY statement in the procedure, the color of the BY variable label is controlled by the CBY= option in the GOPTIONS statement. 4 Note: For Java and ActiveX, specic text options specied in the AXIS statement override the CTEXT= option. 4
Style reference: Color attribute of the GraphValueText and the GraphLabelText
elements
CTOP=top-surface-color
DESCRIPTION=description
species the description of the plot. The maximum length for description is 256 characters. The descriptive text is displayed as follows:
3 3 3 3 3
the description in the Results window the description in the Explorer view of the catalog entry the description eld of the PROC GREPLAY window the ALT= text in the HTML le when the output destination is ODS HTML customized by inserting BY variable values with #BYLINE, #BYVAL(n), and #BYVAR(n) DES=
Alias:
Default: 3D surface plot of z by x and y See also: Substituting BY Line Values in a Text String on page 293 Restriction: Partially supported for ActiveX and Java
1542
PLOT Statement
Chapter 53
GRID
species the name of the GRSEG catalog entry, and the name of any graphics output le created. The name can be up to 256 characters long. If the name duplicates an existing name, SAS/GRAPH adds a number, or increments the last number used to create a unique graph namefor example G3D1. For GRSEG entries: 3 the name is truncated to eight characters
3 the rst character is always represented in upper case 3 all other characters are represented in lower case 3 periods and blanks are converted to underscores
For Graphics Output les:
species that the plot has no axes, axes labels, or tick mark values. Use this option if you want to generate axis labels and tick mark values with an annotate data set, or with the AXIS statement for Java and ActiveX.
Alias:
NOAXES
NOLABEL
species that the plot has no axis labels or tick mark values. Use this option if you want to generate axis labels and tick mark values with an annotate data set, or with the AXIS statement for Java and ActiveX.
ROTATE=angle-list
species one or more angles at which to rotate the X-Y plane around the perpendicular Z axis. Specify the values in degrees. The values specied in the angle-list can be negative or positive. If you specify a sequence of angles, separate graphs are produced for each angle. The angles that are specied in the ROTATE= option are paired with any angles that are specied with the TILT= option. If one option contains fewer values than the other, the last value in the shorter list is paired with the remaining values in the longer list. The angle-list list is in one of the following forms:
3 an explicit list of values: n <...n> 3 a starting and an ending value with an interval increment: n TO n <BY
increment>
3 a combination of both forms: n <...n> TO n <BY increment > <n <...n> >
Default: 70 degrees
produces a surface graph with a side wall. Example 3 on page 1554 Restriction: Partially support by Java
Featured in:
PLOT Statement
1543
TILT=angle-list
species one or more angles to tilt the graph toward you. The values must be specied in degrees. The valid values specied in the angle-list are 0 through 90. To generate a sequence of graphs, specify multiple angles, a graph is generated for each angle. The angles that are specied in the TILT= option are paired with any angles that are specied in the ROTATE= option. If one option contains fewer values than the other, the last value in the shorter list is paired with the remaining values in the longer list. The angle-list is in one of the following forms:
3 an explicit list of values: n <...n> 3 a starting and an ending value with an interval increment: n TO n <BY
increment>
3 a combination of both forms: n <...n> TO n <BY increment > <n <...n> >
Default: 70 degrees Featured in:
XAXIS= AXIS<1...<99>
species the number of major tick marks that are located on a plots x axis. At least two values are needed to generate the axis. Default: 4 (except Java and ActiveX are 5)
Restriction: Not supported by Java and ActiveX XYTYPE=0 | 1 | 2 | 3
species the direction of lines that are used to represent the plots surface. Both X and Y are displayed by default. The valid values for the XYTYPE= option are as follows: 1 XYTYPE=0 (Java and ActiveX only) No lines are displayed. The plot is displayed as a solid surface.
2 XYTYPE=1 draws lines that are parallel to the X axis. The surface is displayed
by using lines that represent X axis values. 4 XYTYPE=3 draws lines that are parallel to both the X and Y axes. Displays the surface by using lines that represent values for both X and Y. Changing the Surface Appearance on page 1544 Restriction: Not supported by Java
Featured in: YAXIS=AXIS <1...<99>
species the number of major tick marks that are located on a plots Y axis. At least two values are needed to generate the axis. Default: 4 (except Java and ActiveX are 5)
Restriction: Not supported by Java ZAXIS= AXIS<1...<99>
assigns an axis denition. Restriction: Partially supported by Java and ActiveX only
1544
PLOT Statement
Chapter 53
ZMAX=maximum-axis-value
species the maximum value that is displayed on a plots Z axis. Dening the ZMAX= option value greater than the data that is in the input data set, extends the plots Z axis. Dening the ZMAX= option value less than the maximum value in the input data set displays all Z values in the range of ZMIN-to-ZMAX, and might cause data clipping. The value of the ZMAX= option must be greater than the value of the ZMIN= option. Default: The maximum value of the Z variable Featured in: Example 2 on page 1553 Restriction: Not supported by Java
ZMIN=minimum-axis-value
species the minimum value that is displayed on a plots Z axis. Dening the ZMIN= option value less than the minimum value in the input data set extends the plots Z axis. Dening the ZMIN= value greater than the minimum value in the input data set displays all Z values in the range of ZMIN-to-ZMAX, and might cause data clipping. The value of the ZMIN= option must be less than the value of the ZMAX= option. Default: The minimum value of the Z variable Featured in: Example 2 on page 1553 Restriction: Not supported by Java
ZTICKNUM=number-of-major-tick-marks
species the number of major tick marks that are located on a plots Z axis. At least two values are needed to generate the axis. Default: 4 (except ActiveX is 5) Restriction: Not supported by Java
PLOT Statement
1545
Figure 53.6
Figure 53.7
1546
SCATTER Statement
Chapter 53
SCATTER Statement
Creates three-dimensional scatter plots using values of three numeric variables from the input data set. One plot request is required. Global statements: AXIS, BY, FOOTNOTE, GOPTIONS, NOTE, TITLE Reminder: The procedure can include the FORMAT, LABEL, and WHERE statements. Restriction: The AXIS statement is partially supported by Java and ActiveX devices only. Alias: SCAT
Requirements:
Description
The SCATTER statement species one plot request that identies the three numeric variables to plot. The statement also does the following actions: 3 scales the axes to include the minimum and maximum values for each of the plotted variables X, Y, and Z 3 labels each axis with the name of the plotted variable or its associated label 3 uses reference lines to mark the major tick marks on the X and Y axes, creating a grid on the horizontal plane 3 represents each data point with a pyramid that is connected to the horizontal plane with a needle 3 derives its colors from the ODS style In addition to the Global Statement options, the following Scatter statement options enable you to specify the appearance of many of the plots elements.
Syntax
SCATTER y*x=z < /option(s)>; Option(s) can be one or more options from any or all of the following categories:
3 appearance options:
ANNOTATE=annotate-data-set COLOR=data-point-color" | data-point-color-variable NONEEDLE ROTATE=angle-list SHAPE=symbol-name" | shape-variable SIZE=symbol-size | size-variable TILT=angle-list 3 axes options: CAXIS=axis-color CTEXT=text-color GRID NOAXIS | NOAXES NOLABEL XAXIS=axis <1...99> XTICKNUM=number-of-major-tick-marks
SCATTER Statement
1547
Required Arguments
y*x=z;
species three numeric variables from the input data set: Y species a horizontal variable whose values are plotted on the Y axis X species a horizontal variable whose values are plotted on the X axis Z species a vertical variable whose values are plotted on the Z axis Note: The SCATTER statement does not require a full grid of observations to generate a plot. 4
Options
Options in a SCATTER statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.
ANNOTATE=annotate-data-set
species an annotate data set to annotate plots that are produced by the SCATTER statement. ANNO= Restriction: Partially supported by Java and ActiveX
Alias: See also: Chapter 29, Using Annotate Data Sets, on page 643 CAXIS=axis-color
species a color for axis lines, tick marks, and horizontal grid lines. Style reference: Color attribute of the GraphAxisLines element
Restriction: The AXIS statement is partially supported by Java and ActiveX. When
the AXIS statement species only general axis colors with its COLOR= option, it is overridden by the CAXIS= color option.
COLOR=data-point-color | data-point-color-variable
species a color name or a character variable in the input data set whose values are color names. These color values determine the color or colors of the shapes that represent a plots data points. Color values must be valid color names for the device that is used. Using a list of colors in the value of the data-point-color-variable enables you to assign different colors to the shapes to classify data.
1548
SCATTER Statement
Chapter 53
species a color for all text on the axes, including tick mark values and axis labels. The G3D procedure uses the rst color it nds from the following list:
1 colors specied for labels and values on assigned axis statement 2 the color specied by the CTEXT= option in a SCATTER statement 3 the color specied by the CTEXT= option in a GOPTIONS statement
if the NOGSTYLE system option is specied, the CTEXT= option color is assigned as follows:
3 for the Java and ActiveX devices the default color is black 3 for all other devices, the rst color in the devices color list
Note: If you use a BY statement in the procedure, the color of the BY variable label is controlled by the CBY= option in the GOPTIONS statement. 4 Note: For Java and ActiveX only, specic text options specied in the AXIS statement override the CTEXT= option. 4
Style reference: Color attribute of the GraphValueText and GraphLabelText
elements
DESCRIPTION=description
species the description of the plot. The maximum length for description is 256 characters. The descriptive text is displayed as follows:
3 3 3 3
the description in the Results window the properties that you view form the Explorer window the description in the Explorer view of the catalog entry the Table of Contents that is generated when you use CONTENTS= on an ODS HTML statement, assuming the G3D output is generated while the contents page is open
3 the description eld of the PROC GREPLAY window 3 the ALT= text in the HTML le when the output destination is ODS HTML 3 customized by inserting BY variable values with #BYLINE, #BYVAL(n), and
#BYVAR(n)
Alias:
DES=
Default: 3D surface plot of z by x and y See also: Substituting BY Line Values in a Text String on page 293 GRID
species the name of the GRSEG catalog entry, and the name of any graphics output le created. The name can be up to 256 characters long. If the name duplicates an existing name, SAS/GRAPH adds a number, or increments the last number used to create a unique graph namefor example G3D1. For GRSEG entries:
3 3 3 3
the name is truncated to eight characters the rst character is always represented in uppercase all other characters are represented in lower case periods and blanks are converted to underscores
SCATTER Statement
1549
For Graphics Output les: 3 SAS/GRAPH adds a number to the NAME= value, or increments the last number used.
Default: Procedure name NOAXIS
species that a plot has no axes, including labels, tick marks, and values. Use this option if you want to generate axes with an annotate data set. Alias: NOAXES
NOLABEL
species that a plot has no axes labels or tick mark values. Use this option if you want to generate axis labels and tick mark values with an annotate data set.
NONEEDLE
species that a plot has no lines that connect the shapes representing data points to the X-Y plane. Restriction: The NONEEDLE option has no effect when SHAPE=PILLAR or when SHAPE=PRISM
ROTATE=angle-list
species one or more angles at which to rotate the X-Y plane around the perpendicular Z axis. Specify the value in degrees. The values specied in the angle-list can be negative or positive. The value can be greater than 360 degrees. If you specify a sequence of angles, separate graphs are produced for each angle. The angles that are specied in the ROTATE= option are paired with any angles that are specied with the TILT= option. If one option contains fewer values than the other, the last value in the shorter list is paired with the remaining values in the longer list. The angle-list list is in one of the following forms: 3 an explicit list of values: n <...n> 3 a starting and an ending value with an interval increment: n TO n <BY increment> 3 a combination of both forms: n <...n> TO n <BY increment > <n <...n> >
Default: 70 degrees SHAPE=symbol-name | shape-variable
species a symbol name or a character variable whose values are symbol names. Symbols represent data points for scatter plots. If you specify SHAPE=symbol-name, all data points are drawn in that shape. If you specify SHAPE=shape-variable, the shape of the data point is determined by the value of the shape variable, in the input data set, for that observation. For example, the procedure uses the value of the variable CLASS for a particular observation as the shape for that data point when you specify:
shape=class
Using a list of values in the variable named in SHAPE=shape-variable enables you to assign different shapes to the data points, to categorize your data. Valid values for symbol-name are as follows: 3 BALLOON 3 CLUB 3 CROSS 3 CUBE 3 CYLINDER 3 DIAMOND
1550
SCATTER Statement
Chapter 53
3 3 3 3 3 3 3 3 3
Figure 53.8
Default: Pyramid Restriction: These symbols might vary for Java and ActiveX SIZE=symbol-size | size-variable
species either a constant or a numeric variable, the values of which determine the size of symbol shapes on the scatter plot. If you specify SIZE=symbol-size, all data points are drawn in that size. If you specify SIZE=size-variable, the size of the data point is determined by the value of the size variable, in the input data set for that observation. For example, when you specify SIZE=CLASS, the procedure uses the value of the variable CLASS, for each observation in the input data set as the size of that data point. If you use a list of sizes as the value of the variable named in SIZE=size-variable, you can assign different sizes to the data points to categorize your data.
TILT=angle-list
species one or more angles at which to tilt the graph toward you. The value must be specied in degrees. The valid values specied in the angle-list are 0 through 90. To generate a sequence of graphs, specify different angles, and a graph is generated for each angle. The angles that are specied in the TILT= option are paired with any
SCATTER Statement
1551
angles that are specied with the ROTATE= option. If one option contains fewer values than the other, the last value in the shorter list is paired with the remaining values in the longer list. The angle-list is in one of the following forms: 3 an explicit list of values: n <...n> 3 a starting and an ending value with an interval increment: n TO n <BY increment> 3 a combination of both forms: n <...n> TO n <BY increment > <n <...n> >
Default: 70 degrees XAXIS= AXIS<1...<99>
specify the number of major tick marks that are located on a plots X axis. At least two values are needed to generate the axis. Default: 4 (except Java and ActiveX are 5)
YAXIS= AXIS<1...<99>
assigns an axis denition. Restriction: Partially supported by Java and ActiveX only
YTICKNUM=number-of-tick-marks
specify the number of major tick marks that are located on a plots Y axis. At least two values are needed to generate the axis. Default: 4 (except Java and ActiveX are 5)
ZAXIS= AXIS<1...<99>
specify the maximum data value that is displayed on a plots Z axis. You can use the ZMAX= option to extend the Z axis beyond the value range. The value that is specied by the ZMAX= option must be greater than that specied by the ZMIN= option. If you specify the ZMAX= option within the range of the Z variable values, the plots data values are clipped at the level you specied. Default: Maximum value of Z variable
ZMIN=minimum-value
species the minimum value that is displayed on a plots Z axis. Dening the ZMIN= value less than the minimum value in the input data set extends the plots Z axis. Dening the ZMIN= value greater than the minimum value in the input data set displays all Z values in the range of ZMIN-to-ZMAX, and might cause data clipping. The value of the ZMIN= option must be less than the value of the ZMAX= option. Default: The minimum value of the Z variable
ZTICKNUM=number-of-tick-marks
specify the number of major tick marks that are located on a plots Z axis. At least two values are needed to generate the axis. Default: 4 (except ActiveX is 5)
1552
Examples
Chapter 53
features. Figure 53.8 on page 1550 illustrates the shape names that you can specify in the SHAPE= option. To make all of the data points red balloons at twice the normal size, use the following code:
scatter y*x=z /color="red" shape="balloon" size=2;
To size your points according to the values of the variable TYPE in your input data set, use the following code:
scatter y*x=z / size=type;
Examples
PLOT statement
Sample library member: GTDSURFA
This surface plot reveals the shape of a generated data set named LAKE. The axes are scaled to include all data values. Each axis is labeled with the name or label of the corresponding variable. The tick marks on the axes are divided into three even intervals. The horizontal plane is rotated 70 around the Z axis. The graph is tilted 70 degrees toward you. The colors are derived from the ODS style.
Set the graphics environment.
goptions reset=all border;
1553
SASHELP.LAKE
1554
Chapter 53
The surface plot shown in this example illustrates enhancements to the axes and the presentation. The plot illustrates a grid originating from the tick marks. A Z axis range increase raised the plot above the horizontal X-Y plane. CTOP= green changed the top color and ROTATE= rotated the plot 45 degrees toward the viewer.
Set the graphics environment.
goptions reset=all border;
Generate the surface plot.CTOP=green changes the color of the plots top surface. The GRID option draws reference lines originating from the tick marks on all the axes. The ROTATE= option species a rotation angle of 45. ZMAX=5 species the maximum value for the Z axis. ZMIN= 50 species the minimum value for the Z axis. Specifying a ZMIN= value that is below the minimum value in the input data set raises the plot above the horizontal plane. Data is not displayed if it exceeds the range specied by the ZMIN= and ZMAX= options.
proc g3d data=sashelp.lake; plot length*width=depth/ ctop=green grid rotate=45 zmax=5 zmin=-50; run; quit;
SASHELP.LAKE
1555
Simple modications displayed in Example 1 on page 1552 are generated by tilting the surface plot 30 degrees toward you, and adding a side wall.
Set the graphics environment.
goptions reset=all border;
Generate the surface plot. The SIDE option draws a side wall for the graph. The TILT= option species a tilt angle of 15 for the plot. The initial rotation of 70 is not affected by the TILT= option.
proc g3d data=sashelp.lake; plot length*width=depth/ side tilt=30; run; quit;
Scatter statement
Sample library member: GTDSCAT
1556
Chapter 53
This scatter plot examines the results of measuring the petal length, petal width, and sepal length for the owers of three species of irises. The Scatter statement in this example relies on the procedure defaults to: 3 scale the axes to include all the data values 3 label the axes with the variables labels 3 divide the axes into three even intervals 3 rotate the horizontal plane 70 degrees around the vertical axis 3 tilt the plot 70 degrees toward you 3 display the plot with the default ODS style
1557
This scatter plot modies the results of measuring the petal length, petal width, and sepal length for the owers of three species of irises by: 3 using a DATA step to add a color variable and a shape variable to the data set 3 using shapes to distinguish iris species
3 using colors to distinguish iris species 3 using a Note statement to simulate a legend
1558
Chapter 53
1559
This scatter plot modies the results of measuring the petal length, petal width, and sepal length for the owers of three species of irises by: 3 using a DATA step to add a color variable and a shape variable to the data set 3 using shapes to distinguish iris species 3 using colors to distinguish iris species 3 removing needles from data points 3 adding a grid
1560
Chapter 53
This scatter plot modies the procedure defaults to: 3 specify a shape for the data points 3 classify the data by color 3 specify blue as the axis color 3 rotates the X-Y plane 15 degrees around the perpendicular Z axis. 3 species ve major tick marks for the Y-axis 3 species two major tick marks for the X-axis 3 species ve major tick marks for the Z-axis 3 species the zero as the minimum axis value for the Z-axis 3 species the one hundred as the maximum axis value for the Z-axis
References
1561
References
Fisher, R.A. (1936), The Use of Multiple Measurements in Taxonomic Problems, Annals of Eugenics, 7, 179188. Watkins, S.L. (1974), Algorithm 483, Masked Three-Dimensional Plot Program with Rotations (J6), in Collected Algorithms from ACM, New York: Association for Computing Machinery.
1562
1563
CHAPTER
54
The G3GRID Procedure
Overview 1563 Concepts 1565 The Input Data Set 1565 Multiple Vertical Variables 1565 Horizontal Variables Along a Nonlinear Curve 1565 The Output Data Set 1565 Interpolation Methods 1566 Bivariate Interpolation 1566 Spline Interpolation 1566 Spline Smoothing 1567 Procedure Syntax 1568 PROC G3GRID Statement 1568 GRID Statement 1569 Examples 1573 Example 1: Using the Default Interpolation Method 1573 Example 2: Spline and Smoothing Interpolations 1576 Example 3: Partial Spline Interpolation 1578 Example 4: Spline Interpolation 1580 References 1582
Overview
The G3GRID procedure processes an existing SAS data set to create a data set that the G3D procedure or the GCONTOUR procedure can use to produce a three-dimensional surface plot or a contour plot. The procedure creates a data set whose horizontal X-Y variable values form a complete grid, and it interpolates the values of the vertical Z variable for each point on the X-Y plane. Using the G3GRID procedure, you can do the following actions: 3 create a rectangular grid of interpolated or smoothed values from irregularly spaced observations for use in a three-dimensional surface or contour plot 3 complete a rectangular grid of interpolated or smoothed values for an input data set that has an insufcient number of observations to produce a three-dimensional surface or contour plot 3 interpolate or smooth data for a three-dimensional plot The G3GRID procedure does not produce graphics output. Proc G3GRID produces an output data set that you can use as the input data set for Proc G3D or Proc GCONTOUR. Figure 54.1 on page 1564, and Figure 54.2 on page 1564 illustrate the effect of the G3GRID procedure on data.
1564
Overview
Chapter 54
This gure shows a collection of data points, where z=f(x,y). These points are randomly distributed, and cannot be displayed with a G3D surface plot, although they can be displayed with a scatter plot.
Figure 54.1
The following gure shows a surface plot of the data set that is created by a G3GRID interpolation of the original data set shown in the preceding gure. The evenly distributed horizontal (x,y) data points form a grid for the three-dimensional plot.
Figure 54.2
1565
Concepts
3 two horizontal variables (x, y) 3 one or more vertical variables, z through z-n, that is interpolated or smoothed as if
it were a function of the two horizontal variables The G3GRID procedure can process multiple vertical variables for each pair of horizontal variables that you specify:
3 if you specify more than one vertical variable, the G3GRID procedure performs a
separate analysis, and produces interpolated or smoothed values for each vertical variable
3 if more than one observation in the input data set has the same values for both
horizontal variables, x and y, only the rst observation is used in the interpolation. A warning message is printed to the log.
3 by default, the interpolation is performed after both variables are similarly scaled,
because the interpolation methods assume that the scales of x and y are comparable
3 the two horizontal variables 3 the interpolated or smoothed vertical variables 3 any BY variables
1566
Interpolation Methods
Chapter 54
G3Grid enables you to control both the number of x and y values in the output data set, and the values themselves. In addition, you can specify an interpolation method.
Interpolation Methods
The G3GRID procedure can use one of three interpolation methods: bivariate interpolation (the default), spline interpolation, and smoothing spline interpolation.
Bivariate Interpolation
Unless you specify the SPLINE option, the G3GRID procedure is an interpolation procedure. It calculates the z values for x, y points that are missing from the input data set. The surface that is formed by the interpolated data passes precisely through the data points in the input data set. This method of interpolation works best for fairly smooth functions, with values given at uniformly distributed points in the plane. If the data points in the input data set are erratic, the default interpolated surface can be erratic. This default method is a modication of that described by Akima (1978). This method consists of the following actions: 1 dividing the plane into non-overlapping triangles that use the positions of the available points 2 tting a bivariate fth degree polynomial within each triangle 3 calculating the interpolated values by evaluating the polynomial at each grid point that falls in the triangle The coefcients for the polynomial are computed based on the following criteria: 3 the values of the function at the vertices of the triangle 3 the estimated values for the rst, and second derivatives of the function at the vertices The estimates of the rst, and second derivatives are computed using the n nearest neighbors of the point, where n is the number specied in the GRID statements NEAR= option. A Delauney triangulation (Ripley 1981, p. 38), is used for the default method. The coordinates of the triangles are available in an output data set, if requested by the OUTTRI= option, in the PROC G3GRID statement. This is the default interpolation method.
Spline Interpolation
If you specify the SPLINE option, a method is used that produces either an interpolation. or smoothing that is optimally smooth. See (Harder and Desmarais 1972, Meinguet 1979, Green and Silverman 1994). The surface that is generated can be thought of as one that would be formed if a stiff, thin metal plate were forced through, or near the given data points. For large data sets, this method is substantially more expensive than the default method. The function u, formed when you specify the SPLINE option, is determined by letting:
tj
= (xj ; yj ) = (x; y)
Interpolation Methods
1567
and
jt 0
tj j
= (x
xj
)2 + (y
yj
)2
1=2
E (s; t) =
js 0
tj log
(s
j
tj :
The coefcients c1, c2,..., cn, and d1, d2, d3 of this polynomial are determined by the following equations:
(E + nI) c + T d = z
, and
Tc=0
0
2 n matrix E(t , t
i
2 n identity matrix
is the smoothing parameter that is specied in the SMOOTH= option c is (c1 ,..., cn ) z is (z1 ,..., zn ) d is (d1, d2, d3) T is the n
Spline Smoothing
Using the SMOOTH= option on the GRID statement with the SPLINE option, enables you to produce a smoothing spline. See Eubank (1988) for a general discussion of spline smoothing. The value or values specied in the SMOOTH= option are substituted for in the equation that is described in Spline Interpolation on page 1566. A smoothing spline trades closeness to the original data points for smoothness.
1568
Procedure Syntax
Chapter 54
To nd a value that produces the best balance between smoothness, and t to the original data, several values for the SMOOTH= option can be run.
Procedure Syntax
Requirements: Reminder:
Syntax
PROC G3GRID <DATA=input-data-set> <OUT=output-data-set> <OUTTRI=output-data-set>;
Options
DATA=input-data-set
species the SAS data set that contains the variables to process. By default, the procedure uses the most recently created SAS data set.
See also: SAS Data Sets on page 54 and The Input Data Set on page 1565. OUT=output-data-set
species the output data set. The data set contains any BY variables that you specify, the interpolated or smoothed values of the vertical variables (z through z-n), and the coordinates for all grid positions on the horizontal (x-y) plane. If you specify smoothing, the output data set also contains a variable named _SMTH_, whose value is a smoothing parameter. The observations in this data set are ordered by any variables that you specify with a BY statement. By default, the output of PROC G3GRID creates WORK.DATA1. Depending on the shape of the original data, and the options you use, the output data set can contain values for the vertical (z through z-n) values that are outside of the range of the original values in the data set.
Featured in:
GRID Statement
1569
OUTTRI=output-data-set
species an additional output data set that contains triangular coordinates. The data set will contain any BY variables that you specify, the two horizontal variables giving the horizontal (x -y) plane coordinates of the input points, and a variable named TRIANGLE that uses the integer values to label the triangles. The observations in this data set are ordered by any variables that you specify with a BY statement. The data set contains three observations for each value of the variable TRIANGLE. The three observations give the coordinates of the three vertices of the triangle. Points on the convex hull of the input data set of points are also assumed to lie in degenerate triangles, whose other vertices are at innity. The points in the convex hull can be recovered by keeping only those triangles with exactly two missing vertices. By default, no OUTTRI= data set is produced. OUTTRI= is not valid when you specify the SPLINE option in the GRID statement.
GRID Statement
Species the three numeric variables for interpolation or for smoothing. Can also specify the number of observations (x and y values), in the output data set; output values for the two horizontal variables x-y; and the interpolation method for the vertical variables.
Requirements:
Syntax
GRID grid-request </option(s)>; grid-request must be: y*x=z(s) option(s) can be one or more options from any or all of the following categories:
3 grid options:
AXIS1=ascending-value-list AXIS2=ascending-value-list NAXIS1=n NAXIS2=n
3 interpolation options:
JOIN NEAR=n PARTIAL SCALE | NOSCALE SMOOTH=ascending-value-list SPLINE
1570
GRID Statement
Chapter 54
Required Arguments
y*x=z(s)
species three or more numeric variables from the input data set: y is one of the variables that forms the horizontal (x-y) plane x is another of the variables that forms the horizontal (x-y) plane z(s) is one or more of the vertical variables for the interpolation Although the GRID statement can specify only two horizontal variables, it can include multiple vertical variables. Separate vertical variables with blanks:
grid x*y=z w u v;
Options
AXIS1=ascending-value-list
species a list of numeric values to assign to the rst (y) variable in the grid request for the output data set. Numbers that you specify with this option determine the number of values for y, and override a value that you specify with the NAXIS1= option. The ascending-value-list must be arranged in ascending order. The value list can be in any of the following forms: 3 n <...n> 3 n TO n <BY increment> 3 n <...n> TO n <BY increment > <n <...n> >
Featured in:
AXIS2=ascending-value-list
species a list of numeric values to assign to the second (x) variable in the grid request for the output data set. Numbers that you specify with this option determine the number of values for x and override a value that you specify with the NAXIS2= option. The ascending-value-list must be arranged in ascending order. The value list can be in any of the following forms: 3 n <...n> 3 n TO n <BY increment> 3 n <...n> TO n <BY increment > <n <...n> >
Featured in: JOIN
uses a linear interpolation within a set of triangular regions that are formed from the input data set. This interpolation method creates values in the range of the initial values of the vertical variable, but the resulting interpolated surface might not be smooth.
NAXIS1=n
species the number of values for the rst (y) variable in the grid request for the output data set. You can determine the actual values used for y by taking the minimum and the maximum values of y and dividing the range into n- one equal sections.
GRID Statement
1571
A value specied with NAXIS1= is ignored if values are also specied with AXIS1=.
Default: 11 NAXIS2=n
species the number of values for the second (x) variable in the grid request for the output data set. You can determine the actual values that are used for x by taking the minimum value and the maximum value of x, and dividing the range into n- one equal sections. A value specied with NAXIS2= is ignored if values are also specied with AXIS2=.
Default: 11 NEAR=n
species the number of the nearest data points to use for computing the estimates of the rst derivative, and the second derivative. As NEAR= values become larger, time and computation costs increase signicantly. NEAR= is ignored if you specify SPLINE. The value of n must be greater than or equal to 3. If the number of input data points is insufcient for the number that you specify with NEAR=, a smaller number of data points is used.
Default: 3 Featured in: NOSCALE
species that the x and y variables not be scaled to the same range before interpolation. By default, the interpolation is performed after both variables are similarly scaled because the interpolation methods assume that the scales of x and y are comparable.
Default: SCALE PARTIAL
species that a spline be used to estimate the derivatives for the biquintic polynomial interpolation. A bivariate spline is t to the nearest neighbors, and is used to estimate the needed derivatives. This option produces results that are less smooth than those produced by the SPLINE option and uses fewer computer resources. However, the results produced by PARTIAL are smoother than those that are produced by the default. If you use both the PARTIAL option and the SPLINE option, the PARTIAL option is ignored.
Featured in: SCALE
species that the x and y variables be scaled to the same range before interpolation. The interpolation is performed after both variables are similarly scaled because the interpolation methods assume that the scales of x and y are comparable.
Default: SCALE SMOOTH=ascending-value-list
species a list of numbers for smoothing parameters. Use the SMOOTH= option only when you also use the SPLINE option. The ascending-value-list must be arranged in ascending order. The value list can be in any of the following forms:
3 n <...n> 3 n TO n <BY increment> 3 n <...n> TO n <BY increment > <n <...n> >
1572
GRID Statement
Chapter 54
n j =1
X
n
For each value of the smoothing parameter, a function u (x, y) is formed that minimizes
(u (xj ; yj )
0 z j )2 +
Z 1 Z 1 @2 2 @2 2 @2 2!
01 01
@ 2x
u +2 u @ x@ y +
@2y
dxdy
where n is the number of data points, and the pairs (xj, yj )are the available points, with corresponding function values zj (Wahba 1990). The higher the value of the smoothing parameter, the smoother the resulting interpolation. The lower the smoothing parameter, the closer the resulting surface is to the original data points. A smoothing parameter of 0 produces the same results as the SPLINE option without the SMOOTH= option. This procedure repeats for each value of the smoothing parameter. The output data set that you specify in the OUT= option contains: 3 the interpolated values 3 the values of the grid points 3 the values of the smoothing parameter in the variable _SMTH_ 3 a separate grid for each value of the smoothing parameter
Featured in: SPLINE
species the use of a bivariate spline (Harder and Desmarais 1972, Meinguet 1979, Green and Silverman 1994) to interpolate, or to form a smoothed estimate, if you also 3 use the SMOOTH= option. The SPLINE option results in the use of an order n algorithm, where n is the number of input data points. Consequently, this method can be time-consuming. If you use more than 100 input points, the procedure can use excessive time. Featured in: Example 2 on page 1576 and Example 4 on page 1580.
1573
Options Specied AXIS2= NAXIS1= NAXIS2= AXIS1=, AXIS2= AXIS1=, NAXIS1= AXIS1=, NAXIS2= AXIS2=, NAXIS1= AXIS2=, NAXIS2= NAXIS1=, NAXIS2=
Number of Observations in Output Data Set (number of values for AXIS2=) * 11 (value of NAXIS1=) * 11 (value of NAXIS2=) * 11 (number of values for AXIS1=) * (number of values for AXIS2=) (number of values for AXIS1=) * 11 (number of values for AXIS1=) * (value of NAXIS2=) (number of values for AXIS2=) * (value of NAXIS1=) (number of values for AXIS2=) * 11 (value of NAXIS1=) * (value of NAXIS2=)
Depending on the shape of the original data, and the options that you specify, the output data set can contain values for the vertical (z) values that are outside of the range of the original values in the data set.
Examples
1574
Chapter 54
Figure 54.3
This example demonstrates the default interpolation method that is used by the GRID statement. The example rst generates a scatter plot of random data to show the concentration of data values before processing the data set with the G3GRID procedure. The original data does not contain enough combinations of x, y and z values to: 3 generate a surface plot with the G3D procedure 3 generate a contour plot with the GCONTOUR procedure The example then runs the G3GRID procedure to interpolate additional x, y, and z values. Because no interpolation method is specied, the default interpolation method is used. The resulting output data set is used as input to the G3D procedure, which generates the surface plot shown in the following output.
1575
Figure 54.4
Create data set. NUMS uses a set of randomly sampled points to create the data used in this, and all remaining examples in this chapter.
data nums; keep x y z; do i=1 to 30; x=10*ranuni(33)-5; y=10*ranuni(35)-5; z=sin(sqrt(x*x+y*y)); output; end; run;
1576
Chapter 54
Grid the data with PROC G3GRID. The OUT= option on Proc G3GRID species a name for the temporary output data set. The GRID option species the variables Y*X=Z for the output data set. The AXIS statements dene axes ranges.
proc g3grid data=nums out=default; grid y*x=z / axis1=-5 to 5 by .5 axis2=-5 to 5 by .5; run; quit;
Generate the surface plot. The G3D procedure using the G3GRID procedures output data set as the input data set.
proc g3d data=default; plot y*x=z; run; quit;
This example extends Example 1 on page 1573 to specify the SPLINE option on the GRID statement. The output data set, when used in PROC G3D, generates a smoother surface plot.
1577
Figure 54.5
The following plot extends Example 1 on page 1573 to specify the SPLINE option, and the SMOOTH= option on the GRID statement. The SMOOTH= option is set to .05 for additional smoothing. The output data set, when used in PROC G3D, generates a smoother surface plot.
Figure 54.6
1578
Chapter 54
Process points with PROC G3GRID. The SPLINE option species the bivariate spline method for the data set interpolation.
proc g3grid data=nums out=spline; grid y*x=z / spline axis1=-5 to 5 by .5 axis2=-5 to 5 by .5; run;
Process the data with PROC G3GRID.The SMOOTH=.05 option species the smoothing parameter to use during spline interpolation.
proc g3grid data=nums out=smoothed; grid y*x=z / spline smooth=.05 axis1=-5 to 5 by .5 axis2=-5 to 5 by .5; run; quit;
1579
Data set:
This example species a partial spline interpolation on the GRID statement, using the eight nearest neighbors for computing the estimates of the rst, and second derivatives. The output data set, when used in PROC G3D:
3 generates a more smooth surface plot than the surface plot that results from the
default interpolation shown in Example 1 on page 1573
3 does not generate the smoothness of the surface plot that results from the spline
interpolation shown in Example 2 on page 1576
Figure 54.7
Process data with PROC G3GRID. The PARTIAL option species that a spline be used to estimate the derivatives for the biquintic polynomial interpolation. The NEAR= option species the number of nearest neighbors to be used for computing the estimates of the rst, and the second derivatives.
proc g3grid data=nums out=partial; grid y*x=z / partial near=8 axis1=-5 to 5 by .5 axis2=-5 to 5 by .5; run;
1580
Chapter 54
GRID statement options: AXIS1= AXIS2= SPLINE Data set: NUMS (see Example 1 on page 1573) Sample library member: GTGSPLIN
This example demonstrates the default interpolation method when used by the GCONTOUR procedure to generate a contour plot from the resulting output data set.
Figure 54.8
The second plot, demonstrates the spline interpolation method when used by the GCONTOUR procedure to generate a contour plot from the resulting output data set.
1581
Figure 54.9
1582
References
Chapter 54
Process data with PROC G3GRID. The SPLINE option species the bivariate spline method for the interpolation.
proc g3grid data=nums out=numspl; grid y*x=z / spline axis1=-5 to 5 by .5 axis2=-5 to 5 by .5; run;
References
Akima, Hiroshi (1978), A Method of Bivariate Interpolation and Smooth Surface Fitting for Irregularly Distributed Data Points, ACM Transaction on Mathematical Software, 4, 148159. Eubank, R.L. (1988), Spline Smoothing and Nonparametric Regression, New York: Marcel Dekker. Green, P.J. and Silverman, B.W. (1994), Nonparametric Regression and Generalized Linear Models, London: Chapman & Hall. Harder, R.L. and Desmarais, R.N. (1972), Interpolation Using Surface Splines, Journal of Aircraft, 9, 189191. Meinguet, Jean (1979), Multivariate Interpolation at Arbitrary Points Made Simple, Journal of Applied Mathematics and Physics, 30, 292304.
References
1583
Ripley, B.D. (1981), Spatial Statistics, New York: John Wiley & Sons, Inc. Wahba, G. (1990), Spline Models for Observational Data, Philadelphia: SIAM.
1584
1585
CHAPTER
55
The MAPIMPORT Procedure
Overview 1585 Procedure Syntax 1586 PROC MAPIMPORT Statement 1586 EXCLUDE Statement 1587 ID Statement 1587 RENAME Statement 1588 SELECT Statement 1588 Examples 1589 Example 1: Including All Variables from the SHP Shapele 1589 Example 2: Including Selected Variables from the SHP Shapele 1589 Example 3: Excluding a Variable from the SHP Shapele 1590 Example 4: Using the ID Statement 1590 Example 5: Including Selected Variables from the DBF Shapele 1590
Overview
The MAPIMPORT procedure enables you to import ESRI shapeles (spatial data formats) and process the SHP les into SAS/GRAPH traditional map data sets. See About Traditional Data Sets on page 1234 for more information. The MAPIMPORT procedure does not produce any graphics output. Instead, it produces an output map data set, which can be used with the GMAP procedure. The shapeles le types are described in the following table:
Table 55.1 Shapeles File Types
Description identication information (eld-identier names and values) assigned to specic polygon(s) shape information for the polygon(s) that compose the map.
Note: These les are used with SHP les and cannot be imported by themselves. 4
.shp combines the shape information for the polygon(s) that compose the map and the identication information (eld-identier names and values) assigned to the specic polygon(s)
Note: If you import a very highly-detailed map, then the GMAP procedure might produce extraneous lines when drawing it. To avoid this issue, use the GREDUCE procedure to reduce the number of map points. 4
1586
Procedure Syntax
Chapter 55
Procedure Syntax
Requirements: The name and location of an output data set and the complete path for the input data le. Reminder: The single quotes surrounding eld identiers are optional when the eld identiers follow the SAS naming convention. Single quotes are required for eld identiers that are non-standard SAS names. When eld identiers placed in single quotes are non-standard SAS names, the eld identiers are converted to a standard SAS name in the traditional map data set. For more information about the standard SAS naming convention, see names in the SAS Language in the SAS Language Reference: Concepts. For more information on how invalid eld identiers placed in single quotes are renamed, see the SAS System option VALIDVARNAME in the SAS/ACCESS for Relational Databases: Reference.
PROC MAPIMPORT OUT= map-data-set DATAFILE= path-to-shapele <CONTENTS> <CREATE_ID_>; EXCLUDE eld-identier(s); ID eld-identier(s); RENAME eld-identier-1 = variable-name-1 < ... eld-identier-n = variable-name-n>; SELECT eld-identier(s);
Required Arguments
OUT= map-data-set
species the name of the output map data set that is created.
DATAFILE= path-to-shapele
species the path and lename of the shapele that is read and processed.
Alias:
INFILE=
Note: By default, all of the elds in a shapele are included in the output map data set. To include only specic elds in the output map data set, use the SELECT statement. To exclude specic elds from the output map data set, use the EXCLUDE statement. 4
ID Statement
1587
Options
CONTENTS
displays information about the shapele, including eld identier names and types.
CREATE_ID_
creates a map ID variable named _ID_ with a unique value for each polygon in the map. This variable is created automatically if the DBF le is missing.
Interaction: This statement has no effect if you also specify the ID statement.
EXCLUDE Statement
Species one or more elds from the shapele thatare excluded from the output map data set.
Requirements: Restriction: Restriction:
If you specify conicting values for the EXCLUDE and SELECT statements, then the MAPIMPORT procedure produces an error. If you specify the same eld identier on the EXCLUDE statement and on the ID statement, then the MAPIMPORT procedure produces an error.
EXCLUDE eld-identier(s);
Required Arguments
eld-identier(s)
species one or more elds from the shapele that are excluded from the output map data set. All of the elds that you do not specify are included in the output map data set. If you do not specify the EXCLUDE statement or the SELECT statement, then all of the elds from the shapele are included in the output map data set.
ID Statement
Reorders the map polygons by one or more identier elds.
Requirements At least one eld-identier is required. Interaction:
The CREATE_ID option on the PROC MAPIMPORT statement has no effect when you also specify the ID option.
ID eld-identier(s);
1588
RENAME Statement
Chapter 55
Required Arguments
eld-identier(s)
species one or more elds in the shape le that identify the polygons in the map. The values of the elds that you specify are used to reorder the map polygons and assign segment numbers in the output map data set. When you do not specify the ID statement, the MAPIMPORT procedure uses the existing polygon order for the output map data set. You might want to use the ID statement when the default output map data set does not draw properly in the GMAP procedure. If the ID variable that you specify in the GMAP procedure is not unique for each polygon, then extraneous lines might appear in your GMAP output. To ensure that the ID variable is unique for each polygon, specify the same ID statement in both the MAPIMPORT and GMAP procedures.
RENAME Statement
Renames variables in the output map data set that correspond to specic elds in the shapele.
Requirements:
Required Arguments
eld-identier = variable-name
assigns a variable name in the output map data set for a eld in the shapele. You can specify multiple eld identier and variable name pairs, separated by a space. For example, the following code renames the STNAME eld to STATE, and the FIPSTATE eld to STATE_FIPS:
rename "stname" = state "fipstate" = state_fips;
By default, when you do not specify the RENAME statement, the MAPIMPORT procedure uses the eld name in the shapele as the variable name in the output map data set. However, if the eld name is not a valid SAS variable name, then the variable name is modied in the output map data set. For more information about valid SAS variable names, see the Rules for Words and Names in the SAS Language chapter of SAS Language Reference: Concepts.
SELECT Statement
Selects the elds from the shapele that are included in the output map data set.
Requirements: Restriction:
At least one eld-identier is required. If you specify conicting values for the EXCLUDE and SELECT statements, then the MAPIMPORT procedure produces an error.
1589
SELECT eld-identier(s);
Required Arguments
eld-identier(s)
species one or more elds from the shapele that are included in the output map data set. If you do not use the SELECT statement or the EXCLUDE statement, then all of the elds from the shapele are included in the output map data set. For eld identiers that are not valid SAS variable names, the MAPIMPORT procedure changes the name of the variable in the output map data set automatically. For more information about valid SAS variable names, see the Rules for Words and Names in the SAS Language chapter of SAS Language Reference: Concepts.
Examples
The following examples use shapeles with the .shp and .dbf extensions. Replace the shapeles locations, lenames, and eld-identiers with information from your shapeles to run these examples.
1590
Chapter 55
1591
P A R T
6
1593
Appendixes
Appendix Appendix Appendix Appendix Appendix Appendix
4. . . . . . . . . Transporting and Converting Graphics Output 5. . . . . . . . . GREPLAY Procedure Template Code 6. . . . . . . . . Recommended Reading
1667 1655
1651
1592
1593
APPENDIX
1
Summary of ActiveX and Java Support
Introduction 1594 Global Statements 1594 AXIS Statement 1594 Text Description Suboptions 1595 Tick Mark Description Suboptions 1595 GOPTIONS Statement 1596 LEGEND Statement 1600 LEGEND Statement Text Description Suboptions PATTERN Statement 1601 SYMBOL Statement 1602 POINTLABEL= Label Description Options 1603 TITLE and FOOTNOTE Statements 1604 PROC GAREABAR 1604 PROC GBARLINE 1605 PROC GCHART 1607 Text Description Suboptions 1612 PROC GCONTOUR 1612 PROC GMAP 1614 PROC GPLOT 1617 PROC GRADAR 1622 PROC GTILE 1625 PROC G3D 1625 Annotate Functions 1627 ARROW 1627 BAR 1627 DRAW 1628 DRAW2TXT 1628 FRAME 1629 IMAGE 1629 LABEL 1629 MOVE 1630 PIE 1631 PIECNTR 1631 PIEXY 1632 POINT 1632 POLY 1632 POLYCONT 1633 SYMBOL 1633
1601
1594
Introduction
Appendix 1
Introduction
The following tables summarize which options and annotate variables are supported or partially supported by the Java and ActiveX devices. Partial support for options that refer to global statements, such as the GAXIS= option, indicates that some but not all AXIS statement options are supported. Partial support may also indicate that an option works differently for the other devices than it does for the Java and ActiveX device drivers, or that an option works for one or more applets but not for all. For a complete description of each option or variable, refer to the documentation for the option or variable.
Global Statements
AXIS Statement
Table A1.1 Option COLOR= C= INTERVAL= LABEL= LENGTH= LOGBASE= LOGSTYLE= MAJOR= MINOR= NOBRACKETS NOPLANE OFFSET= ORDER= ORIGIN= REFLABEL= SPLIT= STYLE= ActiveX and Java Support for the AXIS Statement Supported by ActiveX? Yes No Yes (partial) Yes Yes Yes Yes (partial) Yes (partial) No Yes Yes Yes (partial) No No No Yes Supported by Java? Yes No Yes (partial) No No No Yes (partial) Yes (partial) No Yes No Yes (partial) No No No Yes
4
Option VALUE= WIDTH= Supported by ActiveX? Yes Yes (partial)
AXIS Statement
1595
1596
GOPTIONS Statement
Appendix 1
GOPTIONS Statement
You must specify the ODS USEGOPT statement for the CTEXT=, CTITLE=, FTEXT=, FTITLE=, HTEXT=, and HTITLE= options to work for the Java and ActiveX devices. See Using Graphics Options with ODS (USEGOPT) on page 193 for more information.
Table A1.4 Option ACCESSIBLE ADMGDF NOADMGDF ASPECT= AUTOCOPY NOAUTOCOPY AUTOFEED NOAUTOFEED AUTOSIZE= BINDING= BORDER CBACK= CBY= CELL CHARACTERS NOCHARCTERS CHARTYPE= CIRCLEARC NOCIRCLEARC COLLATE NOCOLLATE COLORS= CPATTERN= CSYMBOL= CTEXT= CTITLE= DASH NODASH ActiveX and Java Support for the GOPTIONS Statement Supported by ActiveX? Yes No No No No No No Yes Yes No No No No No No Yes No No Yes Yes No Supported by Java? Yes No No No No No No Yes Yes No No No No No No Yes No No Yes (partial) Yes No
4
Option DASHSCALE= DELAY= DEVADDR= DEVICE= DEVMAP= DISPLAY NODISPLAY DISPOSAL= DRVINIT= DRVTERM= DUPLEX NODUPLEX ERASE NOERASE EXTENSION FASTTEXT NOFASTTEXT FBY= FCACHE= FILECLOSE= FILEONLY NOFILEONLY FILL NOFILL FILLINC= FONTRES= FTEXT= FTITLE= FTRACK= GACCESS= GCLASS= GCOPIES= GDDMCOPY= GDDMNICKNAME= GDDMTOKEN= GDEST= GEND= GEPILOG= GFORMS= Supported by ActiveX? No No No Yes No No No No No No No No No No No No No No No No Yes (partial) Yes No No No No No No No No No No No
GOPTIONS Statement
1597
1598
GOPTIONS Statement
Appendix 1
Option GOUTMODE= GPROLOG= GPROTOCOL= GRAPHRC NOGRAPHRC GSFLEN= GSFMODE= GSFNAME= GSFPROMPT NOGSFPROMPT GSIZE= GSTART= GUNIT= GWAIT= GWRITER= HANDSHAKE= HBY= HORIGIN= HPOS= HSIZE= HTEXT= HTITLE= IBACK= IMAGEPRINT NOIMAGEPRINT IMAGESTYLE= INTERLACED NOINTERLACED INTERPOL= ITERATION= KEYMAP= LFACTOR= OFFSHADOW= PAPERDEST= PAPERFEED= PAPERLIMIT= PAPERSIZE= PAPERSOURCE=
Supported by ActiveX? No No No No No No No No No No Yes (partial) No No No No No No Yes (partial) Yes Yes Yes No Yes No No No No No No No No No No No
Supported by Java? No No No No No No No No No No Yes (partial) No No No No No No Yes (partial) Yes (partial) Yes Yes (partial) No No No No No No No No No No No No No
4
Option PAPERTYPE= PCLIP NOPCLIP PENMOUNTS= PENSORT NOPENSORT PIEFILL NOPIEFILL POLYGONCLIP NOPOLYGONCLIP POLYGONFILL NOPOLYGONFILL POSTGEPILOG= POSTGPROLOG= POSTGRAPH= PPDFILE= PREGEPILOG= PREGPROLOG= PREGRAPH= PROMPT NOPROMPT PROMPTCHARS= RENDER= RENDERLIB= REPAINT= RESET REVERSE NOREVERSE ROTATE= ROTATE NOROTATE SIMFONT= SPEED= SWAP NOSWAP SWFONTRENDER SYMBOL NOSYMBOL TARGETDEVICE= Supported by ActiveX? No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No
GOPTIONS Statement
1599
1600
LEGEND Statement
Appendix 1
Option TRANSPARENCY NOTRANSPARENCY TRANTAB= UCC= USERINPUT NOUSERINPUT VORIGIN= VPOS= VSIZE= V6COMP NOV6COMP XMAX= XPIXELS= YMAX= YPIXELS=
Supported by ActiveX? Yes (partial) No No No No No Yes (partial) Yes (partial) No Yes (partial) No Yes (partial)
Supported by Java? No No No No No No Yes (partial) Yes (partial) No Yes (partial) No Yes (partial)
LEGEND Statement
Table A1.5 Option ACROSS= CBLOCK= CBORDER= CFRAME= CSHADOW= DOWN= FRAME FWIDTH= LABEL= MODE= OFFSET= ORDER= ORIGIN= POSITION= ActiveX and Java Support for the LEGEND Statement Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes No Yes (partial) No No No No Yes Supported by Java? Yes No Yes Yes Yes Yes Yes No Yes (partial) No No No No Yes (partial)
4
Option SHAPE= VALUE= Supported by ActiveX? No Yes (partial)
PATTERN Statement
1601
PATTERN Statement
Table A1.7 Option COLOR= C= IMAGE= IMAGESTYLE= REPEAT= R= VALUE=bar/block-pattern V=bar/block-pattern ActiveX and Java Support for the PATTERN Statement Supported by ActiveX? Yes (partial) Yes (partial) Yes (partial) Yes (partial) Yes (partial) Supported by Java? Yes (partial) Yes (partial) Yes (partial) Yes (partial) Yes (partial)
1602
SYMBOL Statement
Appendix 1
Yes (partial)
Yes (partial)
SYMBOL Statement
Table A1.8 Option BWIDTH= CI= CO= COLOR= C= CV= FONT= HEIGHT= H=
ActiveX and Java Support for the SYMBOL Statement Supported by ActiveX? Yes Yes Yes Yes (GPLOT and GBARLINE) No (GCONTOUR) Yes (GPLOT) No (GCONTOUR) No Yes (GPLOT) No (GCONTOUR) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes (GPLOT and GBARLINE) No (GCONTOUR) Yes (GPLOT) No (GCONTOUR) No Yes (GPLOT) No (GCONTOUR) Yes (partial) Yes (partial) Yes Yes Yes (partial) Yes Yes Yes (partial) No Yes
INTERPOL=BOX I=BOX INTERPOL=HILO I=HILO INTERPOL=JOIN I=JOIN INTERPOL=L I=L INTERPOL=map/plot-pattern I=map/plot-pattern INTERPOL=NEEDLE I=NEEDLE INTERPOL=NONE I=NONE INTERPOL=R I=R INTERPOL=SM I=SM INTERPOL=SPLINE I=SPLINE
4
Option INTERPOL=STD I=STD INTERPOL=STEP I=STEP LINE= L= MODE= POINTLABEL= REPEAT= R= STEP= S= VALUE= V= WIDTH= W= Supported by ActiveX? Yes Yes Yes (GPLOT) No (GCONTOUR) Yes Yes (partial) Yes (GPLOT) No (GCONTOUR) No Yes (partial for GPLOT) No (GCONTOUR) Yes (partial for GPLOT) No (GCONTOUR)
SYMBOL Statement
1603
Supported by Java? Yes (partial) Yes Yes (GPLOT) No (GCONTOUR) Yes (partial) Yes (partial) Yes (GPLOT) No (GCONTOUR) No Yes (partial for GPLOT) No (GCONTOUR) Yes (partial for GPLOT) No (GCONTOUR)
ActiveX and Java Support for POINTLABEL Description Suboptions Supported by ActiveX? Yes Yes Yes No No Yes (partial) Supported by Java? No No No No No Yes (partial)
1604
Appendix 1
Table A1.10 ActiveX and Java Support for TITLE and FOOTNOTE Statements Option ANGLE= BCOLOR= BLANK= BOX= BSPACE= COLOR= DRAW= FONT= HEIGHT= JUSTIFY= LANGLE= LINK= LSPACE= MOVE= ROTATE= UNDERLIN= Supported by ActiveX? No Yes No No No Yes No Yes Yes (partial) Yes No Yes No No No Yes (partial) Supported by Java? No Yes No No No Yes No Yes Yes (partial) Yes No Yes No No No Yes (partial)
PROC GAREABAR
Table A1.11 ActiveX and Java Support for GAREABAR Statement PROC GAREABAR HBAR and VBAR Option DATA= CFR FRAME= CTEXT= DISCRETE FRAME NOFRAME NAME= Supported by ActiveX? Yes Yes Yes Yes Yes Yes Supported by Java? No No No No No No
4
Statement Option RSTAT= RESPSTAT= RESPONSESTAT= SUBGROUP= SUMVAR= WSTAT= WIDTHSTAT= Supported by ActiveX? Yes
PROC GBARLINE
1605
Supported by Java? No
No No No
PROC GBARLINE
Table A1.12 ActiveX and Java Support for PROC GBARLINE Statement PROC GBARLINE Option ANNOTATE= ANNO= DATA= IMAGEMAP= BAR ANNOTATE= ANNO= ASCENDING AUTOREF AXIS= CAUTOREF= CAXIS= CERROR= CFRAME= CFR= CFREQ CLIPREF CLM= COUTLINE= CPERCENT CPCT CREF= CTEXT= DESCENDING Supported by ActiveX? Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? No No No No No No No No No No No No No No No No No No No
1606
PROC GBARLINE
Appendix 1
Statement
Option DESCRIPTION= DES= DISCRETE ERRORBAR= FRAME NOFRAME FR NOFR FREQ FREQ=numericvariable FRONTREF HTML= HTML_LEGEND INSIDE= LAUTOREF= LEGEND LEVELS= LREF= LR= MAXIS= MEAN MIDPOINTS=valuelist MIDPOINTS=OLD MINOR= MISSING NAME= NOAXIS NOBASEREF NOZERO OUTSIDE= PATTERNID= PERCENT PCT RANGE RAXIS= AXIS= REF=
Supported by Java? No No No No
Yes No Yes Yes No Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
No No No No No No No No No No No No No No No No No No No No No No No
No No No
4
Statement Option SPACE= SUM SUMVAR= TYPE= WIDTH= WOUTLINE= PLOT ASCENDING AXIS= FREQ=numericvariable HTML= MINOR= NOLINE NOMARKER RAXIS= AXIS= SUMVAR= TYPE= Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes
PROC GCHART
1607
Supported by Java? No No No No No No No No No No No No No No No No
PROC GCHART
Table A1.13 ActiveX and Java Support for PROC GCHART Statement PROC GCHART Option ANNOTATE= ANNO= DATA= GOUT= IMAGEMAP= BLOCK ANNOTATE= ANNO= BLOCKMAX= CAXIS= COUTLINE= CTEXT= Supported by ActiveX? Yes Yes Yes No Yes No Yes Yes (partial) Yes Supported by Java? Yes Yes Yes No Yes No Yes Yes (partial) Yes
1608
PROC GCHART
Appendix 1
Statement
Option DESCRIPTION= DES= DISCRETE FREQ= G100 GROUP= HTML= HTML_LEGEND= LEGEND= LEVELS= MIDPOINTS=valuelist MIDPOINTS=OLD MISSING NAME= NOHEADING NOLEGEND PATTERNID= SUBGROUP= SUMVAR= TYPE= WOUTLINE=
Supported by ActiveX? Yes Yes Yes Yes Yes Yes No Yes (partial) Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes
Supported by Java? Yes Yes Yes Yes Yes Yes No Yes (partial) Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes
ANNOTATE= ANNO= ASCENDING AUTOREF AXIS= CAUTOREF= CAXIS= CFRAME= CFR= CERROR= CFREQ CFREQLABEL= CLIPREF CLM= COUTLINE=
4
Statement Option CPERCENT CPCT CPERCENTLABEL= CREF= CTEXT= DESCENDING DESCRIPTION= DES= DISCRETE ERRORBAR= FRAME NOFRAME FR NOFR FREQ FREQLABEL= FREQ=numericvariable FRONTREF G100 GAXIS= GROUP= GSPACE= HTML= HTML_LEGEND= IFRAME= IMAGESTYLE= INSIDE= LAUTOREF= LEGEND= LEVELS= LREF= LR= MAXIS= MEAN MEANLABEL= MIDPOINTS=valuelist MIDPOINTS=OLD Supported by ActiveX? Yes No Yes Yes Yes Yes Yes Yes Yes
PROC GCHART
1609
Supported by Java? Yes No Yes Yes Yes Yes Yes Yes Yes
Yes No Yes Yes Yes Yes (partial) Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes (partial) Yes No Yes Yes
Yes No Yes Yes Yes Yes (partial) Yes Yes Yes No No No Yes Yes Yes Yes No Yes (partial) Yes No Yes Yes
1610
PROC GCHART
Appendix 1
Statement
Option MINOR= MISSING NAME= NOAXIS NOBASEREF NOLEGEND NOSTATS NOZERO OUTSIDE= PATTERNID= PERCENT PCT PERCENTLABEL= RANGE RAXIS= AXIS= REF= SHAPE= SPACE= SUBGROUP= SUM SUMLABEL= SUMVAR= TYPE= WIDTH= WOUTLINE=
Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Supported by Java? Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes
No Yes Yes (partial) Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
No Yes Yes (partial) Yes Yes Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes
ACROSS= ANGLE= ANNOTATE= ANNO= ASCENDING CFILL= CLOCKWISE COUTLINE= CTEXT= DESCENDING
4
Statement Option DESCRIPTION= DES= DETAIL= DETAIL_PERCENT= DETAIL_RADIUS= DETAIL_SLICE= Supported by ActiveX? Yes Yes Yes Yes Yes
PROC GCHART
1611
Supported by Java? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes (partial) Yes Yes Yes No Yes Yes Yes (partial) Yes (partial) Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes
DETAIL_THRESHOLD= Yes DETAIL_VALUE= DISCRETE DONUTPCT= DOWN= EXPLODE= FILL= FREQ= GROUP= HTML= HTML_LEGEND= INVISIBLE= JSTYLE LABEL= LEGEND= LEVELS= MATCHCOLOR MIDPOINTS=valuelist MIDPOINTS=OLD MISSING NAME= NOGROUPHEADING NOHEADING NOLEGEND OTHER= OTHERCOLOR= OTHERLABEL= PERCENT= SLICE= SUBGROUP= Yes Yes Yes Yes Yes Yes (partial) Yes Yes Yes No Yes Yes Yes (partial) Yes (partial) Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes
1612
Appendix 1
Statement
STAR
PROC GCONTOUR
Table A1.15 ActiveX and Java Support for PROC GCONTOUR Statement PROC GCONTOUR Option ANNOTATE= ANNO= DATA= GOUT= INCOMPLETE PLOT ANNOTATE= ANNO= Supported by ActiveX? Yes (partial) Yes No No Yes (partial) Supported by Java? Yes (partial) Yes No No Yes (partial)
4
Statement Option AUTOHREF AUTOLABEL= AUTOVREF CAUTOHREF= CAUTOVREF= CAXIS= CFRAME= CFR= CHREF= CH= CLEVELS= COUTLINE= CTEXT= CVREF= CV= DESCRIPTION= DES= GRID HAXIS= HMINOR= HM= HREF= HREVERSE= JOIN LAUTOHREF= LAUTOVREF= LEGEND= LEVELS= LHREF= LH= LLEVELS= LVREF= LV= NAME= NLEVELS= NOAXIS NOAXES NOFRAME NOLEGEND Supported by ActiveX? Yes No Yes Yes Yes Yes No Yes Yes (partial) No Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes (partial) Yes Yes Yes (partial) Yes Yes (partial) Yes Yes (partial) Yes Yes Yes Yes Yes
PROC GCONTOUR
1613
Supported by Java? No No No No No Yes (partial) No No No No Yes No Yes No Yes (partial) No No No Yes (partial) No No Yes (partial) Yes No No Yes (partial) Yes Yes Yes Yes Yes
1614
PROC GMAP
Appendix 1
Statement
Supported by ActiveX? Yes (partial) Yes (partial) Yes Yes Yes Yes
PROC GMAP
Table A1.16 ActiveX and Java Support for PROC GMAP Statement PROC GMAP Option MAP= ALL ANNOTATE= DATA= GOUT= IMAGEMAP= STRETCH UNIFORM AREA DISCRETE LEGEND= LEVELS= MIDPOINTS= MISSING NOLEGEND PERCENT RANGE STATFMT= STATISTIC= UNIFORM ID Supported by ActiveX? Yes Yes Yes Yes No No No Yes Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes No No No No Yes Yes Yes (partial) Yes Yes (partial) Yes Yes Yes Yes Yes Yes No Yes
4
Statement BLOCK Option ANNOTATE= AREA= BLOCKSIZE= CBLKOUT= CDEFAULT= CEMPTY= COUTLINE= CTEXT= DESCRIPTION= DISCRETE HTML= HTML_LEGEND= LEGEND= LEVELS= MIDPOINTS= MISSING NAME= NOLEGEND PERCENT RANGE RELZERO SHAPE= STATISTIC= STRETCH UNIFORM WOUTLINE= XSIZE= YSIZE= XVIEW= YVIEW= ZVIEW= CHORO ANNOTATE= CDEFAULT= CEMPTY= COUTLINE= CTEXT= DESCRIPTION= Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes
PROC GMAP
1615
Supported by Java? Yes Yes Yes Yes No No Yes Yes Yes Yes Yes No Yes (partial) Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No Yes (partial)
1616
PROC GMAP
Appendix 1
Statement
Option DISCRETE HTML= HTML_LEGEND= LEGEND= LEVELS= MIDPOINTS= MISSING NAME= NOLEGEND PERCENT RANGE STATFMT= STATISTIC= STRETCH UNIFORM WOUTLINE= XSIZE= YSIZE=
Supported by ActiveX? Yes Yes No Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes
Supported by Java? Yes Yes No Yes (partial) Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes No No Yes No Yes Yes No No Yes Yes Yes Yes Yes No Yes (partial) Yes Yes (partial) Yes Yes Yes Yes Yes Yes
PRISM
ANNOTATE= AREA= CDEFAULT= CEMPTY= COUTLINE= CTEXT= DESCRIPTION= DISCRETE HTML= HTML_LEGEND= LEGEND= LEVELS= MIDPOINTS= MISSING NAME= NOLEGEND PERCENT RANGE STATFMT=
4
Statement Option STATISTIC= STRETCH UNIFORM WOUTLINE= XLIGHT= YLIGHT= XSIZE= YSIZE= XVIEW= YVIEW= ZVIEW= SURFACE Supported by ActiveX? Yes No Yes No No No Yes
PROC GPLOT
1617
No
No
PROC GPLOT
When used with the JAVA or JAVAMETA device driver, the BUBBLE statement must have at least one axis that is assigned to a numeric variable.
Table A1.17 ActiveX and Java Support for PROC GPLOT Statement PROC GPLOT Option ANNOTATE= ANNO= DATA= GOUT= IMAGEMAP= UNIFORM BUBBLE ANNOTATE= ANNO= AUTOHREF AUTOVREF BCOLOR= BFILL= BFONT= BLABEL BSCALE= BSIZE= CAUTOHREF= CAUTOVREF= Supported by ActiveX? Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes No No Yes No Yes (partial) Yes Yes Supported by Java? Yes Yes Yes Yes No Yes Yes Yes Yes No No Yes No Yes (partial) Yes Yes
1618
PROC GPLOT
Appendix 1
Statement
Option CAXIS= CA= CFRAME= CFR= CHREF= CH= CTEXT= C= CVREF= CV= DESCRIPTION= DES= FRAME NOFRAME FR NOFR GRID HAXIS= HMINOR= HM= HREF= HREVERSE HZERO IFRAME= IMAGESTYLE= LAUTOHREF= LAUTOVREF= LHREF= LH= LVREF= LV= NAME= NOAXIS NOAXES VAXIS= VMINOR= VM= VREF= VREVERSE VZERO
Yes Yes (partial) Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes
Yes Yes (partial) Yes Yes Yes (partial) Yes No Yes Yes Yes Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes
4
Statement BUBBLE2 Option ANNOTATE= ANNO= AUTOVREF BCOLOR= BFILL= BFONT= BLABEL BSCALE= BSIZE= CAUTOVREF= CAXIS= CA= CFRAME= CFR= CTEXT= C= CVREF= CV= FRAME NOFRAME FR NOFR GRID HAXIS HREVERSE IFRAME LAUTOVREF= LVREF= LV= NOAXIS NOAXES VAXIS= VMINOR= VM= VREF= VREVERSE VZERO PLOT ANNOTATE= AREAS= AUTOHREF Supported by ActiveX? Yes Yes Yes No No Yes No Yes (partial) Yes Yes Yes Yes Yes Yes
PROC GPLOT
1619
Supported by Java? Yes Yes Yes No No Yes No Yes (partial) Yes Yes Yes Yes Yes Yes
Yes Yes (partial) Yes (partial) Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes Yes
Yes Yes (partial) Yes (partial) Noc Yes Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes (partial) Yes
1620
PROC GPLOT
Appendix 1
Statement
Option AUTOVREF CAUTOHREF= CAUTOVREF= CAXIS= CA= CFRAME= CFR= CHREF= CH= COUTLINE= CTEXT= C= CVREF= CV= DESCRIPTION= DES= FRAME NOFRAME FR NOFR GRID HAXIS= HMINOR= HM= HREF= HREVERSE HTML= HTML_LEGEND= HZERO IFRAME= IMAGESTYLE= LAUTOHREF= LAUTOVREF= LEGEND= LHREF= LH= LVREF= LV= NAME=
Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Supported by Java? Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes
Yes Yes (partial) Yes Yes Yes (partial) Yes (partial) No Yes Yes Yes Yes Yes Yes Yes Yes (partial) Yes
Yes Yes (partial) Yes Yes Yes (partial) Yes (partial) No Yes No No Yes Yes Yes Yes Yes (partial) Yes
4
Statement Option NOAXIS NOAXES NOLEGEND OVERLAY REGEQN SKIPMISS VAXIS= VMINOR= VM= VREF= VREVERSE VZERO PLOT2 With INTERPOL= BOX, HILO, or STD ANNOTATE= ANNO= AREAS= AUTOVREF CAUTOVREF= CAXIS= CA= CFRAME= CFR= COUTLINE= CTEXT= C= CVREF= CV= FRAME NOFRAME FR NOFR GRID HTML= HTML_LEGEND= LAUTOVREF= LEGEND= LVREF= LV= NAME= Supported by ActiveX? Yes Yes Yes No Yes Yes (partial) Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
PROC GPLOT
1621
Supported by Java? Yes Yes Yes (partial) Yes Yes Yes (partial) Yes Yes Yes Yes No Yes Yes (partial) Yes Yes Yes Yes No Yes Yes Yes
1622
PROC GRADAR
Appendix 1
Statement
Option NOAXIS NOAXES NOLEGEND OVERLAY REGEQN SKIPMISS VAXIS= VMINOR= VM= VREF= VREVERSE VZERO
Supported by ActiveX? Yes Yes Yes No Yes Yes (partial) Yes Yes Yes Yes
Supported by Java? Yes Yes Yes (partial) Yes Yes Yes (partial) Yes Yes Yes Yes
PROC GRADAR
Table A1.18 ActiveX and Java Support for PROC GRADAR Statement PROC GRADAR Option ANNOTATE= DATA= GOUT= CHART ACROSS= ACROSSVAR= ANNOTATE= ANNO= CALENDAR= CAXIS= CAXES= CA= CFRAME= CFR= CFRAMESIDE= CFRAMETOP= CSPOKES= CSPOKE= CSTARCIRCLES= CSTARCIRCLE= Supported by ActiveX? Yes Yes Yes Yes No Yes No Supported by Java? No No No No No No No
No No No No No
4
Statement Option CSTARFILL= CSTARS= CSTAR= CTEXT= CTILES= CTILE= DESCRIPTION= DES= DOWN= DOWNVAR= FONT= FRAME FREQ= HEIGHT= HLABEL= HTML= HTML_LEGEND= IFRAME= IMAGESTYLE= INBORDER INHEIGHT= INTERTILE= INTERCHART= LSPOKEs= LSTARCIRCLES= LSTARCIRCLE= LSTARS= LSTAR= MAXNVERT= MAXVERT= MISSING MODE= NAME= NCOLS= NCOL= NLEVELS= NOLEGEND NOZEROREF NROWS= NROW= Supported by ActiveX? Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes No
PROC GRADAR
1623
Supported by Java? No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
1624
PROC GRADAR
Appendix 1
Statement
Option ORDERACROSS= OTHER= OVERLAY= OVERLAYVAR= SPEED SPIDERWEB SPIDER SPKLABEL= SPOKESCALE= STARAXIS= STARAXES= STARCIRCLES= STARCIRCLE= STARFILL= STARINRADIUS= STARLEGEND= STARLEGENDLAB= STAROUTRADIUS= STARSTART= STARTYPE= SUMVAR= TILELEGEND= TILELEGLABEL= WFRAME= WAXIS= WINDROSE WINDROSECIRCLES= WSPOKES= WSPOKE= WSTARCIRCLES= WSTARCIRCLE= WSTARS= WSTAR=
Supported by ActiveX? No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes No No No Yes Yes Yes Yes Yes
PROC G3D
1625
PROC GTILE
Table A1.19 ActiveX and Java Support for PROC GTILE Statement PROC TILE TILEBY FLOW BASELINE CMISSING= COLORRAMP= COLORVAR= DESCRIPTION= DETAILLEVEL= LABELLEVEL= NAME= TILE TOGGLE Option DATA= Supported by ActiveX? Yes Yes Yes Yes Yes (partial) Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
PROC G3D
Table A1.20 ActiveX and Java Support for PROC G3D Statement PROC G3D Option ANNOTATE= ANNO= DATA= GOUT= PLOT ANNOTATE= ANNO= CAXIS= CBOTTOM= CTEXT= CTOP= Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Supported by ActiveX? Yes Supported by Java? Yes
1626
PROC G3D
Appendix 1
Statement
Option DESCRIPTION= DES= GRID NAME= NOAXIS NOAXES NOLABEL ROTATE= SIDE TILT= XAXIS XTICKNUM= XYTYPE YAXIS= YTICKNUM= ZAXIS ZMAX= ZMIN= ZTICKNUM=
No Yes Yes
Yes Yes (partial) Yes Yes (partial) Yes (partial) Yes (partial) Yes Yes (partial) Yes Yes (partial) Yes Yes Yes (partial) Yes
Yes Yes (partial) Yes Yes (partial) Yes (partial) No (partial) No Yes (partial) No No (partial) No No No Yes
SCATTER
ANNOTATE= ANNO= CAXIS= COLOR= CTEXT= DESCRIPTION= DES= GRID NAME= NOAXIS NOAXES NOLABEL NONEEDLE ROTATE= SHAPE= SIZE= TILT=
4
Statement Option XTICKNUM= YTICKNUM= ZTICKNUM= ZMAX= ZMIN= Yes Yes (partial) Supported by ActiveX? Yes
BAR
1627
Annotate Functions
ARROW
Table A1.21 ActiveX and Java Support for the ARROW Function Variable ANGLE COLOR GROUP HSYS LINE MIDPOINT SIZE STYLE SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
BAR
Table A1.22 ActiveX and Java Support for the BAR Function Variable COLOR GROUP HTML Supported by ActiveX? Yes Yes Yes Supported by Java? Yes Yes No
1628
DRAW
Appendix 1
Variable LINE MIDPOINT SIZE STYLE SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS
Supported by ActiveX? Yes Yes Yes Yes (Partial) Yes Yes Yes Yes Yes
Supported by Java? Yes (Partial) Yes Yes Yes (Partial) Yes Yes Yes Yes Yes
DRAW
Table A1.23 ActiveX and Java Support for the DRAW Function Variable COLOR GROUP HSYS LINE MIDPOINT SIZE SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
DRAW2TXT
Table A1.24 ActiveX and Java Support for the DRAW2TXT Function Variable COLOR HSYS LINE Supported by ActiveX? Yes Yes Yes Supported by Java? Yes Yes Yes
4
Variable SIZE WHEN Supported by ActiveX? Yes Yes
LABEL
1629
FRAME
Table A1.25 ActiveX and Java Support for the FRAME Function Variable COLOR HSYS HTML LINE SIZE STYLE WHEN XSYS, YSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? No No No No No No No No
IMAGE
Table A1.26 ActiveX and Java Support for the IMAGE Function Variable HTML IMGPATH STYLE WHEN X, Y XSYS, YSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes
LABEL
Table A1.27 ActiveX and Java Support for the LABEL Function Variable ANGLE CBORDER Supported by ActiveX? Yes Yes Supported by Java? No Yes
1630
MOVE
Appendix 1
Variable CBOX COLOR GROUP HSYS HTML MIDPOINT POSITION ROTATE SIZE STYLE SUBGROUP TEXT WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS
Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Supported by Java? Yes Yes Yes No No Yes Yes (Partial) No Yes No Yes Yes Yes Yes Yes Yes
MOVE
Table A1.28 ActiveX and Java Support for the MOVE Function Variable GROUP MIDPOINT SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes
PIECNTR
1631
PIE
Table A1.29 ActiveX and Java Support for the PIE Function Variable ANGLE COLOR GROUP HSYS HTML LINE MIDPOINT ROTATE SIZE STYLE SUBGROUP WHEN WIDTH X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes (Partial) Yes Yes Yes (Partial) Yes Yes Yes Supported by Java? Yes Yes Yes Yes No Yes (Partial) Yes Yes Yes Yes (Partial) Yes Yes Yes (Partial) Yes Yes Yes
PIECNTR
Table A1.30 ActiveX and Java Support for the PIECNTR Function Variable GROUP HSYS MIDPOINT SIZE SUBGROUP WHEN X, Y, Z Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes
1632
PIEXY
Appendix 1
PIEXY
Table A1.31 ActiveX and Java Support for the PIEXY Function Variable ANGLE SIZE WHEN Supported by ActiveX? Yes Yes Yes Supported by Java? Yes Yes Yes
POINT
Table A1.32 ActiveX and Java Support for the POINT Function Variable COLOR GROUP MIDPOINT SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes (Partial) Yes (Partial) Yes (Partial)
POLY
Table A1.33 ActiveX and Java Support for the POLY Function Variable COLOR GROUP HTML LINE Supported by ActiveX? Yes Yes Yes Yes Supported by Java? Yes Yes No No
4
Variable MIDPOINT SUBGROUP SIZE STYLE WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes (Partial) Yes Yes Yes Yes
SYMBOL
1633
Supported by Java? Yes Yes Yes Yes (Partial) Yes Yes Yes Yes
POLYCONT
Table A1.34 ActiveX and Java Support for the POLYCONT Function Variable COLOR GROUP MIDPOINT SUBGROUP WHEN X, Y, Z XC, YC XSYS, YSYS, ZSYS Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? Yes Yes Yes Yes Yes Yes Yes Yes
SYMBOL
Table A1.35 ActiveX and Java Support for the SYMBOL Function Variable CBOX CBORDER COLOR GROUP SUBGROUP HSYS HTML MIDPOINT Supported by ActiveX? Yes Yes Yes Yes Yes Yes Yes Yes Supported by Java? No No Yes Yes Yes Yes No Yes
1634
SYMBOL
Appendix 1
Supported by ActiveX? Yes Yes(Partial) Yes (Partial) Yes Yes Yes Yes
Supported by Java? Yes Yes (Partial) Yes (Partial) Yes Yes Yes Yes
1635
APPENDIX
2
Using SAS/GRAPH Fonts
Introduction 1635 Rendering Bitstream Fonts 1635 Listing or Displaying SAS/GRAPH Fonts on Your System SAS/GRAPH Font Lists 1636 The SIMULATE Font 1644 Font Locations And the Default Search Path 1645
1636
Introduction
SAS/GRAPH fonts are the entries in the SASHELP.FONTS catalog. Information on these fonts is provided for special purposes only. For example, some specialized devices do not support system fonts. Or, you might want to use special symbols in the Marker font to display solid symbols for data points in a plot. If you specify the NOGSTYLE system option and one of the Z device drivers (see Devices on page xvii), SAS/GRAPH uses SAS/GRAPH fonts. In general, it is recommended that you use the system fonts supplied by SAS whenever possible. See SAS/GRAPH, System, and Device-Resident Fonts on page 153 and TrueType Fonts That Are Supplied by SAS on page 154 for more information. Note: The Java and ActiveX devices do not support SAS/GRAPH fonts. SAS/GRAPH fonts cannot be used with template-based graphics (see Device-Based Graphics and Template-Based Graphics on page 6). 4
1636
Appendix 2
from the rendered font le instead of performing the rendering calculations each time the characters are used. If you store the rendered fonts in les in a permanent SAS data set, SAS/GRAPH can use the rendered font les again in subsequent SAS sessions. Note: Because the rendered font les use a special utility member type, they do not appear in the list of library members that is displayed in the DIRECTORY window. 4 You control whether and how rendered versions of fonts are stored using the FONTRES=, RENDER=, and RENDERLIB= graphics options. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for details.
You can display these fonts with the GFONT procedure. See Example 1 on page 1189.
CAUTION:
Empty and uniform versions of fonts cannot be used if you have deleted their lled or proportionally spaced counterparts. 4
If the label of a font in SASHELP.FONTS is Depends on, it is possible to delete it. However, empty and uniform versions of fonts are generated from their regular, bold, or
1637
italic counterparts. Therefore, if you delete any of these fonts, you cannot use the uniform or empty version of that font. For example, you must have the CENTB (Century Bold) font in order to use the CENTBE (Century Bold Empty) font.
Roman Alphabet Text Fonts Font Name BRUSH Type Sample Uniform Font
CENTB CENTBE CENTBI CENTBIE CENTX CENTXE CENTXI CENTXIE GERMAN GITALIC
CENTBU
Bold Empty Bold Italic Bold Italic Empty Expanded Expanded Empty Expanded Italic Expanded Italic Empty German German Italic Hershey Sans Serif Sans Serif Bold Serif Serif Bold Serif Bold Italic Serif Italic Old English Script Cscript Swiss Empty Bold Bold Empty Bold Italic Bold Italic Empty
CENTBIU
CENTXU
CENTXIU
GERMANU GITALICU
SIMPLEX DUPLEX COMPLEX TRIPLEX TITALIC ITALIC OLDENG SCRIPT CSCRIPT SWISS SWISSE SWISSB SWISSBE SWISSBI SWISSBIE
SWISSU
SWISSBU
SWISSBIU
1638
Appendix 2
Type Style Expanded Expanded Empty Expanded Bold Expanded Bold Empty Italic Italic Empty Light Light Empty Zapf Empty Bold Bold Empty Bold Italic Bold Italic Empty Italic Italic Empty
Font Name SWISSX SWISSXE SWISSXB SWISSXBE SWISSI SWISSIE SWISSL SWISSLE ZAPF ZAPFE ZAPFB ZAPFBE ZAPFBI ZAPFBIE ZAPFI ZAPFIE
Type Sample
SWISSXBU
SWISSIU
SWISSLU
ZAPFU
ZAPFBU
ZAPFBIU
ZAPFIU
Table A2.2
Type Style Arabic Arabic Empty Cyrillic David Davidb Fsong Greek Greek (serif) Hebrew Hebrew Hebrewb Hebrew Empty
Font Name ARABIC ARABICE CYRILLIC DAVID DAVIDB FSONG GREEK CGREEK HEBREW NHEBREW* HEBREWB HEBREWE
CYRILLIU
4
Uniform Font Name HEIU
1639
Type Style Hei Hiragana Hiragana Kanji Kanji Kanji Subset Kanji 1 Kanji 2 Kanji 3 Kanji 4 Kanji 5 Kanji 6 Kanji 7 Kanji 8 Katakana Katakana Korean Mincho
KAN1 KAN2 KAN3 KAN4 KAN5 KAN6 KAN7 KAN8 KATA NKATA* KGOTHB1 MINCHO MINCHOE
*This font requires a special keyboard and is host-dependent. If you are not equipped to use this font, use the host-independent version listed directly above.
1640
Appendix 2
Figure A2.1
Greek (GREEK)
4
Figure A2.2 Greek Serif (CGREEK) Font
1641
Table A2.3
Type Style
Cartographic CARTOG Electronic Marker Marker Empty Math Music Special Weather
ELECTRON ELECTROU MARKER MARKERE * MATH MUSIC SPECIAL WEATHER MATHU MUSICU SPECIALU WEATHERU
1642
Appendix 2
Figure A2.3
Cartographic Font
Figure A2.4
Electronic Font
Note: Figure A2.5 on page 1642 shows the MARKER font. The MARKERE font produces the same symbols but in empty (outline) form. 4
Figure A2.5 Marker Font
4
Figure A2.6 Math Font
1643
Figure A2.7
Music Font
1644
Appendix 2
Figure A2.8
Special Font
Figure A2.9
Weather Font
4
3 3 3 3
1645
GOPTIONS NOCHARACTERS is specied. The device driver does not support device-resident text. You request a device-resident font for a different device. You specify an angle or rotation for the characters that the device does not support. 3 The device does not have a scalable font (characters can be generated only in the proportions specied with the font), and one of the following conditions is also met: 3 The values of the HPOS= and VPOS= graphics options do not match the values displayed in the LCOLS or PCOLS eld or the LROWS or PROWS eld in the Detail window of the device entry. 3 The HSIZE= or VSIZE= graphics option is set to values that are not the default. 3 You replay a graph in a template that is not the same size as the full size of the graphics output area, or you use a device driver other than the one you used to create the graph. 3 The target device and the display device have different values for the HPOS= and VPOS= graphics options. 3 You use any height specication, including the HEIGHT=, HTEXT=, HTITLE=, and HBY= graphics options, that is not equal to 1. You should never delete the SIMULATE font from the fonts catalog. Note: You can change the font that is used as the SIMULATE font with the SIMFONT= graphics option. If you use the SIMFONT= option, it is better to specify a uniform font. Do not specify a device-resident font as a substitute for SIMULATE. See SIMFONT on page 422 for more information on the SIMFONT= option. 4
GFONT0 to GFONT9.
1646
Appendix 2
b It nds a GFONTn libref without a FONTS catalog. c It encounters an undened libref in that sequence before locating the
specied font. (SASHELP is one of the standard librefs dened automatically whenever you start your SAS session; you do not need to issue a LIBNAME statement to dene it.)
3 If the specied font is not found in SASHELP.FONTS, then a warning is issued
and the SIMULATE font is used. The SIMULATE font is the default SAS/GRAPH font and should never be deleted from the fonts catalog. See The SIMULATE Font on page 1644 for more information. See Chapter 40, The GFONT Procedure, on page 1165 for additional information on specifying the libref GFONT0.
1647
APPENDIX
3
Using Device-Resident Fonts
Introduction 1647 Default Device-Resident Fonts 1647 Using a GOPTIONS Statement to Change the Default Device-Resident Font Using the GDEVICE Procedure to Change the Default Device-Resident Font Specifying the Full Font Name 1649 Specifying Alternative Device-Resident Fonts 1649
1648 1648
Introduction
You can use device-resident fonts with SAS/GRAPH output in four ways. 3 by using the CHARTYPE= graphics option in a GOPTIONS statement to specify the default device-resident font. Assign the number of a font listed in the Chartype window of your device entry as the default device-resident font. See Using a GOPTIONS Statement to Change the Default Device-Resident Font on page 1648 for details. 3 by using the GDEVICE procedure to specify the number of the font you want to use as the default device-resident font. See Using the GDEVICE Procedure to Change the Default Device-Resident Font on page 1648 for details. 3 by specifying the full font name as it appears on the Chartype window of the device driver entry. See Specifying the Full Font Name on page 1649 for details. 3 by explicitly specifying a device-resident font name of the type HWxxxnnn. See Specifying Alternative Device-Resident Fonts on page 1649 for details. There are several advantages to using device-resident fonts instead of SAS/GRAPH fonts. Device-resident fonts often are produced faster than SAS/GRAPH fonts and produce smaller output les. Also, some devices, such as laser printers with device-resident fonts, might produce better quality output with device-resident fonts than with SAS/GRAPH fonts.
1648
Appendix 3
Every available device-resident font for a particular device has a number associated with it. This number and the corresponding font name are listed in the Chartype window of the device entry for your device. The default device-resident font is the font whose number is entered in the Chartype eld in the Parameters window of the device entry. When FONT=NONE or no font is specied, SAS/GRAPH uses the font assigned to this eld. If your device has more than one device-resident font, you can assign a different default device-resident font in two ways:
3 by using the GDEVICE procedure to modify the value of the Chartype eld in the
Parameters window of your device entry. See Using the GDEVICE Procedure to Change the Default Device-Resident Font on page 1648 for more details. If your device has only one device-resident font (this is often the case), the Chartype eld has a value of 0.
Specifying a nonscalable device-resident font with the CHARTYPE= option might cause the SIMULATE font to be used. 4
In addition, the SIMULATE font is substituted if both of the following conditions are true.
3 The font selected with CHARTYPE= is not scalable. 3 The values of the HPOS= and VPOS= options do not match the values of the Rows
and Cols elds in the Chartype window.
1649
3 Note the number of the font that you want to use as the default font and go to the
Parameters window.
4 Enter the number of the font in the Chartype eld. 5 Close the window and exit the procedure.
Note: If you change the number in the Chartype eld in the Parameters window of the device entry, the change remains in effect until you change the entry again. 4 (See Chapter 38, The GDEVICE Procedure, on page 1125 for information on viewing device entries and changing device parameters.)
SAS allows up to 255 characters for the font name. The font name might contain spaces. If the font name is longer than 40 characters, PROC GDEVICE in fullscreen mode only displays the rst 37 characters, followed by an ellipsis (...). To see the complete font name when the name is longer than 40 characters, use PROC GDEVICE with the NOFS (no fullscreen) option as follows:
proc gdevice c=sashelp.devices nofs; list driver-name; run; quit;
When a font is quoted, SAS rst looks at the Chartype window of the device driver entry to determine whether it is a valid device-resident font. If the font is not found in the Chartype window, SAS then checks to determine whether the quoted font is a valid SAS/GRAPH font. If the font is not recognized as either a valid device-resident font or a valid SAS/GRAPH font, the SIMULATE font is used.
1650
Appendix 3
3 In the font specication, explicitly assign a device-resident font using the following
form: HWxxxnnn HW xxx identies the font as a device-resident font. The font name must begin with the characters HW. are the last two or three characters of the module name in the Module eld in the Detail window of your device entry. If the module name has eight characters (SASGDPSL, for example), use the last three characters (PSL). If the module name has only seven characters (SASGDVT, for example), use the last two characters (VT). is the Chartype number of the device-resident font that you want to use as listed in the Chartype window in the device entry. This value should be a three-digit decimal number, with leading zeros if necessary.
nnn
3 In the font specication, explicitly assign a device-resident font using the following
form: device-resident-font-name identies the name of the device-resident font that is listed in the Chartype window of the device entry. Device-resident-font-name must be enclosed in quotation marks and the maximum length is 256 characters. The specied font name is converted internally to the HWxxxnnn name. Note that in Annotate, the specied font name must be enclosed in both double quotes and single quotes (see Chapter 30, Annotate Dictionary, on page 669 for details).
3 Assign one of the fonts listed in the Chartype window of your device entry as the
default device-resident font with the CHARTYPE= graphics option. You can also change the default device-resident font by modifying the value of the Chartype eld in the Parameters window of your device entry. Then you can use FONT=NONE in your SAS/GRAPH procedure or statement to specify the new default device-resident font. When you specify FONT=HWxxxnnn or device-resident-font-name, the size of the character cells is determined by the values in the Rows and Cols elds in the Chartype window of the device entry. The values of the HPOS= and VPOS= options are ignored for the font. Consequently, the font retains its original proportions. In addition, with this method the font catalog is checked for proportional spacing information. This information is used by SAS/GRAPH to determine how much space to reserve for proportional text. See Chapter 15, Graphics Options and Device Parameters Dictionary, on page 329 for additional information.
1651
APPENDIX
4
Transporting and Converting Graphics Output
About Transporting and Converting Graphics Output 1651 Transporting Catalogs across Operating Environments 1651 Example of Transporting GRSEGs 1652 Example of Transporting Color Maps and Templates 1653 Example of Transporting Fonts 1653 Example of Transporting Device Attributes and Device Entries Converting Catalogs to a Different Version of SAS 1654
1654
1652
Appendix 4
created. Otherwise, when you use the GREPLAY procedure to list the graphics entries in the imported catalog, the procedure will list the entries in alphabetical order, rather than the order in which they were created. Note: Only the GREPLAY procedure can list catalog entries in the order they were created. All other procedures list entries in alphabetical order.
To export a catalog that contains groups of entries created using the GREPLAY procedure, you must use SELECT= in the PROC CPORT statement to select the names of the groups, rather than the names of individual graphs, to be included in the transport le. If you export the entire catalog without using SELECT=, the groups are not maintained in the catalog created when you import the transport le in the new host environment. When you use the CPORT procedure, messages in the SAS log identify the catalog entries that have been placed in the transport le. If the catalog entry was created by replaying several graphs into a template, the log messages list the names of all of the entries that contributed to the templated graph. 2 Move the transport le to the target machine, if necessary. You must move the transport le in binary format. If you do not move the transport le in binary format, the CIMPORT procedure cannot read the le you create. 3 Once you have moved the transport le to the target machine, import the transport le into a catalog in the new host environment using the CIMPORT procedure. The entries are imported in the order specied in SELECT= in the PROC CPORT statement used to create the transport le. The SELECT= option in the PROC CIMPORT statement does not affect the order of the imported entries.
Note: You must use the CIMPORT procedure from the current version of the SAS System. The CIMPORT procedure in a previous release cannot read a transport le created by the CPORT procedure in the current version. 4 For details on using the CPORT and CIMPORT procedures, see the Base SAS Procedures Guide.
Once the transport le has been moved to the new host environment using communications software or tape, the CIMPORT procedure creates a new catalog called MYLIB.GRAPHS on the new machine.
libname mylib "SAS-data-library"; filename tranfile "external-file";
4
proc cimport catalog=mylib.graphs infile=tranfile select=(GPLOT.GRSEG GPLOT1.GRSEG run;
1653
GPLOT3.GRSEG);
After moving the transport le to the new host environment, you can import the color map using the following statements:
filename tranfile "external-file"; libname newlib "SAS-data-library"; proc cimport infile=tranfile catalog=newlib.cmaps; run;
After moving the transport le to the new host environment, you can import the font using the following statements:
filename tranfile "external-file"; libname gfont0 "SAS-data-library"; proc cimport infile=tranfile catalog=gfont0.fonts; run;
1654
Appendix 4
After moving the transport le to the new host environment, you can import the device entry using the following statements:
filename tranfile "external-file"; libname gdevice0 "SAS-data-library"; proc cimport infile=tranfile catalog=gdevice0.devices; run;
Before using PROC CATALOG, you must assign librefs to both catalogs and specify the Version 6 Compatibility Engine (saseb) on the input catalog LIBNAME. Then use PROC CATALOG with a COPY statement to convert a catalog from Version 6 to Version 7 or later. For details on using the CATALOG procedure, see the Base SAS Procedures Guide. For example, the following statements can be submitted from Version 8 to assign the Version 6 Compatibility Engine and convert a catalog from Version 6 to Version 8.
libname v6lib saseb "SAS-data-library"; libname v8lib "SAS-data-library"; proc catalog catalog=v6lib.v6cat; copy out=v8lib.v8cat; run;
1655
APPENDIX
5
GREPLAY Procedure Template Code
Overview 1655 H2: One Box Left and One Box Right 1655 H2S: One Box Left and One Box Right with Space 1656 H3: Three Boxes Across 1656 H3S: Three Boxes Across with Space 1657 H4: Four Boxes Across 1657 H4S: Four Boxes Across with Space 1658 L1R2: One Box Left and Two Boxes Right 1658 L1R2S: One Box Left and Two Boxes Right with Space 1659 L2R1: Two Boxes Left and One Box Right 1659 L2R1S: Two Boxes Left and One Box Right with Space 1660 L2R2: Two Boxes Left and Two Boxes Right 1660 L2R2S: Two Boxes Left and Two Boxes Right with Space 1661 U1D2: One Box Up and Two Boxes Down 1662 U1D2S: One Box Up and One Box Down with Space 1662 U2D1: Two Boxes Up and One Box Down 1663 U2D1S: Two Boxes Up and One Box Down with Space 1663 V2: One Box Up and One Box Down 1664 V2S: One Box Up and One Box Down with Space 1664 V3: Three Boxes Vertically 1664 V3S: Three Boxes Vertically with Space 1665 Whole: Entire Screen Template 1665
Overview
This SAS/GRAPH code can be used to re-create the templates stored in SASHELP.TEMPLT. You can modify the code to create custom templates. For detailed information on using, creating, and modifying templates, refer to Chapter 50, The GREPLAY Procedure, on page 1465.
1656
H2S: One Box Left and One Box Right with Space
Appendix 5
tdef H2 des= "1 BOX LEFT, 1 BOX RIGHT" 1/llx=0 lly=0 ulx=0 uly=100 urx=50 ury=100 lrx=50 lry=0 color=black 2/llx=50 lly=0 ulx=50 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
H2S: One Box Left and One Box Right with Space
Start the GREPLAY procedure in line mode. The TC statement species the catalog where the template is stored. The TDEF statement denes the name and description of each catalog entry.
proc greplay tc=tempcat nofs; tdef H2S des="1 BOX LEFT, 1 BOX RIGHT (WITH SPACE)" 1/llx=0 lly=0 ulx=0 uly=100 urx=48 ury=100 lrx=48 lry=0 color=black 2/llx=52 lly=0 ulx=52 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
4
color=black 3/llx=66.6 lly=0 ulx=66.6 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
1657
1658
Appendix 5
color=black 3/llx=50 lly=0 ulx=50 uly=100 urx=75 ury=100 lrx=75 lry=00 color=black 4/llx=75 lly=0 ulx=75 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
4
1/llx=0 lly=0 ulx=0 uly=100 urx=50 ury=100 lrx=50 lry=0 color=black 2/llx=50 lly=50 ulx=50 uly=100 urx=100 ury=100 lrx=100 lry=50 color=black 3/llx=50 lly=0 ulx=50 uly=50 urx=100 ury=50 lrx=100 lry=00 color=black; quit;
1659
L1R2S: One Box Left and Two Boxes Right with Space
Start the GREPLAY procedure in line mode. The TC statement species the catalog where the template is stored. The TDEF statement denes the name and description of each catalog entry.
proc greplay tc=tempcat nofs; tdef L1R2S des= "1 BOX LEFT, 2 BOXES RIGHT (WITH SPACE)" 1/llx=0 lly=0 ulx=0 uly=100 urx=48 ury=100 lrx=48 lry=0 color=black 2/llx=52 lly=52 ulx=52 uly=100 urx=100 ury=100 lrx=100 lry=52 color=black 3/llx=52 lly=0 ulx=52 uly=48 urx=100 ury=48 lrx=100 lry=00 color=black; quit;
1660
L2R1S: Two Boxes Left and One Box Right with Space
Appendix 5
1/llx=0 lly=50 ulx=0 uly=100 urx=50 ury=100 lrx=50 lry=50 color=black 2/llx=0 lly=0 ulx=0 uly=50 urx=50 ury=50 lrx=50 lry=0 color=black 3/llx=50 lly=0 ulx=50 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
L2R1S: Two Boxes Left and One Box Right with Space
Start the GREPLAY procedure in line mode. The TC statement species the catalog where the template is stored. The TDEF statement denes the name and description of each catalog entry.
proc greplay tc=tempcat nofs; tdef L2R1S des= "2 BOXES LEFT, 1 BOX RIGHT (WITH SPACE)" 1/llx=0 lly=52 ulx=0 uly=100 urx=48 ury=100 lrx=48 lry=52 color=black 2/llx=0 lly=0 ulx=0 uly=48 urx=48 ury=48 lrx=48 lry=0 color=black 3/llx=52 lly=0 ulx=52 uly=100 urx=100 ury=100 lrx=100 lry=00 color=black; quit;
4
1/llx=0 lly=50 ulx=0 uly=100 urx=50 ury=100 lrx=50 lry=50 color=black 2/llx=0 lly=0 ulx=0 uly=50 urx=50 ury=50 lrx=50 lry=0 color=black 3/llx=50 lly=50 ulx=50 uly=100 urx=100 ury=100 lrx=100 lry=50 color=black 4/llx=50 lly=0 ulx=50 uly=50 urx=100 ury=50 lrx=100 lry=0 color=black; quit;
L2R2S: Two Boxes Left and Two Boxes Right with Space
1661
L2R2S: Two Boxes Left and Two Boxes Right with Space
Start the GREPLAY procedure in linemode. The TC statement species the catalog where the template is stored. The TDEF statement denes the name and description of each catalog entry.
proc greplay tc=tempcat tdef L2R2S des="2 BOXES LEFT, 2 BOXES RIGHT (WITH SPACE)" 1/llx=0 lly=52 ulx=0 uly=100 urx=48 ury=48 lrx=48 lry=52 color=black 2/llx=0 lly=0 ulx=0 uly=48 urx=48 ury=48 lrx=48 lry=00 color=black 3/llx=52 lly=52 ulx=52 uly=100 urx=100 ury=100 lrx=100 lry=52 color=black 4/llx=52 lly=0 ulx=52 uly=48 urx=100 ury=48 lrx=100 lry=0 color=black; quit;
1662
Appendix 5
DOWN"
1663
1664
Appendix 5
4
/* define panel 1 */ 1/llx=0 lly=66.6 ulx=0 uly=100 urx=100 ury=100 lrx=100 lry=66.6 color=black 2/llx=0 lly=33.3 ulx=0 uly=66.6 urx=100 ury=66.6 lrx=100 lry=33.3 color=black 3/llx=0 lly=0 ulx=0 uly=33.3 urx=100 ury=33.3 lrx=100 lry=00 color=black; quit;
1665
1666
Appendix 5
tdef WHOLE des="ENTIRE SCREEN TEMPLATE" 1/llx=0 lly=0 ulx=0 uly=100 urx=100 ury=100 lrx=100 lry=0 color=white; quit;
1667
APPENDIX
6
Recommended Reading
Recommended Reading
1667
Recommended Reading
Here is the recommended reading list for this title: 3 Annotate: Simply the Basics 3 The How-To Book for SAS/GRAPH Software
3 3 3 3 3 3 3
Multiple-Plot Displays: Simplied with Macros Output Delivery System: The Basics SAS Language Reference: Concepts SAS Language Reference: Dictionary SAS Output Delivery System: Users Guide SAS System for Statistical Graphics Visualizing Categorical Data
For a complete list of SAS publications, see the current SAS Publishing Catalog. To order the most current publications or to receive a free copy of the catalog, contact a SAS representative at SAS Publishing Sales SAS Campus Drive Cary, NC 27513 Telephone: (800) 727-3228* Fax: (919) 677-8166 E-mail: [email protected] Web address: support.sas.com/pubs * For other SAS Institute business, call (919) 677-8000. Customers outside the United States should contact their local SAS ofce.
1668
1669
Glossary
$GEOREF format
a geometric coordinate data arrangement that stores all the spatial information as a geometry object contained in a single variable. This format, which is used by feature tables, references the geometry objects that encapsulate the points, lines, and polygons necessary to render a map.
absolute coordinate
a Microsoft proprietary (COM) component used to display an interactive graph. The output is stored in a single le.
ActiveX control
a type of Web application that is developed specically for the Windows operating environment. ActiveX controls can provide Web users with interactive capabilities.
area bar chart
a bar chart that applies an additional magnitude of width to the bars that results in categorized bars each with a height measure and a width measure that can be independent of each other.
aspect ratio
the ratio of a shapes width to its height in an output area such as a display, plotter, or lm recorder.
attribute
a characteristic of a graphics element such as color, line type, text font, text justication, and ll pattern.
axis
a line with data values indicated by tick marks as a reference to a data value or range of values. Graphs can support more than one axis, in which case, the axes are usually perpendicular. Axis refers collectively to the axis line, the major and minor tick marks, the major tick mark values, and the axis label. See also Cartesian coordinate system.
axis area
an area bounded by axes. In SAS/GRAPH software, this area might be enclosed by an axis frame.
1670
Glossary
background
a plane on which graphics are displayed such that they appear behind or beneath objects in the foreground.
baseline
a three-dimensional map that uses blocks of varying heights to represent the value of a variable for each map area.
border
a line that is drawn around an entire graphics output area. This area usually includes the title and footnote areas as well as the procedure output area. See also frame.
boundary
in the GMAP procedure, a separating line or point that distinguishes between two or more unit areas or segments.
capline
the highest point of a normal uppercase letter. In some fonts, the capline might be above the top of the letter to allow room for an accent.
Cartesian coordinate system
the two- or three-dimensional coordinate system in which perpendicular axes meet at the origin (0,0) or (0,0,0). Typically, Cartesian coordinate axes are called X, Y, and Z.
cell
in traditional SAS/GRAPH procedures, a unit of measure that is dened by the number of rows and the number of columns in the graphics output area. In ODS Graphics, a cell refers to a distinct rectangular sub-region of a graph that contains plots, text, or legends. See also aspect ratio.
center point
the location in the GRAPH window that, in conjuction with a radius point, denes the placement and shape of an ellipse or a pie.
CGM
in SAS/GRAPH software, the angle at which a character is positioned. The character up vector has two components, x and y, which determine the angle.
chart
a graph in which graphical elements, such as bars or pie slices, represent a view of the data.
chart statistic
the statistical value calculated for the chart variable: frequency, cumulative frequency, percentage, cumulative percentage, sum, or mean.
chart variable
a variable in the input data set whose values are categories of data represented by bars, blocks, slices, or spines.
chart vertices
points on a radar chart where the statistical values intersect the spokes.
choropleth map
a two-dimensional map that uses color and ll pattern combinations to represent different categories or levels of magnitude.
Glossary
1671
classication variable
a variable that is used to group (or classify) data. A classication variable can be either character or numeric values. Classication variables include group, subgroup, category, and BY variables.
CMYK
A color coding scheme that species a color in terms of the levels of cyan, magenta, yellow, and black components. The level of each component ranges from 0 to 255.
color list
in SAS/GRAPH software, the list of foreground colors available for the graphics output. The color list is either the default list established from the style, the list created from the device entry, or the list established from the colors specied with the COLORS= graphics option.
color map
in SAS/GRAPH software, a table that is used to translate the original colors in graphics output to different colors when replaying graphics output using the GREPLAY procedure. The table is contained in a catalog entry.
color, predened
one of the set of colors for which SAS/GRAPH software denes and recognizes names (for example, BLACK, BLUE, and CYAN).
color, user-dened
a graphics output le written in the internationally recognized format for describing computer graphics images. This standardization allows any image in a CGM to be imported and exported among different systems without error or distortion. Short form: CGM.
condence limits
the upper and lower values of a (usually 95%) condence interval. In repeated sampling, approximately (1-alpha) 100% of the resulting intervals would contain the true value of the parameter that the interval estimates (where alpha is the condence level associated with the interval).
contour plot
a three-variable plot that uses line styles or patterns to represent levels of magnitude of z corresponding to x and y coordinates.
coordinate
a value that represents the location of a data point or a graphics element with respect to a coordinate system.
coordinate system
the context in which to interpret coordinates. Coordinate systems vary according to their origin, limits, and units.
data area
the portion of the graphics output area in which data values are displayed. The data area is bounded by axes or map areas. In the Annotate facility, the data area denes a coordinate system. See also graphics output area, procedure output area, and coordinate system.
data tip
data or other detailed information that is displayed when a user positions a mouse pointer over an element in a graph. For example, a data tip typically displays the data value that is represented by a bar, a plot point, or some other element.
1672
Glossary
density value
a value assigned to each observation in a map data set reecting the amount of detail (resolution) contributed by the observation.
dependent variable
a variable (response variable) whose value is determined by the value of another variable or by the values of a set of variables in a statistical model.
device driver
in SAS/GRAPH software, a routine that generates the specic machine-language commands needed to display graphics output on a particular device. SAS/GRAPH device drivers take device-independent graphics information produced by SAS/ GRAPH procedures and create the commands required to produce the graph on the particular device.
device entry
a SAS catalog entry that stores the values of device parameters (or the characteristics) that are used with a particular output device. A device entry is a SAS catalog entry of type DEV.
device map
a catalog entry used to convert the SAS/GRAPH internal encoding for one or more characters to the device-specic encoding needed to display the characters in hardware text on a particular graphics output device. See also hardware character set.
device parameter
a value in a device entry that denes a default behavior or characteristic of a device driver. Some device parameters can be overridden by graphics options. See also graphics option.
device-independent catalog entry
a SAS catalog entry that contains graphics output in a generic format (not device-specic). A device-independent catalog entry can be replayed on any device supported by SAS/GRAPH software. See also device-dependent catalog entry.
device-resident font
a le output by the Output Delivery System (ODS) that contains an image or is used to view an image. Examples include HTML, PDF, RTF, SVG, and PostScript les.
drill down
to select an element in an image in order to display additional information about that element, generally by displaying another Web page or another section in the same Web page.
end angle
for an ellipse, the measure in degrees from the major axis to the trailing edge.
export
in SAS/GRAPH software, to put a SAS catalog entry containing graphics output into a format that can be moved to another software product.
feature table
A SAS data set that uses the $GEOREF format to store geometric coordinates for each unique map area in a single variable value.
ll color
the color of a pattern in a lled, closed graphics object, such as a bar segment, a pie slice, or a map area.
Glossary
1673
font
a complete set of all the characters of the same design and style. The characters in a font can be gures or symbols as well as alphanumeric characters. See also type style.
font maximum
in the GFONT procedure, units dened by the range of coordinates specied in the font data set. For example, a font in which the vertical coordinates range from 10 to 100 has 90 font units.
font, device-resident
a font stored in the SASHELP.FONTS catalog, and a font created by the user and stored in a GFONTn catalog. These fonts can be used only by SAS/GRAPH procedures or other procedures that generate GRSEG output les. Examples of SAS/ GRAPH fonts include Swiss, Simulate, and Marker. These fonts are provided for specialized purposes only.
font, system
a font that can be used by any SAS procedure and by other software, such as Microsoft Word.
frame
in SAS/GRAPH software, a box enclosing a group of graphics elements. In GSLIDE procedure output, the frame encloses the procedure output area. In GPLOT, GCHART, GBARLINE, and GCONTOUR procedure output, the frame encloses the axis area. In a legend, the frame encloses the legend label and entries. See also border.
FreeType font-rendering
a method of rendering fonts that uses the FreeType engine to access the content of font les in order to render high-quality fonts for ODS and SAS/GRAPH. The FreeType engine can be used in all SAS operating environments.
geocoding
the process of adding geographic coordinates (latitude and longitude values) to an address. Each pair of coordinates can represent either the center of a region or a specic point.
geo-variable
in a feature table, the $GEOREF formatted variable that stores the spatial information as a geometry object. When a feature table is used, this variable is specied in the ID statement of the GMAP procedure.
global statement
a visual representation of data showing the variation of a variable in comparison to one or more other variables.
graphics element
a discrete visual part of a picture. For example, a bar in a chart and a plots axis label are both graphics elements.
1674
Glossary
graphics object
a discrete visual element of a graph or picture (for example, a bar in a chart, a polygon, a plots axis, and so on).
graphics option
in a SAS GOPTIONS statement, an option that controls some attribute of the graphics output. The specied value remains in effect only for the duration of the SAS session. Some graphics options override parameters that have been specied for a graphics output device.
graphics output
output from a graphics program that can be stored as a catalog GRSEG entry or as a graphics stream le. Graphics output can be displayed or printed on a graphics output device. See also device-dependent catalog entry, device-independent catalog entry, and graphics output device.
graphics output area
the area of a graphics output device where the graphics output is displayed or drawn. Typically, the graphics output area occupies the full drawing area of the device, but the dimensions of the graphics output area can be changed with graphics options or device parameters. See also procedure output area and graphics output device.
graphics output device
any terminal, printer, or other output device that is capable of displaying or producing graphical output.
graphics output le
a le that contains device-dependent graphics commands from a SAS/GRAPH device driver. This le can be sent to a graphics device or to other software applications. Short form: GSF.
gray scale
a color-coding scheme that species a color in terms of gray components. Gray-scale color codes are commonly used with some laser printers and PostScript devices.
grid point
a grid location in the GRAPH window that is marked by a dot. Grid points are used for precision placement of objects.
grid request
in the G3GRID procedure, the request specied in a GRID statement that identies the horizontal variables that identify the x, y plane and one or more z variables for the interpolation.
group variable
a variable in the input data set used to categorize chart variable values into groups.
GRSEG
a SAS catalog entry that contains graphic output in a generic format (not device-specic).
GSF
Glossary
1675
handshaking
the exchange of signals between two devices over an interface for control or synchronization purposes. Data ow control is needed to ensure that data are not sent faster than the receiving device can process them. Handshaking usually involves sending signals between the device and the host computer in order to start and stop transmission of data.
hardware (or hardwire) handshaking
a method of data ow control in which the ow of data between the computer and device is regulated by signals sent over separate wires in the connecting cable. See also handshaking.
hardware character set
a set of character denitions held internally in a graphics output device. When a hardware character set is used, SAS/GRAPH software does not have to send the device all the commands to draw characters, only the corresponding character codes. Some devices have more than one hardware character set. See also font and device-resident.
hatch
a color-coding scheme that species a color in terms of its hue, lightness, and saturation components. Hue is the color, lightness is the percentage of white, and saturation is the attribute of a color that determines its relative strength and its departure from gray. Lightness and saturation added to the hue produce a specic shade. See also RGB.
host computer
a method of rendering fonts that relies on the capabilities of the operating environment.
HSV (HSB)
a color-coding scheme that species a color in terms of its hue, saturation, and value (brightness) components. Hue is the color. Saturation is the aspect of a color that determines its relative strength and departure from gray. And value (brightness) is the colors departure from black.
identication variable
a variable common to both the map data set and the response data set that the GMAP procedure uses to associate each pair of map coordinates and each response value with a unique map area.
image le
a le that contains bitmapped graphic information. Examples include GIF, PNG, TIFF, and JPEG les. Image les are a subset of graphics output les.
image map
a diagram that associates graphic elements with HTML links to implement drill-down functionality. The graphic elements are represented by sets of coordinates. SAS/GRAPH software generates image maps on demand with the IMAGEMAP= option or with the IMAGEMAP macro.
import
to restore a SAS transport le to its original form (a SAS library, a SAS catalog, or a SAS data set) in the format that is appropriate for the host operating system. You
1676
Glossary
use the CIMPORT procedure to import a SAS transport le that was created by the CPORT procedure.
include
in the graphics editor, to read in or link to a graph other than the one currently being edited.
independent variable
in SAS/GRAPH software, a variable whose value, in part, determines the value of a dependent (or response) variable. In a plot, an independent variable typically appears on the X (or horizontal) axis.
interactive graph
SAS/GRAPH output that features user controls such as menus, buttons, and pictures that a user can manipulate. The controls are driven by a Java applet or an ActiveX control.
interpolate
a le format that is used for storing noninteractive images. If you generate a chart or graph in JPEG format, you cannot subsequently change its appearance. This format is best suited to complex graphics that have many colors, because it supports 16 million colors. Short form: JPEG.
JPEG
to position text in relation to the left or right margin or the center of the line.
key map
a SAS catalog entry used to translate the codes generated by the keys on a keyboard into their corresponding SAS/GRAPH internal character encoding. See also device map.
label
(1) descriptive text associated with a variable. By default, this text is the name of a variable or of a label previously assigned with the LABEL= option. (2) in special cases of pie charts and star charts in the GCHART procedure, the label is the midpoint value and the value of the chart statistics for a slice or spine.
latitude
used with maps, the angular measure between the equator and the circle of parallel on which a point lies.
legend
a visual key to graphic elements in a graph. The legend consists of the legend value, the legend value description, the legend label, and the legend frame.
link to
in the graphics editor, to include one graph into another by placing a template of that graph in the current graph. The template acts as a placeholder and can be resized; it creates a connection between the graph being edited and the linked-to graph such that any changes made to the linked-to graph are reected in the graph where a template is placed.
longitude
used with maps, the angular measure between the reference meridian and the plane intersecting both poles and a point. The reference meridian, called the prime
Glossary
1677
meridian, is assigned a longitude of 0, and other longitude values are measured from there in appropriate angular units (degrees or radians, for example).
major axis
the points on an axis that mark the major divisions of the axis scale. See also minor tick marks.
map
a graphic representation of an area. The area is often a geographic area, but it can also be any other area of any size. See also device map and key map.
map area
a polygon or group of polygons on a map. For example, states, provinces, and countries are typical map areas. In a map data set, a map area consists of all the observations that have the same values for the identication variable or variables. A map area is sometimes referred to as a unit area. See also identication variable.
map data set
a SAS data set that contains information that the GMAP procedure uses to draw a map. Each observation in the data set contains variables whose values are the x, y coordinates of a point on the boundary of a map area. In addition, each observation contains an identication variable whose value identies the map area that the point belongs to.
mapping
a symbol such as a dot, a cross, or a diamond, that is used to indicate the location of a data point on a plot or graph.
meridian
an imaginary circle of constant longitude around the surface of the earth perpendicular to the equator. See also parallel.
metale
a le, produced by the Metagraphics facility internal driver, that contains device-independent graphics commands in a special format. A user-written external driver routine is required to read and process the metale.
Metagraphics driver
a type of SAS/GRAPH device driver that can be written by users. A Metagraphics driver consists of an internal driver (supplied with SAS/GRAPH software), which writes a metale in a special format, and an external driver (written by the user), which decodes the metale and writes device-specic commands.
midpoint
the divisions of an axis scale that fall between major tick marks. See also major tick marks.
needle plot
a plot in which data points are connected by a vertical line which connects to a horizontal baseline. The baseline intersects the 0 value, or the minimum value on the vertical axis.
1678
Glossary
node
a connection point between two or more links. In a node-line graph, nodes are typically represented as a box and enable you to access information and possibly to traverse the graph by drilling up or down in the structure.
offset
the distance between a graphics objects original position and its new position when it is moved. Offsets can be specied for legends, axes, an entire graph, or other graphics object.
origin
in a three-dimensional graph, the point at which the X, Y, and Z axes intersect. In a two-dimensional graph, the point at which the X and Y axes intersect.
panel
in the GREPLAY procedure, a part of the template in which one or more pictures can be displayed. A template can contain one or more panels.
parallel
an imaginary circle of constant latitude around the surface of the earth parallel to the equator. See also meridian.
pattern type
in SAS/GRAPH software, the set of ll patterns that are valid for a particular type of graph. The PATTERN statement supports three pattern types: bar and block patterns, map and plot patterns, and pie and star patterns. See also ll pattern.
pie chart
a circular chart that is divided into slices by radial lines. Each slice represents the relative contribution of each part to the whole.
pixel
an element of an electronic image. A pixel is the smallest element on a display that can be assigned a separate color.
plot
a graph in which graphics elements such as markers or lines represent a view of the data. See also coordinates.
plot line
a class of graphics devices that typically use pens to draw hard-copy output.
PNG
a SAS/GRAPH font in which the characters are drawn with enclosed areas that can be either lled or empty. See also stroked font.
polyline
in SAS/GRAPH software, a graphics object composed of connected line segments that might have attributes. A polyline is not a closed object; therefore, it cannot be lled with a pattern.
Portable Network Graphic
a le format that returns the graphical output in separate les and that produces a static image. This format is similar to the GIF format, but has additional features, such as support for true-color images and better compression. Short form: PNG.
Glossary
1679
PostScript
a device-independent page description language for printing high-resolution integrated text and graphics.
prism map
a three-dimensional map that uses prisms (polyhedrons with two parallel surfaces) of varying height to indicate the ordinal magnitude of a response variable.
procedure output area
the portion of the graphics output area where the output from a graphics procedure is displayed. See also graphics output area and data area.
projection
in SAS/GRAPH software, a two-dimensional map representation of unit areas on the surface of a sphere (for example, geographic regions on the surface of the Earth).
prompt character
a character sent by the host computer to a device to signal that the host has nished transmitting data and is ready for a response from the device.
protocol
a set of rules that govern data communications between computers and peripheral devices.
radar chart
a chart that shows the relative frequency of data measures with statistics displayed along spokes that radiate from the center of the chart. The charts are often stacked on top of one another with circular reference lines, thus giving them the look of a radar screen. See also star chart.
rasterizer
a device that accepts commands (such as moves and draws) as input and that converts those commands into a bit-map. Rasterizers are connected between host computers and graphics output devices that require bitmapped input.
region
in the graphics editor, an area in the GRAPH window containing more than one graphics objects.
regression analysis
an analysis that models a dependent (or response) variable as a function of one or more independent (or predictor) variables. The regression line, which is the set of predictions from the model, appears as a line or curve in a plot of the dependent variable against an independent variable.
relative coordinate
a coordinate that is measured from a point other than the origin. In the Annotate facility, this point is usually the endpoint of the last graphics element that was drawn. See also absolute coordinate.
replay
in SAS/GRAPH software, to display graphics output that is stored in a catalog entry using the GREPLAY procedure.
response data set
a SAS data set used by the GMAP procedure that contains data values associated with map areas and one or more identication variables. See also identication variable, response values, and response variable.
response levels
the individual values or ranges of values into which the GMAP or GCHART procedure divides the response variable. See also midpoint.
1680
Glossary
response values
values of a response variable that the GMAP procedure represents on a map as different pattern/color combinations, or as raised map areas (prisms), spikes, or blocks of different heights. The GCHART procedure represents response values as bars, slices, spines, or blocks. See also midpoint.
response variable
(1)in the GMAP procedure, a variable in the response data set that contains data values that are associated with a map area. (2) In the GCHART, GBARLINE, and GCONTOUR procedures, a variable whose value is determined by the value of another variable or by the values of a set of variables. See also chart variable, response data set, response levels, and response values.
RGB
a color-coding scheme that species a color in terms of amounts of red, green, and blue components. See also HLS.
SAS/GRAPH font
a font stored in the SASHELP.FONTS catalog, and a font created by the user and stored in a GFONTn catalog. These fonts can be used only by SAS/GRAPH procedures or other procedures that generate GRSEG catalog entries. Examples of SAS/GRAPH fonts include Swiss, Simulate, and Marker. These fonts are provided for specialized purposes only.
scatter plot
a two- or three-dimensional plot that shows the joint variation of two (or three) variables from a group of observations. The coordinates of each point in the plot correspond to the data values for a single observation.
segment
in the GMAP procedure, a polygon that is a part of a unit area consisting of more than one polygon. For example, the representation of the state of Hawaii is a single unit area which consists of a group of individual segments representing the islands, each of which is a separate polygon. In the GFONT procedure, a segment is a single continuous line that forms part of all of a character or symbol. In the DATA Step Graphics Interface (DSGI), a segment is one or more graphics primitives that can be manipulated as a unit.
select
in the graphics editor, to choose an action or a graphics object. Once a graphics object has been selected, it can be copied, deleted, or otherwise manipulated.
snap
in the graphics editor, to automatically place graphics objects in the grid display area with precision.
software handshaking
a method of data ow control in which a device and a computer exchange predened sequences of characters to indicate when data should be transmitted between the two. See also handshaking and hardware (or hardwire) handshaking.
spine
a line on a star chart used to represent the relative value of the chart statistic for a midpoint. Spines are drawn outward from the center of the chart.
spline
in SAS/GRAPH software, a method of interpolation in which a smooth line or surface connects data points.
Glossary
1681
spokes
lines that radiate from the center of a radar or star chart. These lines represent statistical information.
standard deviation
a statistical measure of the variability of a group of data values. This measure, which is the most widely used measure of the dispersion of a frequency distribution, is equal to the square root of the variance.
star chart
a chart that shows the values of chart statistics as either spines of varying lengths or slices of varying sizes. Star charts display statistics in a circle surrounding the spines or slices. See radar chart.
static graph
in SAS/GRAPH software, a font in which the characters are drawn with discrete line segments or circular arcs. See also polygon font.
style attribute
A visual property such as color, font properties, and line characteristics that have reserved names and values dened in ODS. Style attributes are collectively referenced by a style element.
subgroup variable
the variable in the input data set for a chart that is used to proportionally ll areas of the bars or blocks on a bar chart, or to identify separate rings of a pie chart.
summary variable
a variable in an input data set whose values some SAS/GRAPH procedures total or average to produce the sum or mean statistics, respectively.
surface map
a three-dimensional map that uses spikes of varying heights to indicate levels of relative magnitude.
surface plot
a three-dimensional graph that displays a grid-like surface formed by the values of the vertical (Z) variable plotted on a plane specied by the X and Y variables.
system font
a font that can be used by any SAS procedure and by other software, such as Microsoft Word. These fonts include TrueType and Type1 fonts. Examples of system fonts include Albany AMT, Monotype Sorts, and Arial. Some system fonts, such as Helvetica, can also be present as device-resident fonts. System fonts generally provide the highest quality output.
template
(1) in the GRSEG graphics editor, a representation of a graph being linked to; a template is considered a single graphics object. (2) in the GREPLAY procedure, a framework that enables you to display one or more pictures on a page. (3) in ODS graphics (template-based graphics), a description of how output should appear when it is formatted.
templated graph
(1) in the GRSEG graphics editor, the graph to which a template links. (2) in the GREPLAY procedure, graphics output that is created by replaying one or more catalog entries of type GRSEG (graphics output) into panels in a template.
1682
Glossary
thumbnail
Tagged Image File Format. An industry-standard le format for storing compressed images. The Tagged Image File Format species compression routines and le formats for a variety of image types, including bilevel, grayscale, and color.
tile chart
a graph that represents the relative values of data by using rectangular areas. The color of each area represents the value of one measure in the query. The size of each area represents the value of the another measure in the query. The academic term for a tile chart is treemap.
tilt angle
the measure in degrees from the horizontal axis to the major axis of an object.
tool palette
in the graphics editor, the collection of icons that represent functions in the interface.
traditional map data set
a map data set that denes the boundaries of map areas by using X and Y coordinates. Each observation contains an identication variable whose value identies the map area for that point. See also identication variable, map area, map data set, and spatial map data set.
transformation
in the DATA Step Graphics Interface (DSGI), a mapping of the window coordinates to the viewport coordinates.
translate
a typeface design and its variations (for example, Swiss, Swiss Bold, and Swiss Italic). See also font.
unit
a single quantity of measuremen. In SAS/GRAPH software, units can have one of the following scales assigned: centimeters, percentages, points, inches, or cells.
unit area
the colors that can be dened using SAS color names, RGB (red, green, blue), HLS (hue, lightness, saturation), or gray-scale color equivalents.
viewport
in the DATA Step Graphics Interface (DSGI), a section of the display into which you place graphics elements or graphics output.
Web server
a server machine and software that enable organizations to share information through intranets and through the Internet.
window
in the DATA Step Graphics Interface (DSGI), a coordinate system that is used with a viewport and that can be dened by the user.
XON/XOFF handshaking
a method of data ow control in which the ow of data between a computer and a device is regulated by the transmission of XON (DC1) and XOFF (DC3) control characters between the device and the computer.
1683
Index
# (pound sign), variables as plot point labels 265 ? statement GREPLAY procedure 1474 special fonts and symbols 461 uninstalling 459 ActiveX control le (.exe le) location of 488 ACTIVEX device 93 when to use 456 ACTIVEX device driver 452 ActiveX devices 73 ActiveX parameters and attributes 487 ActiveX support 1594 Annotate functions 1627 AXIS statement 1594 G3D procedure 1625 GAREABAR procedure 1604 GBARLINE procedure 1605 GCHART procedure 1607 GCONTOUR procedure 1612 GMAP procedure 1614 GOPTIONS statement 1596 GPLOT procedure 1617 GRADAR procedure 1622 LEGEND statement 1600 PATTERN statement 1601 SYMBOL statement 1602 TITLE and FOOTNOTE statements 1604 ACTUAL= argument GKPI procedure 1217 ACTXIMG device 94, 456 ACTXIMG device driver 448, 452 GIF, JPEG, SVG, PNG vs. 508 sample programs for static images 514 Web presentations, developing 512 ADD statement GDEVICE procedure 1130 additional fonts 154 address data sets 1147 abbreviations for states 1158 city names 1157 non-address input values 1158 ZIP + 4 extensions 1157 ZIP code variables 1158 ADDRESSCITYVAR= option PROC GEOCODE statement 1157 addresses coordinates associated with 1158 ADDRESSPLUS4VAR= option PROC GEOCODE statement 1157 ADDRESSSTATEVAR= option PROC GEOCODE statement 1158
Numbers
3-D charts 3-D bar charts 202 3-D pie charts 8 3-D vertical bar charts subgrouping 1073
A
A= option AXIS statement 208, 293 TITLE, FOOTNOTE, and NOTE statements 280, 293 abbreviations for states 1158, 1159 access permissions, browsers 638 ACROSS= option CHART statement (GRADAR) 1414 LEGEND statement options 225 PIE, PIE3D, DONUT statements (GCHART) 1041 STAR statement (GCHART) 1057 ACROSSVAR= option CHART statement (GRADAR) 1414 ACTION= macro argument 581 active color lists 1211, 1212 ACTIVECOLORS= option GKPI procedure 1217 ActiveX Control 442, 455 authentication 639 drill-down links 462 drill-down tags 610 embedded graphics in Microsoft Word 463 examples 463 formats supported by 461 generating interactive output for 455 generating output for 459 installing 457 installing manually 457 interactive contour plots 465 internationalization 460 JavaScript drill-down with 466, 468 languages 460 procedures and statements generating output for 456 prompting users to install 458 prompts for installing 458
1684
Index
ADDRESSVAR= option PROC GEOCODE statement 1158 ADDRESSZIPVAR= option PROC GEOCODE statement 1158 admgdf 332 ADMGDF option 332 AFONT= option GKPI procedure 1217 Africa outline map of 1460 AFTER argument MOVE statement (GREPLAY) 1483 AHUNITS= macro argument 571 Albers equal-area projection 1390 clipping map areas 1404 default projection specications 1399 projection criteria 1398 specifying 1396 when to use 1397 ALIGN= macro argument 572 alignment axis labels 199, 206, 207, 209 axis values 209 character cells 338 legend labels 226 legend text 231, 232 legend values 231 legends 229, 235 plot print labels 265 text in graphics output 285 ALL option PROC GMAP statement 1243 _ALL_ option LIST statement (GDEVICE) 1134 ALL option, GMAP statement 217 ALT= macro argument 572 alternative device-resident fonts 1649 AMBIENT= parameter, JAVA and ActiveX 493 anchors 237, 325 angle, rotation angling text in pie charts 797 axis labels 199, 206, 207, 208 hardware text rotation 401 landscape orientation of graphics output area 393, 394, 420 portrait orientation of graphics output area 403, 415, 420 print orientation 420 printing orientation 420 text in graphics output 280, 286, 289 text in pie charts 797 ANGLE= macro argument 581 ANGLE= option AXIS statement 208, 293 PIE, PIE3D, DONUT statements (GCHART) 1041 STAR statement (GCHART) 1057 TITLE, FOOTNOTE, and NOTE statements 280, 293 angle rotation donut chart labels 1051, 1052 ANGLE= suboption LABEL= option, DONUT statement (GCHART) 1051 ANGLE variable, Annotate facility 703 animated GIFs creating with BY-group processing 524 creating with GREPLAY procedure 529 creating with RUN-group processing 526
animated sequences body of 522 creating 522 header for 522 trailer 522 animation 449, 521 delay between graphs 349 graphics options for 523 repeating as loop 392 ANNO= option GSLIDE procedure 1511, 1516 %ANNOMAC macro, Annotate facility 741 ANNOTATE= argument PROC GANNO statement 914 annotate data sets projecting 1405 Annotate data sets 643, 656 applying to web output 542 missing values 657 observation and structure of 645 producing graphics output 657 producing multiple graphs 921 scaling data-dependent output 916 Annotate DATA step 34 Annotate facility 22, 644, 671 ActiveX and Java support for 1627 coordinates 652 debugging 660 drill-down links, generating 542 DSGI vs. 770 error messages, list of 762 examples 653 functions 649, 671 graphic elements and formatting 651 images, displaying 185 in text slides 1510, 1516 internal coordinates 740 macros, how to use 760 macros for 741, 760 processing details 658 projecting annotate data sets 1405 scaling graphs 916 variables 647, 655, 658, 702 Web output, generating 541 Annotate graphics in drill-down graphs 925 storing 919 Annotate macro data set 29 Annotate macros 657 ANNOTATE= option 542, 657 BAR statement (GBARLINE) 961 BLOCK statement (GCHART) 1007 BLOCK statement (GMAP) 1251 BUBBLE statement (GPLOT) 1326 CHART statement (GRADAR) 1414 CHORO statement (GMAP) 1260 G3D procedure 1539 GSLIDE procedure 1511, 1516 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 PIE, PIE3D, DONUT statements (GCHART) 1041 PLOT statement (G3D) 1540 PLOT statement (GCONTOUR) 1101 PLOT statement (GPLOT) 1339 PRISM statement (GMAP) 1267 PROC GBARLINE statement 958
Index 1685
PROC GCHART statement 1004 PROC GCONTOUR statement 1099 PROC GMAP statement 1243 PROC GPLOT statement 1322 PROC GRADAR statement 1411 PROC statement 218 SCATTER statement (G3D) 1547 STAR statement (GCHART) 1057 SURFACE statement (GMAP) 1276 annotating values from GINSIDE procedure 1198 appearance differences between devices 640 appearance of graphs 131 graphical style element reference for device-based graphics 142 modifying styles 140 overriding style attributes 138 precedence of appearance option specications 139 specifying styles 137 style attributes versus device entry parameters 132 style templates 133 turning off styles 151 viewing list of styles provided by SAS 139 APPLET element (HTML), macro arguments for 571 APPLETLOC= system option 489 arc-drawing capability, device 341 ARC function (DSGI) 856 ARCHIVE= macro argument 572 ARCHIVE= option 488 arcs drawing with Annotate facility 691, 692 drawing with DSGI 856 writing in, DSGI for 864 area bar charts 10, 931 ActiveX and Java support for 1604 generating 938 with numeric chart variable 940 with subgroups 942 with subgroups and variable percentages 944 area boundaries unmatched 1439, 1451 AREA element (HTML) 326 AREA= option BLOCK statement (GMAP) 1251 PRISM statement (GMAP) 1267 AREA statement GMAP procedure 1245 areas, Annotate graphics 652 AREAS= option PLOT statement (GPLOT) 1340 AREAS= option, PLOT statement 1370 ARROW function, Annotate facility 672 %ARROW macro, Annotate facility 742 ASCENDING option BAR statement (GBARLINE) 962 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 PIE, PIE3D, DONUT statements (GCHART) 1041 PLOT statement (GBARLINE) 976 STAR statement (GCHART) 1058 ASCII-to-EBCDIC translation 429 ASF function (DSGI) 817, 873 ASIS option PROC GPROJECT statement 1394 aspect 333 ASPECT function (DSGI) 819, 874
ASPECT= option 333 aspect ratio 333 attributes, JAVA and ActiveX parameters and attributes ATTRIBUTES= option, ODS statements 487 ATTRIBUTEVAR= option PROC GEOCODE statement 1158 audience for presentations, considering 451 autocopy 334 AUTOCOPY option 334 AUTOFEED 335 AUTOFEED option 335 AUTOHREF option BUBBLE statement (GPLOT) 1326 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 AUTOLABEL option PLOT statement (GCONTOUR) 1102 AUTOLABEL= suboptions PLOT statement (GCONTOUR) 1109 automatic data set locking 56 automatic paper feed 335, 398 AUTOREF option BAR statement (GBARLINE) 962 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 PLOT statement (GBARLINE) 977 AUTOREF option, AXIS statement options 209 AUTOSIZE 335 AUTOSIZE= graphics option 335 AUTOVREF option BUBBLE statement (GPLOT) 1326 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 AVALUE option GKPI procedure 1218 AWUNITS= macro argument 576 axes 197 bar-line charts 949 chart statistic and response axis 974 color of 957, 962, 977 color of, bar charts 1038 color of, block charts 1015 colors 1102, 1327, 1341, 15 contour plots 1112 ll color 962 frame around axis area 966 labels 199, 206 line type 207 logarithmic 200, 296, 974, 1036, major tick mark values 971, 980 midpoint axis 968 offset 203 origins 205 plots with two vertical axes 1318, 1355, 1360 suppressing 970, 979, 1030, 1107 suppressing, NOAXES option for 1542, 1549 suppressing, NOAXIS option for 1542, 1549 surface and scatter plots 1537 tick marks 201, 202 tick marks, ordering 294 AXIS 197 AXIS denitions displaying values of 1309 AXIS option PROC GOPTIONS statement 1311 BAR statement (GBARLINE) 971
487
1686
Index
BLOCK statement (GCHART) 1012 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019, 1033 PLOT statement (GBARLINE) 980 AXIS statement 33, 195, 197 ActiveX and Java support for 1594 assigning AXIS denitions 213 logarithmic axes 296 ordering datetime tick marks 294 text description suboptions 212 using 213 AXIS1= option GRID statement (G3GRID) 1570 AXIS2= option GRID statement (G3GRID) 1570
B
background color graphics output area 337 image transparency 428 legends 225 text in graphics output 282 background images 180, 388, 390 BACKGROUNDCOLOR= parameter, Metaview Applet 536 backplane images 182 bar 673 %BAR, %BAR2 macro, Annotate facility 743 bar charts 7, 991 See also area bar charts See also bar-line charts See also horizontal bar charts See also vertical bar charts 3-D plane 202 adding images 1038 drill-down functionality in 620 group brackets on axis 202, 1031 horizontal 991, 1016 horizontal, error bars in 1079 horizontal, midpoints and statistics in 1076 images on bars of 183 ordering and selecting midpoints 1037 outlines 1037 patterns 1038 patterns, outlines, and colors 239, 240 plane 1031 specifying sum statistic 1071 subgroup labels 663 subgrouping a 3-D vertical chart 1073 terminology 996 vertical 991, 1016 with Web drill-down (example) 321 BAR function, Annotate facility 673, 1627 BAR function, DSGI 857 bar-line charts 10, 948 ActiveX and Java support for 1605 adding images to 957 axes 949 creating 982 displaying statistics in 974 parts of 949 plot overlays 975 vertical 959 BAR statement, GBARLINE procedure 959, 1605 chart statistic and response axis 974
displaying statistics 974 logarithmic axes 974 options 961 ordering and selecting midpoints 975 required arguments 961 syntax 960 bars order of 962, 964 outline width 973 subgrouping 972, 986 width of 973 bars, drawing with DSGI 857 Base SAS language statements 35 baseline 1166 baseline, text in graphics output 280, 286 rotating characters from 289 underlining 291 BASELINE= option FLOW, TILE, TOGGLE statements (GTILE) 1523 PROC GFONT statement 1173 basic mode GKPI procedure 1206, 1215 batch mode 53 BC= option, TITLE, FOOTNOTE, and NOTE statements 282, 293 BCOLOR= option BUBBLE statement (GPLOT) 1326 TITLE, FOOTNOTE, and NOTE statements 282, 293 BDCLASS= macro argument 587 BEFORE argument MOVE statement (GREPLAY) 1483 BEGINRANGEVAR= option PROC GEOCODE statement 1158 BFILL= option BUBBLE statement (GPLOT) 1326 BFONT= option BUBBLE statement (GPLOT) 1326 GKPI procedure 1218 BG= macro argument 587 BGTYPE= macro argument 587 BINDING 336 BINDING= option 336 Bitstream fonts, rendering 364, 417, 1635 spacing between letters 366 bivariate interpolation 1566 BL= option, TITLE, FOOTNOTE, and NOTE statements 293 BLABEL option BUBBLE statement (GPLOT) 1327 black and white, reversing 423 BLANK= option, TITLE, FOOTNOTE, and NOTE statements 282, 293 blanks removing from data values 613 block charts 7, 990 creating 1005 grouping and subgrouping 1068 negative or zero values 1015 patterns, outlines, and colors 1014 sum statistic in 1066 text 1015 block effects for legends 225, 236 block maps 17, 1230 annotating 1251 bars and regions relative to zero 1256 color for empty map areas 1252
Index 1687
color for legend text 1253 color for outlining blocks 1251 color for outlining empty map areas 1252 color for outlining non-empty map areas 1252 color for regions 1245 creating 1249 description for catalog entry 1253 distinct colors for response values 1253 drill down 1253 drill-down legend 1253 legends 1254 midpoint ranges 1255 midpoints 1254 missing values 1255 name of GRSEG catalog entry 1255 patterns 1251, 1258 percentages 1255 percentages, overriding default format 1256 physical dimension of 1257 producing a simple map 1291 response levels 1254, 1292 shape of blocks 1256 statistics 1256 stretching 1256 suppressing legends 1248, 1255 uniform legend and coloring 1257 viewing position 1257 width of blocks 1251 width of outlines 1257 BLOCK statement GCHART procedure 1005 GMAP procedure 1249 BLOCK statement, GCHART procedure ActiveX and Java support for 1607 BLOCK statement, GMAP procedure ActiveX and Java support for 1614 BLOCKMAX= option BLOCK statement (GCHART) 1007 BLOCKMAX= option, BLOCK statement 217 BLOCKSIZE= option BLOCK statement (GMAP) 1251 BO= option, TITLE, FOOTNOTE, and NOTE statements 282, 293 bookmarks PDF graphs 122, 123 BORDER 336 BORDER= graphics option 336 BORDER= macro argument 582 BORDER option, GSLIDE procedure 1511, 1513 borders Annotate facility to draw 681 graphics output area 337, 1513 legends 225 removing from maps 1449 boundaries removing internal boundaries from maps 1449 removing state boundaries from U.S. map 1455 unmatched area boundaries 1439, 1451 boundary points 1437 boundary values GKPI procedure 1209 BOUNDS= argument GKPI procedure 1217 BOX= option, TITLE, FOOTNOTE, and NOTE statements 282, 293
box plots 252, 254 creating and modifying (example) 301 line width 269 boxes around graphics output text 282, 283 brackets, bar charts 202 browse mode GDEVICE procedure 1129 BROWSE option PROC GDEVICE statement 1129 browser permissions 638 browsers supporting SVG 83 BRTITLE= macro argument 587 BS= option, TITLE, FOOTNOTE, and NOTE statements 283, 293 BSCALE= option BUBBLE statement (GPLOT) 1327 BSIZING= option BUBBLE statement (GPLOT) 1327 BSPACE= option, TITLE, FOOTNOTE, and NOTE statements 283, 293 bubble plots 15, 1317 adding right vertical axis (example) 1360 controlling bubble display 1333 creating 1324 generating simple bubble plots (example) 1357 labeling and sizing plot bubbles (example) 1358 BUBBLE statement, GPLOT procedure 1324 ActiveX and Java support for 1617 coordinating with BUBBLE2 statements 1335 generating simple bubble plots (example) 1357 labeling and sizing plot bubbles (example) 1358 options 1325 required arguments 1325 syntax 1324 BUBBLE2 statement, GPLOT procedure 1333 ActiveX and Java support for 1617 adding right vertical axis (example) 1360 coordinating with BUBBLE statements 1335 options 1335 required arguments 1334 syntax 1334 bullet graph KPI charts 1204 gray scale 1222 bundling attributes, DSGI 789 BVALUE option GKPI procedure 1218 BWIDTH= option, SYMBOL statement 252 BY 214 BY-group processing creating animated GIFs with 524 creating multiple-page PDF les 127 BY lines 215 BY statement 196, 214 Annotate facility with 659 color of BY lines 338 fonts FOR BY lines 360 generating chart series (example) 309 GREMOVE procedure 1454 height of BY lines 383 RUN-group processing with 57 using 216 BYLINE option PROC GREPLAY statement 1471 #BYLINE option, text string specications 290
1688
Index
BYLINE statement GREPLAY procedure 1474 #BYVAL option, text string specications 290 #BYVAR option, text string specications 290, 293
C
C= option AXIS statement options 198, 209, 212 LEGEND statement options 231 POINTLABEL= specication 264 SYMBOL statement 253, 274 TITLE, FOOTNOTE, and NOTE statements 283 calendar charts 1434 CALENDAR option CHART statement (GRADAR) 1414 Canada Province Codes 1279, 1298 reducing map of 1445 capline 1166 CAPLINE= option PROC GFONT statement 1174 carriage return at record ends 371 Cartesian coordinates 1385 clipping map areas 1404 default projection specications 1399 emphasizing map areas 1402 GPROJECT procedure 1397 input map data sets 1387 map projection types 1389 projecting annotate data sets 1405 projecting spherical coordinates into 1385 Cartographic font 1642 catalog entries 1467 BY line 216 copying or duplicating 1491 description of 964 duplicate entry names 1468 managing 1497 replaying 1497 CATALOG function (DSGI) 819, 874 CATALOG= option PROC GDEVICE statement 1129 catalogs adding device entries to 1130 deleting device entries from 1133 device catalogs 1126 managing 1496 CATEXT= macro argument 582 CAUTOHREF= option BUBBLE statement (GPLOT) 1327 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 CAUTOREF= option BAR statement (GBARLINE) 962 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 PLOT statement (GBARLINE) 977 CAUTOVREF= option BUBBLE statement (GPLOT) 1327 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 CAXIS= option BAR statement (GBARLINE) 962 BLOCK statement (GCHART) 1007 BUBBLE statement (GPLOT) 1327
CHART statement (GRADAR) 1414 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 PLOT statement (G3D) 1540 PLOT statement (GBARLINE) 977 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 SCATTER statement (G3D) 1547 CBACK 337 CBACK function (DSGI) 820, 875 CBACK= macro argument 582 CBACK= option 337 CBLKOUT= option BLOCK statement (GMAP) 1251 CBLOCK= option, LEGEND statement 225, 236 CBODY= option SURFACE statement (GMAP) 1276 CBORDER= option, LEGEND statement options 225 CBORDER variable, Annotate facility 703 CBOTTOM= option PLOT statement (G3D) 1541 CBOX variable, Annotate facility 704 CBY 338 CBY= graphics option 338 CC argument ? statement (GREPLAY) 1474 LIST statement (GREPLAY) 1482 CC= option PROC GREPLAY statement 1471 CC statement GREPLAY procedure 1475 CCOPY statement GREPLAY procedure 1475 CDEF statement GREPLAY procedure 1476 CDEFAULT= option BLOCK statement (GMAP) 1252 CHORO statement (GMAP) 1260 PRISM statement (GMAP) 1268 CDELETE statement GREPLAY procedure 1477 CELL 338 CELL option 338 cells changing size of 63 in device display area 62 in graphics output area 62 CEMPTY= option BLOCK statement (GMAP) 1252 CHORO statement (GMAP) 1261 PRISM statement (GMAP) 1268 CENTER= macro argument 588 CENTIMETERS option PROC GOPTIONS statement 1311 %CENTROID macro, Annotate facility 744 CERROR= option BAR statement (GBARLINE) 962 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1019 CFILL= option PIE, PIE3D, DONUT statements (GCHART) 1042 STAR statement (GCHART) 1058 CFRAME= option BAR statement (GBARLINE) 962 BUBBLE statement (GPLOT) 1328 CHART statement (GRADAR) 1415
Index 1689
GSLIDE procedure 1512, 1513 HBAR, HBAR3D, VBAR, VBAR3D statements 935 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1020 LEGEND statement options 225 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 CFRAMESIDE= option CHART statement (GRADAR) 1415 CFRAMETOP= option CHART statement (GRADAR) 1415 CFREQ option BAR statement (GBARLINE) 962 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1020 CFREQLABEL= option HBAR, HBAR3D statements (GCHART) 1020 CGM lter default for Microsoft Ofce 118 CGM transparency limitation Microsoft Ofce 117 CHANDLE= macro argument 582 character cells 62 alignment 338 size of 335 character chart variables 998 character codes 158 displaying 1189 character formats supported by ACTIVEX 461 character midpoints 950 character response variables 1239 character transcoding 595 characters as axis values 204 as legend values 228 HTML entities 638 prexing output records 380 prompts 413 special plot symbols 267 CHARACTERS 339 CHARACTERS option 339 CHARREC 340 CHARREC= option, GDEVICE procedure 340 CHARSET= macro argument 595 CHARSPACETYPE= option PROC GFONT statement 1174 CHART statement GRADAR procedure 1412 CHART statement, GRADAR procedure ActiveX and Java support for 1622 chart statistics 953 cumulative frequency 953 cumulative percentage 953 frequency 953 GBARLINE procedure 953 GCHART procedure 996, 1000 mean 953 percentage 953 response axis and 974, 1036 specifying 973 sum 953 weighted statistics 954 chart variables bar-line charts 950 character 998
GAREABAR procedure 932 GCHART procedure 996, 997 GTILE procedure 1519 midpoints and 950 numeric 940 charts 7 See also area bar charts See also bar charts See also bar-line charts See also block charts See also donut charts See also GCHART procedure See also KPI charts See also pie charts See also radar charts See also star charts See also tile charts calendar charts 1434 windrose charts 1424, 1433 CHARTYPE 340 CHARTYPE= graphics option 340, 1648 Chartype window (GDEVICE) 1139 CHORO statement GMAP procedure 1259 CHORO statement, GMAP procedure ActiveX and Java support for 1614 choropleth maps 18, 1231 annotating 1260 color for lling empty map areas 1260 color for legend text 1261 color for outlining empty map areas 1261 color for outlining non-empty map areas 1261 creating 1259 description of 1261 distinct colors for response values 1262 drill down 1262 drill-down legend 1262 legends 1262 midpoint ranges 1264 midpoints 1263 missing values 1264 name of GRSEG catalog entry 1264 percentages 1264 percentages, overriding default format 1264 physical dimensions 1265 producing a simple map 1297 response levels 1262 statistics 1264 stretching 1265 suppressing legends 1264 uniform legends and coloring 1265 width of outlines 1265 CHREF= option BUBBLE statement (GPLOT) 1328 PLOT statement (GCONTOUR) 1102 PLOT statement (GPLOT) 1341 CI= option, SYMBOL statement 252, 274 CIMPORT procedure 1651 circle-drawing capability, device 341 %CIRCLE macro, Annotate facility 744 circle of stars, drawing (example) 665 CIRCLEARC 341 CIRCLEARC option 341 circles, writing in (DSGI) 864 CITY geocoding method 1155 city map data (U.S.) 1238
1690
Index
city names 1157, 1159 CITY option PROC GEOCODE statement 1155 classication variables multiple, in radar charts 1430 classication variables, plotting 1317 CLASSPATH environmental variables 639 CLEAR function (DSGI) 867 CLEVELS= option PLOT statement (GCONTOUR) 1103 CLINK= macro argument 582 CLIP function (DSGI) 821, 876 CLIP option TDEF statement (GREPLAY) 1488 clipped polygons 402, 406 clipping around viewports (DSGI) 793 clipping map areas 1404 clipping map data sets 1398 example 1404 CLIPREF option BAR statement (GBARLINE) 963 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1020 PLOT statement (GBARLINE) 977 CLIPTIPS= parameter, JAVA 493 CLM= option BAR statement (GBARLINE) 963 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1020 CLOCKWISE option PIE, PIE3D, DONUT statements (GCHART) 1042 closed destinations, ODS 190 closing GSF (graphics stream le) 361 CMAP 341 CMAP argument ? statement (GREPLAY) 1474 LIST statement (GREPLAY) 1482 CMAP entries 1468 CMAP= option PROC GREPLAY statement 1471 CMAP= option, GREPLAY procedure 341 CMAP statement GREPLAY procedure 1477 CMISSING= option FLOW, TILE, TOGGLE statements (GTILE) 1523 CMYK color codes 169 %CMYK macro 176 CNODE= macro argument 582 %CNS macro 176 CNS (SAS Color Naming Scheme) 174 cntl2txt 676 CNTL2TXT function, Annotate facility 676 CO= option, SYMBOL statement 252, 274 CODEBASE attribute, OBJECT element (HTML) 490 CODEBASE= macro argument 576 CODEBASE= option 488 CODELEN= option PROC GFONT statement 1175 COLINDEX function (DSGI) 821 COLLATE 342 COLLATE option 342 collating printed output 342 COLMAJOR option LEGEND statement options 229
color applying to block and prism map regions 1245 color depth exporting graphs to Microsoft Ofce 112 color lists building with GOPTIONS statement 167 device driver 167 GKPI procedure 1211 COLOR MAPPING window 1494 color maps 1468 creating 1499, 1506 managing 1496 specifying/assigning 341 transporting 1653 COLOR= option AXIS statement options 198, 209, 212 GKPI procedure 1214 LEGEND statement options 231 PATTERN statement 239 POINTLABEL= specication 264 SCATTER statement (G3D) 1547 SYMBOL statement 253, 274 TDEF statement (GREPLAY) 1488 TITLE, FOOTNOTE, and NOTE statements 283 COLOR= suboption LABEL= option, DONUT statement (GCHART) 1051 COLOR variable, Annotate facility 705 COLORMAP= macro argument 582 Colormap window (GDEVICE) 1139 COLORNAMELIST= parameter, JAVA 493 COLORNAMES= parameter, JAVA 493 COLORRAMP= option FLOW, TILE, TOGGLE statements (GTILE) 1523, 1530 colors 165 active, number of (plotters) 404 assigning with GTILE procedure 1520 axes 198, 209, 957, 962,, axes, CAXIS= option for 1540, 1547 axis area ll 962 axis area frame 977 axis labels 198, 199, 206, 207, axis tick marks 198, 201, 202, 212 axis values 209 block charts 1014 borders 346, 347 bubble plots 1326 BY lines 216, 338 CMYK codes 169 Color Naming System values 174 default, specifying 166, 343 donut chart labels 1051 error bars 962 GBARLINE procedure 955 graphics output area 337 gray-scale codes 173 HLS codes 170 HSB codes 172 HSV codes 172 image quality across devices and 65 image transparency 428 KPI segments 1209 legend label 226 legend text 231 legend values 231 legends 225 maximum display at once 394
Index 1691
modifying when specied by styles 141 naming schemes 168 outlines 963 patterns 345 pie and donut chart slices 1053 plot print labels 264 plot symbols 252, 274, 299, 346 plotting in order of 404 precedence of specications 139 processing limitations 178 reference lines 962, 963, 977, 1102, reversing black and white 423 RGB codes 169 SAS color names and RGB values 173 specifying in SAS/GRAPH programs 166 text 963, 977 text in graphics output 282, 283 tick marks 977 titles, footnotes, and notes 193, 346, 347 utility macros for 175 COLORS 343 COLORS= graphics option 247, 343 COLORS= option GKPI procedure 1218 COLORSCHEME= parameter, JAVA and ActiveX 493 COLORTYPE 344 COLORTYPE= option, GDEVICE procedure 344 COLORVAR= option FLOW, TILE, TOGGLE statements (GTILE) 1524 COLREP function (DSGI) 822, 877 COLS 345 columns, legends 225 columns in graphics output area 345, 386, 393, 403 commands GDEVICE window commands 1137 comment 677 COMMENT function, Annotate facility 677 %COMMENT macro, Annotate facility 745 comments 350 communications ports, how output is written to 377 compression level for PDF les 123 concepts 23 condence intervals 1023 for error bars 963, 965 condence limits 259 conformal projection 1391, 1397, 1398 CONSTANT= option SURFACE statement (GMAP) 1276 Constellation applet 445, 555 chart with simple arcs (example) 562 chart with weighted arcs (example) 564 DS2CONST macro with 557 hotspots 568 when to use 556 XML written to external le (example) 566 CONTENTS option PROC MAPIMPORT statement 1587 continuous numeric midpoints 951 continuous numeric variables 999 CONTINUOUS option HBAR, HBAR3D, VBAR, VBAR3D statements 935 continuous output stream 367 continuous paper feed 335, 398 continuous variables 997, 1239
Contour applet 443, 471 parameters for, list of 490 contour labels, size of 254 contour lines colors for 252, 274 distance between labels 267 fonts 254 labeling 1116 size of 269 type of 264, 275 contour plots 16, 1095 ActiveX and Java support for 1612 axis order 1112 contour levels 1105, 1109, 1119 interactive, with ActiveX 465 labeling contour lines 1116 modifying contour lines and labels with SYMBOL statement 1114 modifying horizontal axis 1116 modifying legend 1116 PATTERN statement, GCONTOUR procedure 238 patterns 242 patterns and joins 1120 simple 1115 terminology 1097 text for contour labels 1115 control characters, device 430 conventions 24 converting graphics output 1651, 1654 coordinates See also Cartesian coordinates associated with addresses 1158 comparing to map data set 1195 longitude and latitude 1388 coordinates and coordinate systems Annotate facility 652 data-dependent, GSLIDE with 1513 COPY function (DSGI) 867 COPY= option TDEF statement (GREPLAY) 1488 COPY statement GDEVICE procedure 1133 GREPLAY procedure 1478 copying catalog entries 1491 numbers of print copies 369 COUTLINE= option BAR statement (GBARLINE) 963 BLOCK statement (GCHART) 1007 BLOCK statement (GMAP) 1252 CHORO statement (GMAP) 1261 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1020 patterns 248 PIE, PIE3D, DONUT statements (GCHART) 1042 PLOT statement (GCONTOUR) 1103 PLOT statement (GPLOT) 1342 PRISM statement (GMAP) 1268 STAR statement (GCHART) 1058 CPATTERN 345 CPATTERN= graphics option 240, 345 patterns 247 patterns and 248 CPERCENT option BAR statement (GBARLINE) 963
1692
Index
HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1021 CPERCENTLABEL= option HBAR, HBAR3D statements (GCHART) 1021 CPORT procedure 1651 CREATE_ID_ option PROC MAPIMPORT statement 1587 CREF= option BAR statement (GBARLINE) 963 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1021 PLOT statement (GBARLINE) 977 CSELECT= macro argument 583 CSHADOW= option, LEGEND statement options 226, 236 CSPOKES= option CHART statement (GRADAR) 1415 CSTARCIRCLES= option CHART statement (GRADAR) 1415 CSTARFILL= option CHART statement (GRADAR) 1415 CSTARS= option CHART statement (GRADAR) 1416 CSYMBOL 346 CSYMBOL= graphics option 275, 346 CTEXT 346 CTEXT= macro argument 588 CTEXT= option BAR statement (GBARLINE) 963 BLOCK statement (GCHART) 1008 BLOCK statement (GMAP) 1253 BUBBLE statement (GPLOT) 1328 CHART statement (GRADAR) 1416 CHORO statement (GMAP) 1261 HBAR, HBAR3D, VBAR, VBAR3D statements 935 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1021 PIE, PIE3D, DONUT statements (GCHART) 1042 PLOT statement (G3D) 1541 PLOT statement (GBARLINE) 977 PLOT statement (GCONTOUR) 1103 PLOT statement (GPLOT) 1342 PRISM statement (GMAP) 1269 PROC GFONT statement 1170 SCATTER statement (G3D) 1548 STAR statement (GCHART) 1058 CTEXT= options, GOPTIONS statement 292, 346 CTILES= option CHART statement (GRADAR) 1416 CTITLE 347 CTITLE= graphics option 292, 347 CTOP= option PLOT statement (G3D) 1541 cumulative frequency statistic 953, 962, 1000 cumulative percentage statistic 953, 963, 1001 current catalog 1126 current window system, DSGI 776 curve-drawing capability, device 341 curves, nonlinear horizontal variables along 1565 CUSTOM geocoding method 1155 non-address input values 1158 custom graphics 22 custom graphs, creating with DSGI 773 CUSTOM option PROC GEOCODE statement 1155 CUTOFF= macro argument 583
CV= option SYMBOL statement 253, 274 CVREF= option BUBBLE statement (GPLOT) 1328 PLOT statement (GCONTOUR) 1103 PLOT statement (GPLOT) 1342
D
D= option, TITLE, FOOTNOTE, and NOTE statements 284 DASH 348 DASH option 348 dashed lines hardware-generated 348 lengths of dashes, scaling 349 DASHLINE 348 DASHLINE= option, GDEVICE procedure 348 DASHSCALE 349 DASHSCALE= graphics option 349 DATA= argument PROC GFONT statement 1173 PROC GINSIDE statement 1196 data-dependent coordinates with GSLIDE procedure data library for rendered fonts 418 DATA= option PROC G3D statement 1539 PROC G3GRID statement 1568 PROC GAREABAR statement 933 PROC GBARLINE statement 958 PROC GCHART statement 1004 PROC GCONTOUR statement 1099 PROC GEOCODE statement 1155 PROC GMAP statement 1243 PROC GPLOT statement 1323 PROC GPROJECT statement 1393 PROC GRADAR statement 1411 PROC GREDUCE statement 1441 PROC GREMOVE statement 1453 PROC GTILE statement 1521 data sets 54 See also map data sets See also response data sets address data sets 1147 DSGI data sets 775 font data set 1177 for annotating maps 1238 for Range geocoding 1151 input data sets 54 kern data sets 1186 loading into memory 1154 lookup data sets 1147 METAMAPS 1237 SASHELP.ZIPCODE 1149 space data sets 1187 DATA sets Annotate DATA set 34 DATA step Annotate data sets 656 DSGI functions and routines in 34 DATA Step Graphics Interface See DSGI (DATA Step Graphics Interface) data tips GBARLINE procedure 986 data values formatting 620
1513
Index 1693
DATAORDER= option BUBBLE statement (GPLOT) 1329 DATASYS option PROC GANNO statement 914, 916 scaling graphs 916 DATATIPHIGHLIGHTCOLOR= parameter, Metaview Applet 536 DATATIPSTYLE= parameter, Metaview Applet 536 DATATYPE= macro argument 573 date and time formats supported by ACTIVEX 461 date-time information as axis values, ordering 204 ordering axis tick marks (example) 294 dateline 1395 DBF shapeles including selected variables from 1590 %DCLANNO macro, Annotate facility 746 DDLEVEL# applet parameter 615 DDLEVEL= parameter, JAVA and ActiveX 494 debug 678 DEBUG function, Annotate facility 678 debugging Annotate facility 660 DSGI programs 776 DEF option TDEF statement (GREPLAY) 1488 default fonts 155 DEFAULTTARGET= graphics option 536 DEGREES option PROC GPROJECT statement 1394 DEL option TDEF statement (GREPLAY) 1488 DELAY 349 delay between displayed graphs 349, 381 DELAY= graphics option 523 DELETE function (DSGI) 868 DELETE option TDEF statement (GREPLAY) 1488 DELETE statement GDEVICE procedure 1133 GREPLAY procedure 1478 deleting graphics output, after display 355, 358 polygon overlap 402, 406 density levels 1442 density of map observations 1243 DENSITY= option PROC GMAP statement 1243 DENSITY variable 1286, 1437 DEPTH= macro argument 583 DES= option CDEF statement (GREPLAY) 1477 GSLIDE procedure 1512 TDEF statement (GREPLAY) 1488 TREPLAY statement (GREPLAY) 1491 DESCENDING option BAR statement (GBARLINE) 964 BY statement 215 BY statement (GREMOVE) 1454 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1022 PIE, PIE3D, DONUT statements (GCHART) 1043 PLOT statement (GBARLINE) 978 STAR statement (GCHART) 1059 DESCRIPTION 350
DESCRIPTION= option BAR statement (GBARLINE) 964 BLOCK statement (GCHART) 1008 BLOCK statement (GMAP) 1253 BUBBLE statement (GPLOT) 1329 CHART statement (GRADAR) 1417 CHORO statement (GMAP) 1261 FLOW, TILE, TOGGLE statements (GTILE) 1525 GDEVICE procedure 350 GKPI procedure 1218 GSLIDE procedure 1512 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1022 PIE, PIE3D, DONUT statements (GCHART) 1043 PLOT statement (G3D) 1541 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1343 PRISM statement (GMAP) 1269 PROC GANNO statement 915 SCATTER statement (G3D) 1548 STAR statement (GCHART) 1059 SURFACE statement (GMAP) 1277 destinations 40 closing to save system resources 51 controlling graphics output format 48 default 49 sending output to multiple open destinations 51 specifying devices and styles with 51 destinations, ODS 189 DETAIL= option PIE, DONUT statements (GCHART) 1043 detail pie charts 993 creating 1093 Detail window (GDEVICE) 1138 DETAILLEVEL= option FLOW, TILE, TOGGLE statements (GTILE) 1525, 1530 DETAIL_PERCENT= option PIE, DONUT statements (GCHART) 1043 DETAIL_RADIUS= option PIE, DONUT statements (GCHART) 1044 DETAIL_SLICE= option PIE, DONUT statements (GCHART) 1044 DETAIL_THRESHOLD= option PIE, DONUT statements (GCHART) 1044 DETAIL_VALUE= option PIE, DONUT statements (GCHART) 1044 DEVADDR 350 DEVADDR= option GOPTIONS statement 350 DEVICE 351 DEVICE argument ? statement (GREPLAY) 1474 device catalogs 1126 current catalog 1126 search order of 1127 device display area 59 cells 62 dimensions 60 image quality across devices 65 resolution 61 size 61 sizing errors 66 units 62 device drivers 68 color list 167
1694
Index
comparisons between 508 Web output 441 device entries 68, 1126 adding to catalogs 1130 changing values in 1135 copying 1133 creating or modifying 1142 creating with program statements 1143 deleting from current catalog 1133 listing parameters of 1134 modifying parameters 85 parameters versus style attributes 132 renaming 1136 saving modications 1136 transporting 1654 viewing and modifying 85 viewing contents of 85 DEVICE function (DSGI) 823, 877 device-generated graphics circles and arcs 341 dashed lines 348 line thickness 393 pie lling 405 plot symbols 425 polygon-ll 406 rectangle-ll 416 vertices, maximum drawn 395 DEVICE= graphics option 351 controlling graphics output format 48 specifying 49 static graphics 505 device maps specifying 351 device parameters 330 complete list of, alphabetical 330 device-resident fonts 154, 1647 alternative 1649 default 1647 DEVICE statement GREPLAY procedure 1479 devices 67, 68 ActiveX 73 appearance differences among graphs 640 capabilities of, listing 352 categories of 72 commonly used 68 controlling graphics output format 48 creating 86 default 49 defaults for ODS destinations 69 how output is written to 377 identifying type of 354 image quality across devices 65 interface devices 73 Java 73 location of, for output 350 model numbers 395 modifying default output attributes 72 native SAS/GRAPH 73 nicknames for 370 overriding 72 related topics 86 Scalable Vector Graphics 77 selecting 71 sending strings to 372, 373 specifying type of 429
specifying with multiple open destinations 51 SVG output 79 Universal Printer shortcut 73, 75 user input, enabling 431 viewing list of all available devices 71 DEVMAP 351 DEVMAP= graphics option 351 DEVMAP= option, GDEVICE procedure 351 DEVOPTS= 352, 352 DEVOPTS= option, GDEVICE procedure 352 DEVTYPE 354 DEVTYPE= option, GDEVICE procedure 354 diagnostic messages, Annotate facility 762 dial KPI charts 1205, 1223 DIAL statement GKPI procedure 1216 DIRECT= parameter, JAVA and ActiveX 494 DIRECTORY window 1493 DIRECTORY window (GDEVICE) 1137 DISABLE DRILLDOWN applet parameter 620 discrete numeric chart variables 964 discrete numeric midpoints 950 discrete numeric variables 998 in star charts 1090 DISCRETE option AREA statement (GMAP) 1246 BAR statement (GBARLINE) 964 BLOCK statement (GCHART) 1009 BLOCK statement (GMAP) 1253 CHORO statement (GMAP) 1262 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1022 PIE, PIE3D, DONUT statements (GCHART) 1044 PRISM statement (GMAP) 1269 STAR statement (GCHART) 1059 discrete variables 997, 1239 DISPLAY 355 DISPLAY option 355 display size (lines) 379 DISPOSAL 355 DISPOSAL= graphics option 523 DISPOSAL option 355 DOCTYPE= macro argument 588 document les 88 document formats versus graphics formats 111 DOCUMENT procedure replaying output 106 donut charts 8, 993 creating 1039 labels 1051 outlines 1053 selecting and positioning slice labels 1052 slice patterns and colors 1053 statistic and group headings 1048, 1055 subgrouping 1084 text description suboptions 1051 DONUT statement GCHART procedure 1039 DONUT statement, GCHART procedure ActiveX and Java support for 1607 DONUTPCT= option DONUT statement (GCHART) 1044 DOWN= option LEGEND statement options 226
Index 1695
PIE, PIE3D, DONUT statements (GCHART) 1044 STAR statement (GCHART) 1060 DOWNVAR= option CHART statement (GRADAR) 1417 draw 678 DRAW function, Annotate facility 678, 1628 %DRAW macro, Annotate facility 746 DRAW= option, TITLE, FOOTNOTE, and NOTE statements 284 DRAW2TXT function, Annotate facility 679, 1628 %DRAW2TXT macro, Annotate facility 747 DRAWIMAGE= parameter, JAVA 494 drawing areas, Annotate graphics 652 DRAWMISSING= parameter, JAVA 494 DRAWSIDES= parameter, JAVA 494 drill-down ActiveX 462 adding to Web presentations 514 conguring for Java output 477 customizing levels for 615 disabling 620 GIF output with 517 HTML mode for Java 484 JavaScript, with ActiveX 466, 468 local mode for Java 477 script mode for Java 479 URL mode for Java 481 drill-down functionality Annotate facility for 542 bar charts with (example) 321, 620 constellation charts 568 creating plots with (example) 1379 treeview diagrams 552 drill-down graphs Annotate graphics in 925 drill-down tags 610, 614 drill-down URLs 986 DRILLDOWN= parameter, JAVA and ActiveX 494 DRILLDOWNMODE= parameter, JAVA and ActiveX 494 DRILLFUNC= parameter, JAVA and ActiveX 494 DRILLPATTERN= parameter, JAVA and ActiveX 495 DRILLTARGET applet parameter 615, 617 DRILLTARGET= parameter, JAVA and ActiveX 495 DRILTARG= macro argument 583 driver modules 395 driver termination 357 drivers, initializing 356 drop shadows, legends 226, 236 DROPCOLLISIONS option SYMBOL statement 264 DRVINIT 356 DRVINIT1 356 DRVINIT1= and DRVINIT2= options, GDEVICE procedure 356 DRVINIT1= and DRVINIT2= options, GOPTIONS statement 356 DRVINIT2 356 DRVQRY 356 DRVQRY= option, GDEVICE procedure, executing before driver initialization 356 DRVTERM 357 DRVTERM1 357 DRVTERM1= and DRVTERM2= options, GDEVICE procedure 357 DRVTERM1= and DRVTERM2= options, GOPTIONS statement 357
DRVTERM2 357 DS2CONST macro 453, 557 arguments of 562, 571 arguments of, character transcoding 595 arguments of, data denition 573 arguments of, diagram appearance 581 arguments of, le generation 580 arguments of, page formatting 587 arguments of, titles and footnotes formatting 591 chart with simple arcs (example) 562 chart with weighted arcs (example) 564 enhancing presentations for 561 hotspots 568 stylesheets, macro arguments for 589 XML written to external le (example) 566 DS2TREE macro 453 arguments of 549, 571 arguments of, character transcoding 595 arguments of, data denition 573 arguments of, diagram appearance 581 arguments of, le generation 580 arguments of, page formatting 587 arguments of, titles and footnotes formatting 591 enhancing presentations for 548 stylesheets, macro arguments for 589 DSGI (DATA Step Graphics Interface) 22, 770, 813 Annotate facility vs. 770 attributes for graphics elements 784, 789 creating simple graphics 783 examples of using 797 functions and routines 776, 777 GASK routines 809, 816 GDRAW functions, list of 855 global statements with 775 GRAPH functions, list of 866 GSET functions, list of 871 how to use 774 images, displaying 186 inserting graphs into DSGI output 794 operating states 775, 785, 814 processing statements in loops 796 return codes, list of 908 syntax 772 utility functions, list of 814 viewports and windows 791, 801 DSGI functions and routines 34 DUMP option LIST statement (GDEVICE) 1134 DUPCHECK= macro argument 583 DUPLEX 357 duplex printing 336, 357 DUPLICATEVALUES= parameter, JAVA 495 DUPOK option PROC GPROJECT statement 1394
E
E1= option PROC GREDUCE E2= option PROC GREDUCE E3= option PROC GREDUCE E4= option PROC GREDUCE statement 1441 statement 1441 statement 1441 statement 1441
1696
Index
E5= option PROC GREDUCE statement 1441 EASTLONG option PROC GPROJECT statement 1394 EBCDIC-to-ASCII translation 429 editable output 367 Electronic font 1642 ELLARC function (DSGI) 858 ELLIPSE function (DSGI) 860 ellipses, drawing with DSGI 858, 860 EMF transparency limitation Microsoft Ofce 117 EMPTY variable, Annotate facility 723 ENCODE= macro argument 588 encoding Unicode 157 engines 56 enhancement variables in Web presentations 603 environments 53 equal-area map projections See Albers equal-area projection ERASE 358 ERASE= graphics option 358 ERASE= option, GDEVICE procedure 358 erasing graphics output, after display 355, 358 error bars color of 962 condence intervals for 963, 965 in horizontal bar charts 1079 ERRORBAR= option BAR statement (GBARLINE) 965 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1023 errors sizing errors 66 errors and error messages, Annotate facility 762 ESRI les importing as map data sets 1585, 1586 ESRI shapeles importing maps from 1241 Euclidean distance formula 1443 examples 27 Annotate macro data set 29 conventions for 26 map data sets and 29 sample programs 27 support personnel for 27 executable driver modules 395 EXPLODE= option PIE, PIE3D, DONUT statements (GCHART) 1044 exporting graphics output 110 exporting graphs color depth 112 comparison of output 114 default CGM lter for Microsoft Ofce 118 editing graphs 113 EMF and CGM transparency limitation 117 enhancing graphs 118 fonts 113 graphics formats versus document formats 111 image resolution and size 112 multiple-image graphics les 113 to Microsoft Ofce 111 vector versus raster formats 113
EXTENSION 359 EXTENSION= graphics option 359 external les le extensions for 359
F
F= option AXIS statement options 209 LEGEND statement options 231 POINTLABEL= specication 265 SYMBOL statement 254 TITLE, FOOTNOTE, and NOTE statements 284 FACHE= graphics option 360 FACTOR= macro argument 583 FASTTEXT 359 FASTTEXT= graphics option 359 FBY 360 FBY= graphics option 360 FCACHE 360 FCLASS= macro argument 591 FCOLOR= macro argument 591 feature tables 1236 creating maps with 1304 $GEOREF format 1236 merging with response data sets 1237 FFACE= macro argument 591 FILCOLOR function (DSGI) 824, 878 le extensions 359 graphics output les 93 le specications specifying input data sets 55 FILECLOSE 361 FILECLOSE= graphics option 361 FILECLOSE= option, GDEVICE procedure 361 FILENAME 385 lename indexing 99 FILENAME statement 35, 36 storing in device entry 385 lenames output 102 FILEONLY 362 FILEONLY= graphics option 362 FILEREP function (DSGI) 825 les image le types 179 sending output to 44 sending strings to 372, 373 storing graphics output as 362 FILINDEX function (DSGI) 824, 879 ling images 181 FILL 362 FILL function (DSGI) 861 FILL= graphics option 362 FILL= option PIE, PIE3D, DONUT statements (GCHART) 1044 STAR statement (GCHART) 1060 FILL= option, GDEVICE procedure 362 lled fonts 1167 FILLED option PROC GFONT statement 1175 FILLINC 363 FILLINC= graphics option 363 FILLINC= option, GDEVICE procedure 363 FILLPOLYGONEDGES= parameters, JAVA and ActiveX 496
Index 1697
FILREP function (DSGI) 879 FILSTYLE function (DSGI) 826, 881 FILTYPE function (DSGI) 827, 880 FIPS codes 1279 functions for 1280 FISHEYE= macro argument 583 xed-length output records 367 ow control, device 382 FLOW statement GTILE procedure 1522 FNTNAME= macro argument 584 FNTSIZE= macro argument 584 FNTSTYL= macro argument 584 font data sets 1177 creating 1185 variables 1179 font maximum 1166 font minimum 1166 font modiers 157 FONT NAME 363 FONT= option 231 AXIS statement options 209 CHART statement (GRADAR) 1417 GKPI procedure 1214 POINTLABEL= specication 265 SYMBOL statement 254 TITLE, FOOTNOTE, and NOTE statements 284 FONT= suboption LABEL= option, DONUT statement (GCHART) 1051 FONTRES 364 FONTRES= graphics option 364 fonts 153, 1166 ActiveX and 460 additional 154 axis labels 199, 206, 209 axis values 209 baseline 1166 bubble plots 1326 BY lines 216, 360 capline 1166 changing specications used by styles 163 complete list of 1636 creating 1166, 1173, 1177 creating gures for symbol font 1191 default 155, 339, 340, 1647 determining available fonts 155 device-resident fonts 154 displaying 1165, 1169, 1170 displaying with character codes 1189 donut chart labels 1051 exporting graphs to Microsoft Ofce 113 lled 1167 full names for 1649 GFONT procedure 1165 GKPI procedure 1214 graphics output text 365 in ACTIVEX 461 international characters 157 kern data sets 1186 legend label 226 legend text 231 legend values 231 line segments 1167 methods for specifying 161 modifying when specied by styles 141 open at one time 360
outline 1167 parts of 1166 PDF les 121 plot point label 265 plot symbols 254 polygon 1167 precedence of specications 163 proportional 1166 registry subkeys 157 rendering 359, 366, 417, 424, rendering, data library for 418 resolution 364 SAS/GRAPH fonts 153 scaling in graphics output 345, 421, 422 space data sets 1187 special characters 158 special Java fonts 474 specifying 157 specifying in GraphFonts style element 144 specifying modiers 157 specifying with global statement options 162 specifying with GOPTIONS statement 162 stroked 1166 system fonts 154 terminology 1166 text in graphics output 284 titles and footnotes 193, 365 transporting 1653 troubleshooting 640 TrueType 154 TrueType fonts supplied by SAS 154 types of 153, 1166 uniform 1166 user-created 1167 viewing specications in SAS registry 156 where stored 1636, 1645 FOOTNOTE 279 FOOTNOTE denitions displaying values of 1309 FOOTNOTE element (HTML), macro arguments for FOOTNOTE option PROC GOPTIONS statement 1311 FOOTNOTE statement 33, 196, 279, 291 ActiveX and Java support for 1604 BY statement with 218 displaying with GOPTIONS procedure 1312 footnotes 291 angle of rotation 280, 286, 289 boxes around 282, 283 colors for 282, 283, 346, 347 default characteristics, setting 292 dening text of 289, 293 fonts for 284 hyperlinks for 288 justication 285 ODS output 192, 193 placement in graphics output area 65 positioning 288 size of 285, 387 spacing around 288 text breaks 293 underlining 291 footnotes macro, arguments for 591 foreground colors default, dening 343 reversing black and white 423
591
1698
Index
FORMAT 364 FORMAT= option GKPI procedure 1218 FORMAT= option, GDEVICE procedure 364 FORMAT statement 35 formats assigning to response variables 1293 for map variables 1281 supported by ACTIVEX 461 supported for Java 474 formatting axis labels 199, 206, 207, 208 axis tick marks 201, 202, 212 axis values 208 BY lines 216 legend label 226 legend values 231 legends 223 FRAME function, Annotate facility 1629 frame. legend 226 %FRAME macro, Annotate facility 747 FRAME option BAR statement (GBARLINE) 966 BUBBLE statement (GPLOT) 1329 CHART statement (GRADAR) 1417 GSLIDE procedure 1512 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1024 PLOT statement (GPLOT) 1343 FRAME= option, LEGEND statement options 226 frames around axis area 966 backplane images 182 images on 182, 1026, 1330, 134 frames, drawing 1513 FREQ option BAR statement (GBARLINE) 966 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1024 BAR statement (GBARLINE) 966 BLOCK statement (GCHART) 1009 CHART statement (GRADAR) 1418 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1025 PIE, PIE3D, DONUT statements (GCHART) 1045 PLOT statement (GBARLINE) 978 STAR statement (GCHART) 1060 FREQLABEL= option HBAR, HBAR3D statements (GCHART) 1024 FREQNAME= parameters, JAVA and ActiveX 496 frequency statistic 953, 966, 1000 frequency variable for plot statistic 978 FRONTREF option HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1025 FS option PROC GREPLAY statement 1471 FS statement GDEVICE procedure 1134 GREPLAY procedure 1479 FSIZE= macro argument 591 FTEXT 365 FTEXT= option GOPTIONS statement 292, 365
FTITLE 365 FTITLE= graphics option 292, 365 FTRACK 366 FTRACK= graphics option 366 FUNCTION variable, Annotate facility 651, 706 functions DSGI 34 FIPS and postal codes 1280 functions, Annotate 649, 671 FUZZ= option PROC GREMOVE statement 1453 FWIDTH= option, LEGEND statement options 226
G
G_ COLOR= parameters, JAVA and ActiveX 496 G_ COLORV= parameters, JAVA and ActiveX 496 G_ DEP= parameters, JAVA and ActiveX 496 G_ DEPTH= parameters, JAVA and ActiveX 496 G_ DEPTHV= parameters, JAVA and ActiveX 496 G_ DEPV= parameters, JAVA and ActiveX 496 G_ GROUP= parameters, JAVA and ActiveX 497 G_ GROUPV= parameters, JAVA and ActiveX 497 G_ INDEP= parameters, JAVA and ActiveX 497 G_ INDEPV= parameters, JAVA and ActiveX 497 G_ LABEL= parameters, JAVA and ActiveX 497 G_ LABELV= parameters, JAVA and ActiveX 497 G_ SUBGR= parameters, JAVA and ActiveX 497 G100 option BLOCK statement (GCHART) 1009 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1025 g3d 1538 G3D procedure 1533 ActiveX and Java support for 1625 axes 1537 concepts 1535 input data sets 1536 PLOT statement 1539 PROC G3D statement 1538 rotating and tilting plots 1537 scatter plots 1534 SCATTER statement 1546 surface plots 1533, 1552, 1555, 15 surface plots, rotated 1553 surface plots, tilted 1554 syntax 1538 terminology 1535 G3GRID 1568 G3GRID procedure 1563 concepts 1565 controlling observations in output data set 1572 default interpolation method 1573 GRID statement 1569 horizontal variables along nonlinear curve 1565 input data set 1565 interpolation methods 1566 multiple vertical variables 1565 output data set 1565 partial spline interpolation 1578 PROC G3GRID statement 1568 spline and smoothing interpolations 1576 spline interpolation 1580 syntax 1568 GACCESS 367 GACCESS= graphics option 367
Index 1699
GACCESS= option, GDEVICE procedure 367 GANNO 913, 914 GANNO procedure 658, 913 Annotate graphics in drill-down graphs 925 compared with GSLIDE procedure 913 PROC GANNO statement 914 producing multiple graphs 921 scaling data-dependent output 916 scaling graphs 916 storing Annotate graphics 919 syntax 914 Web output, generating 542 GAREABAR 931, 933 GAREABAR procedure 931 ActiveX and Java support for 1604 area bar charts 938 area bar charts with numeric chart variable 940 area bar charts with subgroups 942, 944 concepts 932 examples 937 HBAR and HBAR3D statements 934 PROC GAREABAR statement 933 syntax 933 VBAR and VBAR3D statements 934 GASK routines DSGI 809 list of, reference 816 GAXIS= option BLOCK statement (GCHART) 1009 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1025 GBARLINE 947 GBARLINE procedure 947 ActiveX and Java support for 1605 BAR statement 959 calculating weighted statistics 984 chart statistics 953 chart variables 950 concepts 949 creating bar-line charts 982 data tips 986 drill-down URLs 986 midpoints 950 missing values 954 multiple plots 986 patterns, outlines, colors, and images 955 PLOT statement 975 plot variable values out of range 955 PROC GBARLINE statement 958 response variables 952 subgroups 986 %GCBATCH autocall macro 1155 %GCDMEL9 autocall macro 1151 GCHART 1004 GCHART procedure 990, 1004, 1322 3-D vertical bar charts, subgrouping 1073 ActiveX and Java support for 1607 bar charts 991 bar charts, sum statistic in 1071 block charts 990 block charts, grouping and subgrouping 1068 block charts, sum statistic in 1066 BLOCK statement 1005 BY-group processing with (example) 309 BY statement 216 chart statistics 1000
chart variables 997 concepts 996 detail pie charts 993, 1093 donut charts 993 donut charts, subgrouping 1084 DONUT statement 1039 drill-down functionality in bar chart (example) 620 DSGI viewport with (example) 801 HBAR, HBAR3D statements 1016 horizontal bar charts, error bars in 1079 horizontal bar charts, midpoints and statistics in 1076 midpoints 998 missing values 998 PATTERN statement 238 patterns 240, 1002 patterns and outlines 243 PIE, PIE3D statements 1039 pie charts 993 pie charts, grouping and arranging 1087 pie charts, ordering and labeling slices 1085 pie charts, subgrouping 1084 pie charts, sum statistic in 1081 PROC GCHART statement 1004 star charts 995 star charts, discrete numeric variable in 1090 star charts, sum statistic in 1089 STAR statement 1055 subgroup labels (example) 663 syntax 1004, 1322 VBAR, VBAR3D statements 1016 GCLASS 368 GCLASS= graphics option 369 Gcolors window (GDEVICE) 1139 GCONTOUR 1095, 1099 GCONTOUR procedure 1095 ActiveX and Java support for 1612 concepts 1097 contour levels 1109, 1119 contour plots 1097, 1114 contour plots, modifying 1116 contour plots, simple 1115 data ranges 1097 input data 1097 interpolating data 1098 missing values 1098 PATTERN statement 238 patterns 242 patterns and joins 1120 PLOT statement 1099 PROC GCONTOUR statement 1098 syntax 1098 GCOPIES 369 GCOPIES= graphics option 369 GCOPIES= option, GDEVICE procedure 369 GDDM device driver device nicknames 370 writing ADMGDF or GDF les 332 GDDMCOPY 369 GDDMCOPY= graphics option 369 GDDMNICKNAME 370 GDDMTOKEN 370 GDDMTOKEN= graphics option 370 GDEST 370 GDEST= graphics option 370 GDEVICE 1126, 1129
1700
Index
GDEVICE procedure 1126 ADD statement 1130 browse mode 1129 concepts 1126 COPY statement 1133 creating device entries with program statements 1143 creating or modifying device entries 1142 default device-resident fonts 1648 DELETE statement 1133 device catalogs 1126 exiting 1128, 1136 FS statement 1134 LIST statement 1134 MODIFY statement 1135 PROC GDEVICE statement 1129 program mode 1127, 1128, 1129 QUIT statement 1136 RENAME statement 1136 switching modes 1134 syntax 1129 windowing mode 1127 GDEVICE windows 329, 1136 commands 1137 switching from program mode to 1134 GDF les, writing with GDM driver 332 GDRAW function, DSGI 186, 855 G_drill-down tags 610 GEND 371 GEND= graphics option 371 GEND= option, GDEVICE procedure 371 Gend window (GDEVICE) 1141 geo-variables 1240 GEOCODE 1155 GEOCODE procedure 1147 alternate lookup data sets 1150 concepts 1149 data sets for Range geocoding 1151 %GCDMEL9 autocall macro 1151 geocoding with default values 1161 indexing lookup data sets 1153 loading data sets into memory 1154 _MATCHED_ variable 1148 %MAXMIND autocall macro 1152 optimizing performance 1153 output data sets 1149 output data sets, adding additional variables to 1162 PROC GEOCODE statement 1154 SASHELP.ZIPCODE data set 1149 syntax 1154 U.S. military ZIP codes 1151 geocoding 1147 data set for geocoded addresses 1160 disabling informational log messages 1159 disabling secondary matching 1159, 1160 latitude of location 1159 longitude of location 1159 matches 1148 methods for 1155 multiple matches 1148 with default values 1161 with ZIP codes 1148 Geo*Data 1151 $GEOREF format 1236 GEPILOG 372 Gepilog eld, device entries 407, 409, 410 GEPILOG= graphics option 372
GEPILOG= option, GDEVICE procedure 372 Gepilog window (GDEVICE) 1140 Geprolog eld, device entries 408 GFONT 1168 GFONT procedure 1165 concepts 1166 creating gures for symbol font 1191 creating fonts 1166, 1177 displaying fonts 1165 displaying fonts and character codes 1189 font terminology and characteristics 1166 options for creating fonts 1173 options for displaying fonts 1170 PROC GFONT statement 1168 required arguments for creating fonts 1173 required arguments for displaying fonts 1169 storing user-created fonts 1167 syntax 1168 GFONT0 libref 1167 GFOOTNOTE= option, ODS HTML statement 192 GFORMS 372 GFORMS= graphics option 372 GIF device data tips for 600 GIF device driver 453 ACTXIMG, JAVAIMG vs. 508 developing web presentations 510 HTML les, generating 511 GIF output drill-down in 517 GIF presentations 448 GIFANIM device 521 creating animated sequences 522 GOPTIONS for presentations 523 GIFANIM device driver 449 developing Web presentations 521 sample programs 524 GIFs creating animated GIFs with BY-group processing 524 creating animated GIFs with GREPLAY procedure 529 creating animated GIFs with RUN-group processing 526 GINIT function (DSGI) 814 GINSIDE 1195 GINSIDE procedure 1195 determining values with 1197 ID statement 1197 mapping and annotating values from 1198 PROC GINSIDE statement 1196 syntax 1196 GKPI 1215 GKPI procedure 1203 actual KPI values 1208 basic or raised mode 1206, 1215 boundary values 1209 bullet graph charts 1204 bullet graph charts, gray scale 1222 concepts 1206 default colors as active colors 1221 device for 1204 dial charts 1205, 1223 DIAL statement 1216 display types 1216 examples 1220 fonts 1214 HBULLET statement 1216 HSLIDER statement 1216
Index 1701
HTRAFFICLIGHT statement 1216 PROC GKPI statement 1215 segment boundaries 1208 segment colors 1209 slider charts 1204 speedometer charts 1205, 1224, 1225 SPEEDOMETER statement 1216 syntax 1215 tick mark values 1209 trafc light charts 1206, 1226 VBULLET statement 1216 VSLIDER statement 1216 VTRAFFICLIGHT statement 1216 global statement options specifying fonts with 162 global statements 22, 33, 195, 775 RUN-group processing and 56 GMAP 1230 GMAP procedure 238, 1230 ActiveX and Java support for 1614 AREA statement 1245 BLOCK statement 1249 BY statement 217 CHORO statement 1259 concepts 1234 examples 1290 ID statement 1245 input map data sets for 1449 PRISM statement 1266 PROC GMAP statement 1243 summary of use 1241 SURFACE statement 1275 syntax 1243 gnomonic projection 1392 emphasizing map areas 1402 projection criteria 1398 projection pole for 1396 specifying 1396 when to use 1397 GOPTIONS 222, 1309 GOPTIONS procedure 1309 compared with GOPTIONS statement 1309 displaying graphics options without descriptions 1313 displaying TITLE and FOOTNOTE statements 1312 PROC GOPTIONS statement 1310 syntax 1310 GOPTIONS statement 33, 196, 222, 329, 3 ActiveX and Java support for 1596 building color lists 167 compared with GOPTIONS procedure 1309 graphics option processing 223 resetting options 419 specifying fonts with 162 using 223 GOUT argument ? statement (GREPLAY) 1474 GOUT= option GSLIDE procedure 1512 PROC G3D statement 1539 PROC GANNO statement 915 PROC GCHART statement 1005 PROC GCONTOUR statement 1099 PROC GFONT statement 1170 PROC GMAP statement 1244 PROC GPLOT statement 1323 PROC GRADAR statement 1411
PROC GREPLAY statement 1471 GOUT statement GREPLAY procedure 1480 GOUTMODE 373 GOUTMODE= graphics option 373 GPLOT 1322 GPLOT procedure 238, 1315 ActiveX and Java support for 1617 adding right vertical axis (example) 1360 BUBBLE statement 1324 BUBBLE2 statement 1333 BY statement 217 connecting plot data points (example) 1365 different scales of values (example) 1376 lling areas in overlay plot (example) 1370 generating overlay plot (example) 1367 generating simple bubble plots (example) 1357 input data set 1321 labeling and sizing plot bubbles (example) 1358 PATTERN denitions 1356 plot basics 1319 PLOT statement 1336 PLOT2 statement 1351 plots with drill-down for Web (example) 1379 plotting three variables (example) 1373 plotting two variables (example) 1362 PROC GPLOT statement 1322 scaling graphs with DSGI windows (example) 804 SYMBOL denitions 1350, 1356 SYMBOL statement 273 syntax 1322 GPRINT function (DSGI) 815 GPROJECT 1385 GPROJECT procedure 1385 clipping map areas 1404 clipping map data sets 1398, 1404 concepts 1387 coordinate values 1388 default projection specications 1399 emphasizing map areas 1402 examples 1399 ID statement 1397 input map data sets 1387 map projections 1389 PROC GPROJECT statement 1393 projecting annotate data sets 1405 projection criteria 1398 projection methods 1396 selecting projections 1397 syntax 1393 usage 1397 GPROLOG 373 GPROLOG= graphics option 373 GPROLOG= option, GDEVICE procedure 373 Gprolog window (GDEVICE) 1140 GPROTOCOL 374 GPROTOCOL= graphics option 374 GPROTOCOL= option, GDEVICE procedure 374 GRADAR 1409 GRADAR procedure 1409 ActiveX and Java support for 1622 calculating weighted statistics 1410 CHART statement 1412 creating calendar charts 1434 creating radar charts 1427 creating windrose charts 1433
1702
Index
data set for examples 1425 modifying appearance of radar charts 1431 multiple classication variables in radar charts 1430 overlaying radar charts 1428 PROC GRADAR statement 1411 syntax 1411 tiling radar charts 1429 GRADIENTBACKGROUND= parameters, JAVA and ActiveX 497 GRADIENTENDCOLOR= parameters, JAVA and ActiveX 498 GRADIENTSTARTCOLOR= parameters, JAVA and ActiveX 498 Graph applet 443, 471 disabling drill-down 620 drill-down tags 610 local drill-down mode 611, 615 parameters for, list of 490 GRAPH functions, DSGI 865 Graph-N-Go 23 GRAPH window sending output to 43 GraphColors modifying style elements 141 GraphColors style element 142 GraphFonts modifying style elements 141 GraphFonts style element 143 font specications in 144 graphics catalogs converting 1654 duplicate entry names 1468 graphics devices See devices graphics elements 59, 88 placement in graphics output area 65 graphics elements, creating DSGI 186, 855 graphics les multiple-image 113 graphics formats 88 versus document formats 111 graphics options 22, 222, 330 complete list of, alphabetical 330 displaying without descriptions 1313 for GIFANIM presentations 523 listing 1309, 1310 ODS output with 193 resetting 419 storing multiple graphs in one output le 104 graphics output 59, 88, 640 Annotate data sets 657 Annotate graphics with 657 appending strings to records 371 appending to or replacing catalogs 373 background images 388, 390 catalog name and entry name for GRSEGs 100 comparison of, for Microsoft Ofce 114 controlling format with DEVICE= option 48 conventions for 26 default destinations for 362 destination for 378 device variants to set size of resolution 97 display size, in lines 379 displaying images in 389 enhancing 22 erasing after display 355, 358
examples, using different styles 134 exporting 110 generating for ActiveX 459 generating output for Java 472 GRSEG names 102 GRSEGs 89 how written, specifying 377 name and location of ODS output 97 output lenames 102 output types 89 prexing records 380 previewing 109 previewing as if on different device 427 printing 109 process of 93 protocol module, specifying 374 queuing for log messages 415 replaying 106 replaying in templates 1498 resolution 95, 97 reversing black and white 423 saving and printing 110 sending directing to printer 109 size of graph 94, 97 storage of 97 supported graphics formats 88 suppressing display of 355 terminology 88 transporting and converting 1651 what you can do with 90 graphics output area 59 Annotate facility 654 border around 337 cells 62 columns in 345, 393, 403 dimensions 60 display area size 61 image quality across devices 65 maximum colors allowed 394 offset between graphs and 385, 431 placement of graphics elements in 65 resolution 61 rows in 394, 415, 421, 432 size of 386, 433, 434, 435,, sizing errors 66 units 62 graphics output devices 93 ACTIVEX 93 graphics output les and 91 JAVA 93 graphics output les 88 le extensions 93 lename indexing 99 name and location of 98 name of 969 ODS and 91 output devices and 91 replacing with GSFMODE= graphics option 104 specifying type of 91 storing multiple graphs in one le 104 graphics output text colors for 347 fonts 365 size of 387 GRAPHLIST function (DSGI) 828 GRAPHRC 376
Index 1703
GRAPHRC= graphics option 376 graphs 6 See also appearance of graphs appearance differences among devices 640 background images 388 box plots 252, 254, 269, 301 BY lines 215 custom graphics 22 displaying in timed series 381 editing 113 enhancing 22 enhancing for Microsoft Ofce 118 enhancing with DSGI 773 exporting to Microsoft Ofce 111 importing into Microsoft Excel 119 importing into Microsoft Ofce 118 importing into Microsoft PowerPoint 120 importing into Microsoft Word 118 placement in graphics output area 65 producing multiple (GANNO) 921 redrawing (overdrawing) 418 replaying into templates 1504 scaling 916 slide presentations of 20 suppressing display of 355 templated 21 writing to PDF les 121 gray scale bullet graph KPI charts 1222 gray-scale color codes 173 GREDUCE 1437 GREDUCE procedure 1437 concepts 1439 density levels 1442 ID statement 1442 input map data sets 1439 PROC GREDUCE statement 1440 reducing map of Canada 1445 subsetting map data sets 1444 syntax 1440 unmatched area boundaries 1439 GREMOVE 1449 GREMOVE procedure 1449 BY statement 1454 concepts 1450 creating outline map of Africa 1460 ID statement 1455 input map data sets 1451 ordering observations 1454 output map data sets 1451 PROC GREMOVE statement 1452 removing state boundaries from U.S. map 1455 syntax 1452 unmatched area boundaries 1451 GREPLAY 1466 GREPLAY procedure 1466 ? statement 1474 BYLINE statement 1474 catalog entries 1467 catalog entries, managing 1497 CC statement 1475 CCOPY statement 1475 CDEF statement 1476 CDELETE statement 1477 CMAP statement 1477 code-based statements 1469 concepts 1467
COPY statement 1478 creating animated GIFs 529 creating color maps 1499, 1506 creating multiple-page PDF les 127 creating templates 1498, 1500 DELETE statement 1478 DEVICE statement 1479 FS statement 1479 GOUT statement 1480 GROUP statement 1480 IGOUT statement 1481 invoking 1473 LIST statement 1481 managing catalogs, color maps, and templates 1496 MODIFY statement 1482 MOVE statement 1483 NOBYLINE statement 1484 PREVIEW statement 1484 PROC GREPLAY statement 1471, 1473 QUIT statement 1484 REPLAY statement 1485 replaying catalog entries 1497 replaying graphics output in templates 1498 replaying graphs into templates 1504 replaying GSLIDE procedure output in a template 1502 replaying output 106 sizing and naming graphs for replay 1469 storing multiple graphs in one output le 104 syntax 1471 TC statement 1485 TCOPY statement 1486 TDEF statement 1487 TDELETE statement 1490 template code 1655 TEMPLATE statement 1490 TREPLAY statement 1491 ways to use 1469 window commands 1492, 1495 windowing environment 1469 windows 1492 grid of values See G3GRID procedure GRID option BUBBLE statement (GPLOT) 1329 PLOT statement (G3D) 1542 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1344 SCATTER statement (G3D) 1548 GRID statement G3GRID procedure 1569 group brackets, bar charts 202 group headings pie and donut charts 1048, 1055 star charts 1063, 1066 GROUP= option BLOCK statement (GCHART) 1009 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1025 PIE, PIE3D, DONUT statements (GCHART) 1045 STAR statement (GCHART) 1060 GROUP statement GREPLAY procedure 1480 GROUP variable, Annotate facility 707 grouping block charts 1068 pie charts 1087
1704
Index
grouping abbreviations 214 GRSEG catalog entries 1467 name of 969 GRSEGs 89 catalog name and entry name for 100 names for 102 storage with multiple ODs destinations 101 GSET functions, DSGI 871 GSF (graphics stream le) closing 361 how output is written to 377 output format and destination 367 prompt messages to 379 protocol module, specifying 374 record length 376 where written, specifying 378 GSFLEN 376 GSFLEN= graphics option 376 GSFMODE 377 GSFMODE= graphics option 377, 523 replacing graphics output les 104 GSFMODE= option, GDEVICE procedure 377 GSFNAME 378 GSFNAME= graphics option 378, 523 GSFNAME= option, GDEVICE procedure 378 GSFPROMPT 379 GSFPROMPT= graphics option 379 GSIZE 379 GSIZE= graphics option 379 GSLIDE 1509 GSLIDE procedure 658, 1509 Annotate graphics, displaying 1510, 1516 compared with GANNO procedure 913 data-dependent coordinates 1513 producing text slides (example) 1514 replaying output in a template 1502 syntax and options 1511 GSPACE= option HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1026 GSTART 380 GSTART= graphics option 380 GSTART= option, GDEVICE procedure 380 Gstart window (GDEVICE) 1141 GSTYLE system option 132 GTERM function (DSGI) 815 GTILE 1521 GTILE procedure 1519 assigning colors 1520 chart variables 1519 concepts 1519 creating tile charts 1522, 1528 FLOW statement 1522 missing values 1520 negative values 1520 PROC GTILE statement 1521 syntax 1521 TILE statement 1522 TOGGLE statement 1522 zero values 1520 GTITLE= option, ODS HTML statement 192 GUNIT 380 GUNIT= graphics option 380 GWAIT 381 GWAIT= graphics option 380 GWRITER 382
H
H= option AXIS statement 209, 212 LEGEND statement options 231 POINTLABEL= specication 265 SYMBOL statement 254 TITLE, FOOTNOTE, and NOTE statements 285 HANDSHAKE 382 HANDSHAKE= graphics option 382 HANDSHAKE= option, GDEVICE procedure 382 handshaking 382, 396 hardware fonts default 339, 340 device map, specifying 351 scaling in graphics output 345, 421, 422 specifying for device 340, 363 when not found 422 hardware-generated graphics circles and arcs 341 dashed lines 348 line thickness 393 pie lling 405 plot symbols 425 polygon-ll 406 rectangle-ll 362, 416 vertices, maximum drawn 395 HAXIS= option BUBBLE statement (GPLOT) 1330 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1344 HBAR and HBAR3D statements GAREABAR procedure 934 GCHART procedure 1607 HBAR statement GCHART procedure 1016 HBAR3D statement GCHART procedure 1016 HBULLET statement GKPI procedure 1216 HBY 383 HBY= graphics option 383 HEADER 384 HEADER= option, GDEVICE procedure 384 HEADER records 384 HEADERFILE 384 HEADERFILE= option, GDEVICE procedure 384 headers for animated sequences 522 HEIGHT= macro argument 572 HEIGHT= option AXIS statement 209, 212 CHART statement (GRADAR) 1418 GKPI procedure 1214 LEGEND statement options 231 POINTLABEL= specication 265 PROC GFONT statement 1171 SYMBOL statement 254 TITLE, FOOTNOTE, and NOTE statements 285 HEIGHT= suboption LABEL= option, DONUT statement (GCHART) 1051 hexadecimal values specifying special characters 158 high-low plots 14, 256
Index 1705
HITEXT= graphics option 293 HLS color codes 170 HMINOR= option BUBBLE statement (GPLOT) 1330 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1344 HONORASPECT= parameter, JAVA 498 HORIGIN 385 HORIGIN= graphics option 385 HORIGIN= option, GDEVICE procedure 385 horizontal axis contour plots 1116 horizontal bar charts 7, 991 creating 1016 error bars in 1079 GAREABAR procedure 934 midpoints and statistics in 1076 statistics in 1036 horizontal variables along nonlinear curve 1565 G3GRID procedure 1565 host commands, executing after driver initialization 357 after graph production 408 before graph production 410 Host Commands window (GDEVICE) 1141 Host File Options window (GDEVICE) 1141 HOSTSPEC 385 HOSTSPEC= option, GDEVICE procedure 385 HPOS 386 HPOS function (DSGI) 828, 883 HPOS= graphics option 386 HREF attribute 325 HREF= option BUBBLE statement (GPLOT) 1330 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1344 HREVERSE option BUBBLE statement (GPLOT) 1330 PLOT statement (GCONTOUR) 1104 PLOT statement (GPLOT) 1345 HSB color codes 172 HSIZE 386 HSIZE function (DSGI) 829, 884 HSIZE= graphics option 386 setting size of graphics area 94 HSIZE= option, GDEVICE procedure 386 HSLIDER statement GKPI procedure 1216 HSPACE 573 HSV color codes 172 HSYS variable, Annotate facility 710 HTEXT 387 HTEXT= graphics option 387 HTITLE 387 HTITLE= graphics option 293, 388 HTML character entities 638 HTML destination, ODS 189 HTML drill-down mode 484, 612, 615 HTML les, creating with ODS HTML (example) 313 HTML function (DSGI) 830, 884 HTML= option adding data tips 600 BAR statement (GBARLINE) 967 BLOCK statement (GCHART) 1010 BLOCK statement (GMAP) 1253
CHART statement (GRADAR) 1418 CHORO statement (GMAP) 1262 drop-down links 603 GCHART procedure 326 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1026 PIE, PIE3D, DONUT statements (GCHART) 1045 PLOT statement (GBARLINE) 978 PLOT statement (GPLOT) 1345 PRISM statement (GMAP) 1269 STAR statement (GCHART) 1061 HTML output Java 473 HTML pages bar chart with drill-down (example) 321 combining graphs and reports (example) 315 HTML variable, Annotate facility 711 HTMLFILE= macro argument 580 HTMLFREF= macro argument 580 HTML_LEGEND= option BAR statement (GBARLINE) 967 BLOCK statement (GCHART) 1010 BLOCK statement (GMAP) 1253 CHART statement (GRADAR) 1418 CHORO statement (GMAP) 1262 drop-down links 603 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1026 PIE, PIE3D, DONUT statements (GCHART) 1045 PLOT statement (GBARLINE) 978 PLOT statement (GPLOT) 1345 PRISM statement (GMAP) 1270 STAR statement (GCHART) 1061 HTRAFFICLIGHT statement GKPI procedure 1216 hyperlinks titles and footnotes as 288 HZERO option BUBBLE statement (GPLOT) 1330 PLOT statement (GPLOT) 1345
I
I= option, SYMBOL statement 254 IBACK 388 IBACK= graphics option 180, 388 IBACKLOG= macro argument 584 IBACKPOS= macro argument 584 IBACKURL= macro argument 584 IBACKX=, IVBACKY= macro arguments IBM printers external writes with 382 JES form name 372 JES SYSOUT destination 370 output class 368 ID 389 ID= option, GDEVICE procedure 389 ID statement GINSIDE procedure 1197 GMAP procedure 1245, 1614 GPROJECT procedure 1397 GREDUCE procedure 1442 GREMOVE procedure 1455 MAPIMPORT procedure 1588, 1590 identication variables 1240
584
1706
Index
IFRAME= option 182 BUBBLE statement (GPLOT) 1330 CHART statement (GRADAR) 1418 GSLIDE procedure 1512 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1026 PLOT statement (GPLOT) 1345 IGOUT argument ? statement (GREPLAY) 1474 LIST statement (GREPLAY) 1482 IGOUT= option PROC GREPLAY statement 1472 IGOUT statement GREPLAY procedure 1481 image les 88 IMAGE function, Annotate facility 1629 IMAGE function, DSGI 862 image map data sets GMAP procedure 1244 image maps 326 IMAGE= option, PATTERN statement 183, 239 image quality across devices 65 image resolution and size exporting graphs to Microsoft Ofce 112 IMAGEMAP= option GSLIDE procedure 1512 PROC GANNO statement 915 PROC GBARLINE statement 959 PROC GCHART statement 1005 PROC GMAP statement 1244 PROC GPLOT statement 1323 PROC GREPLAY statement 1472 IMAGEPOSX= parameter, JAVA 498 IMAGEPRINT 389 IMAGEPRINT GOPTIONS statement 389 images 179 adding to bar charts 1038 adding to bar-line charts 957 Annotate facility to draw 684 as graph background 388, 390 as pattern lls 239 background 180 backplane 182 disabling as output 389 displaying with Annotate facility 185 displaying with DSGI 186, 862 le types, list of 179 GBARLINE procedure 955 in text slides 1513 interlacing 391 on chart bars 183 transparent 428 IMAGESTYLE 390 IMAGESTYLE= graphics option 181, 390 IMAGESTYLE= option BUBBLE statement (GPLOT) 1331 CHART statement (GRADAR) 1418 GSLIDE procedure 1513 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1027 PATTERN statement 240 PLOT statement (GPLOT) 1345 IMGPATH variable, Annotate facility 712, 722 importing maps from ESRI shapeles 1241
importing graphs into Microsoft Excel 119 into Microsoft Ofce 118 into Microsoft PowerPoint 120 into Microsoft Word 118 inactive color lists 1211, 1212 INBORDER option CHART statement (GRADAR) 1419 INCOMPLETE option PROC GCONTOUR statement 1099 indexing lename 99 lookup data sets 1153 INHEIGHT= option CHART statement (GRADAR) 1419 initializing drivers, executing before 356 input data sets automatic locking 56 G3D procedure 1536 G3GRID procedure 1565 requirements for 55 specifying 54 specifying with le specication 55 specifying with library reference 54 input map data sets GREDUCE procedure 1439 GREMOVE procedure 1451 hierarchy of current unit areas 1397 ordering observations 1454 output data sets as 1449 input (user), enabling 431 INSERT function (DSGI) 869 INSIDE= option BAR statement (GBARLINE) 967 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1027 INSIDEONLY option PROC GINSIDE statement 1196 installation ActiveX Control 457 installing Java plug-in 490 integer-based font rendering 359 INTERACTIVE 390 interactive contour plots generating in ActiveX 465 interactive line mode 53 interactive Metagraphics output 428, 533 character rotation angle 421 description string 389 enhancing Web presentations for 535 hardware text rotation angle 401 interactivity of 390 negative handshaking response 396 ODS with 534 run-time controls 536 sample programs 538 TRAILER records 427 translating metale into device commands 410 user-written part, les for 411, 412 INTERACTIVE= option, GDEVICE procedure 390 interactive output Java 471 interface devices 73 INTERLACED 391 INTERLACED GDEVICE procedure 391 INTERLACED GOPTIONS statement 391
Index 1707
interlacing images 391 internal coordinates, Annotate facility 654, 740 international characters 157 internationalization ActiveX and 460 Java and 474 Metaview Applet 535 INTERPOL 391 INTERPOL= graphics option 391 INTERPOL= option, SYMBOL statement 252, 254 interpolation box plots 252, 254, 269, 301 connecting data points with straight lines 257 data value inclusion 264 default method, specifying 273 default value for 391 high-low plots 256 language 257 needle plots 258 partial spline 1578 regression analysis 259 regression analysis plots 259 smoothing plot lines 257 spline interpolation 261, 274 step plots 263 interpolation methods bivariate 1566 default method 1573 G3GRID procedure 1566 plot overlays 982 plots 1319 spline 1566, 1580 spline smoothing 1567, 1576 INTERTILE= option CHART statement (GRADAR) 1419 INTERVAL= option, AXIS statement options 199 INVISIBLE= option PIE, PIE3D, DONUT statements (GCHART) 1046 IP geocoding data converting from MaxMind, Inc. 1152 ITERATION 392 ITERATION= graphics option 392, 523
J
J= option AXIS statement options 209 LEGEND statement options 231 POINTLABEL= specication 265 TITLE, FOOTNOTE, and NOTE statements Java applets 442, 443 authentication 639 CLASSPATH environmental variables 639 Java archive les location of 488 JAVA device 93 for interactive output 472 special fonts and symbols 474 JAVA device driver 452 Java devices 73 Java output conguring drill-down 477 examples of interactive output 477 generating 472 HTML 473 HTML drill-down mode 484
285, 293
interactive 471 JAVA device for 472 languages and 474 local drill-down mode 477 SAS formats supported for 474 script drill-down mode 479 special fonts and symbols 474 URL drill-down mode 481 Java parameters and attributes 487 Java plug-in installing 490 location of 490 Java Runtime Environment (JRE) plug-in HTML output and 473 Java support 1594 Annotate functions 1627 G3D procedure 1625 GAREABAR procedure 1604 GBARLINE procedure 1605 GCHART procedure 1607 GCONTOUR procedure 1612 GMAP procedure 1614 GOPTIONS statement 1596 GPLOT procedure 1617 GRADAR procedure 1622 LEGEND statement 1600 PATTERN statement 1601 SYMBOL statement 1602 TITLE and FOOTNOTE statements 1604 JAVAIMG device 94 JAVAIMG device driver 448, 453 GIF, JPEG, SVG, PNG vs. 508 Web presentations, developing 512 JAVAMETA device driver 453, 533, 534 enhancing Web presentations for 535 run-time controls 536 sample programs 538 JavaScript drill-down with ActiveX 466, 468 JOIN option GRID statement (G3GRID) 1570 PLOT statement (GCONTOUR) 1104 joins contour plots 1120 JPEG device data tips for 600 JPEG device driver 453 ACTXIMG, JAVAIMG vs. 508 developing web presentations 510 HTML les, generating 511 JPEG presentations 448 JSTYLE option PIE, PIE3D, DONUT statements (GCHART) justication axis labels 199, 206, 207 donut chart labels 1052 legend label 226 legend text 231 legend values 231 plot print labels 265 text in graphics output 285 JUSTIFICATION= option GKPI procedure 1214 JUSTIFY= option AXIS statement options 209 LEGEND statement options 231
1046
1708
Index
POINTLABEL= specication 265 TITLE, FOOTNOTE, and NOTE statements 285, 293 JUSTIFY= suboption LABEL= option, DONUT statement (GCHART) 1052
K
kern data sets 1186 creating 1186 variables 1186 KERNDATA= option PROC GFONT statement 1175 kerning 1186 key performance indicators See KPIs KEYMAP 392 KEYMAP= graphics option 392 KPI charts 20 KPIs 1203 actual values 1208 boundary values 1209 bullet graph charts 1204, 1222 chart types 1203 color lists 1211 dial charts 1205, 1223 fonts 1214 segment boundaries 1208 segment colors 1209 slider charts 1204 speedometer charts 1205, 1224, 1225 tick mark values 1209 trafc light charts 1206, 1226
L
L= option, SYMBOL statement 264, 275 LA= option, TITLE, FOOTNOTE, and NOTE statements 286 LABEL function, Annotate facility 1629 %LABEL macro, Annotate facility 748 LABEL= option AXIS statement 1595 AXIS statement options 199 DONUT statement 1612 DONUT statement (GCHART) 1046 GKPI procedure 1219 LEGEND statement 1601 LEGEND statement options 226 LABEL statement 35 labeling maps data sets for 1238 LABELLEVEL= option FLOW, TILE, TOGGLE statements (GTILE) 1526 labels axes 199, 206 bubbles in bubble plots 1326 BY lines 215 contour lines 267, 1116 contour plots 1114, 1115 donut charts 1051 legends 226 pie chart slices 1052, 1085 plot bubbles (example) 1358 plot points 264 star charts 1064 LABELS= macro argument 573
lakes 1287 Lamberts conformal projection 1391, 1397, 1398 specifying 1396 landscape orientation 393, 394, 420 language, interpolation 257 language elements used by programs 31 LANGUAGE= option, TITLE, FOOTNOTE, and NOTE statements 286 languages ActiveX and 460 in Java 474 LAT variable 1235 example 1236 latitude See also geocoding coordinate values 1388 maximum, for projections 1394 minimum, for projections 1394 of geocoding location 1159 projection pole for gnomonic projection 1396 units as degrees 1394 LATMAX= option PROC GPROJECT statement 1394 LATMIN= option PROC GPROJECT statement 1394 LAUTOHREF= option BUBBLE statement (GPLOT) 1331 PLOT statement (GCONTOUR) 1105 PLOT statement (GPLOT) 1345 LAUTOREF= option BAR statement (GBARLINE) 967 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1027 PLOT statement (GBARLINE) 978 LAUTOVREF= option BUBBLE statement (GPLOT) 1331 PLOT statement (GCONTOUR) 1105 PLOT statement (GPLOT) 1346 LAYOUT= macro argument 573 LCOLFMT= macro argument 574 LCOLOR= macro argument 574 LCOLS 393 LCOLS= option, GDEVICE procedure 393 LCOLVAL= macro argument 574 LDATA= macro argument 574 LEFTMARGIN GDEVICE procedure 386 LEFTMARGIN GOPTIONS statement 386 LEGEND 224 LEGEND denitions displaying values of 1309 LEGEND option PLOT statement (GPLOT) 1346 PROC GOPTIONS statement 1311 AREA statement (GMAP) 1246 BAR statement (GBARLINE) 967 BLOCK statement (GCHART) 1010 BLOCK statement (GMAP) 1254 CHORO statement (GMAP) 1262 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1028 PIE, PIE3D, DONUT statements (GCHART) 1046 PLOT statement (GBARLINE) 979 PLOT statement (GCONTOUR) 1105 PRISM statement (GMAP) 1270
Index 1709
STAR statement (GCHART) 1061 LEGEND statement 33, 196, 224, 388 ActiveX and Java support for 1600 lling areas in overlay plot (example) 1370 generating overlay plot (example) 1367 using 234 LEGENDFONT= parameter, JAVA 498 LEGENDHEIGHTPERCENT= parameter, JAVA 498 LEGENDIT= parameter, JAVA 498 LEGENDPERCENT= parameter, JAVA 498 legends bar-line charts 967 contour plots 1116 drop shadows 396 formatting 223 offset 227, 235 origins 228, 236 placement in graphics output area 66 plots 978, 979 plots with three variables 1354 spacing around 227, 236 suppressing 970 LEGENDWIDTHPERCENT= parameter, JAVA 498 LENGTH= option, AXIS statement options 200 LEVELOFDETAIL= parameter, JAVA 499 LEVELS= option AREA statement (GMAP) 1247 BAR statement (GBARLINE) 968 BLOCK statement (GCHART) 1010 BLOCK statement (GMAP) 1254 CHORO statement (GMAP) 1262 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1028 PIE, PIE3D, DONUT statements (GCHART) 1047 PLOT statement (GCONTOUR) 1105 PRISM statement (GMAP) 1270 STAR statement (GCHART) 1061 LFACTOR 393 LFACTOR= graphics option 393 LFACTOR= option, GDEVICE procedure 393 LFONT= option GKPI procedure 1214, 1219 LFRAME= option, GSLIDE procedure 1513 LFROM= macro argument 574 LHREF= option BUBBLE statement (GPLOT) 1331 PLOT statement (GCONTOUR) 1105 PLOT statement (GPLOT) 1346 LIBNAME statement 35, 36 librefs GFONT0 1167 specifying input data sets 54 LIFO stack 659, 699 light source coordinates prism maps 1273 LIGHTING= parameter, JAVA 499 LINCOLOR function (DSGI) 831, 885 LINE function (DSGI) 862 %LINE macro, Annotate facility 749 LINE option LEGEND statement options 229 LINE= option, SYMBOL statement 264, 275 line plots 13 line segments 1167 line smoothing 257 language, interpolation 257
spline interpolation 261, 274 line type for reference lines 967, 968, 978, 979 line types axis 207 default line thickness 393 plots 264, 275 LINE variable, Annotate facility 713 lines dashed, hardware-generated 348 dashed, length of 349 displaying with DSGI 862 GBARLINE procedure 955, 956 in graphics output area 284 lines, drawing with Annotate facility 679 LININDEX function (DSGI) 831, 886 LINK element (HTML) 589 LINK= option, TITLE, FOOTNOTE, and NOTE statements 288 link variables in Web presentations 603 links bar-line charts 967 plots 978 LINKTYPE= macro argument 574 LINREP function (DSGI) 832, 887 LINTYPE function (DSGI) 833, 888 LINWIDTH function (DSGI) 834, 888 LIST statement GDEVICE procedure 1134 GREPLAY procedure 1481 LISTING destination 40, 41 sending output to GRAPH window 43 listing destination, ODS 189 LJOIN option PLOT statement (GCONTOUR) 1106 LLEVELS= option PLOT statement (GCONTOUR) 1106 LLX= option TDEF statement (GREPLAY) 1488 LLY= option TDEF statement (GREPLAY) 1488 LOADFUNC= parameter, JAVA 499 local drill-down mode 477, 611 customizing levels 615 local fonts 1645 local statements RUN-group processing and 56 LOCALE= parameter, JAVA 499 locking input data sets 56 LODCOUNT= parameter, JAVA 499 log, writing in (DSGI) 864 log messages, waiting to display 415 logarithmic axes 200, 296, 974, 1036 plots 1321 LOGBASE= option, AXIS statement 200, 296 LOGRESOURCES= graphics option 537 LOGRESOURCES parameter, Metaview Applet 535 LOGSTYLE= option, AXIS statement 200 LOGSTYLE= option, TITLE, FOOTNOTE, and NOTE statements 296 LONG variable 1235 example 1236 longitude See also geocoding coordinate values 1388
1710
Index
maximum, for projections 1394 minimum, for projections 1394 of geocoding location 1159 projection pole for gnomonic projection 1396 units as degrees 1394 values increase to east 1394 LONGMAX= option PROC GPROJECT statement 1394 LONGMIN= option PROC GPROJECT statement 1394 lookup data sets 1147 alternate 1150 attribute variables 1158 city names 1159 default 1149 indexing 1153 latitude of geocoding location 1159 longitude of geocoding location 1159 non-address values 1159 postal abbreviation for states 1159 ZIP + 4 extensions 1159 ZIP code values 1159 LOOKUP= option PROC GEOCODE statement 1158 LOOKUPCITYVAR= option PROC GEOCODE statement 1159 LOOKUPKEYVAR= option PROC GEOCODE statement 1159 LOOKUPPLUS4VAR= option PROC GEOCODE statement 1159 LOOKUPSTATEVAR= option PROC GEOCODE statement 1159 LOOKUPVAR= option PROC GEOCODE statement 1159 LOOKUPXVAR= option PROC GEOCODE statement 1159 LOOKUPYVAR= option PROC GEOCODE statement 1159 LOOKUPZIPVAR= option PROC GEOCODE statement 1159 looping animation 392 LOWBOUNDARY option GKPI procedure 1219 LPT= macro argument 574 LREF= option BAR statement (GBARLINE) 968 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1028 PLOT statement (GBARLINE) 979 LROWS 394 LROWS= option, GDEVICE procedure 394 LRX= option TDEF statement (GREPLAY) 1488 LRY= option TDEF statement (GREPLAY) 1488 LS= option, TITLE, FOOTNOTE, and NOTE statements 288 LSPACE= option, TITLE, FOOTNOTE, and NOTE statements 288 text break and 293 LSPOKES= option CHART statement (GRADAR) 1419 LSTARCIRCLES= option CHART statement (GRADAR) 1419 LSTARS= option CHART statement (GRADAR) 1419
LSTIP= macro argument 574 LSTIPFAC= macro argument 575 LTIP= macro argument 575 LTIPFMT= macro argument 575 LTO= macro argument 575 LVALUE= macro argument 575 LVREF= option BUBBLE statement (GPLOT) 1331 PLOT statement (GCONTOUR) 1106 PLOT statement (GPLOT) 1347 LWHERE= macro argument 575 LWIDTH= macro argument 575
M
M= option, TITLE, FOOTNOTE, and NOTE statements 288, 293 macro variables, names for 596 macros color utility macros 175 macros, Web output 441 MAJOR= option, AXIS statement 201, 1595 major tick marks 201, 211 formatting 212 offset 203 scatter plots 1551 suboptions, list of 1595 surface plots 1543 with datetime values (example) 294 MAKEHTML= macro argument 580 MAKEXML= macro argument 580 Map applet 443, 471 drill-down tags 610 parameters for, list of 490 map areas 1240 clipping 1404 dening 1245 displaying 1240 emphasizing 1402 MAP= argument PROC GINSIDE statement 1196 map data sets 1234 See also feature tables accessing descriptions of 1284 clipping 1398, 1404 combining unit areas 1449 comparing X and Y coordinates to 1195 containing X, Y, LONG, and LAT 1236 containing X and Y 1236 creating 1287 customizing 1284 GPROJECT procedure and 1397 importing ESRI les as 1585, 1586 input map data sets 1387 lakes and 1287 LONG and LAT variables 1235 projecting 1286 projecting coordinates from spherical to Cartesian reducing 1285 removing internal boundaries 1449 required variables 1234 response data sets with 1238 running examples and 29 SEGMENT variable 1235 subsetting 1285, 1444 traditional 1234
1385
Index 1711
used as input 1449 MAP element (HTML) 326 MAP= option PROC GMAP statement 1244 map polygons reordering 1588 mapimport 1586 MAPIMPORT procedure 1585 excluding variables from SHP shapeles 1590 ID statement 1590 including all variables from SHP shapeles 1589 including selected variables from DBF shapeles 1590 including selected variables from SHP shapeles 1589 PROC MAPIMPORT statement 1586 reordering map polygons 1588 syntax 1586 %MAPLABEL macro, Annotate facility 750 mapping values from GINSIDE procedure 1198 maps 17 See also block maps See also choropleth maps See also prism maps See also surface maps block 1230 choropleth 1231 contiguous projections 1395 creating color maps 1499 creating with feature tables 1304 data sets for annotating 1238 default projection specications 1399 emphasizing map areas 1402 formats for 1281 GMAP procedure 1230 importing from ESRI shapeles 1241 labeling provinces 1298 outline map of Africa 1460 prism 1232 reducing 1437 reducing map of Canada 1445 removing borders 1449 removing internal boundaries from 1449 removing state boundaries from U.S. map 1455 SAS Maps Online 1241 surface 1233 MARCOLOR function (DSGI) 834, 889 MARINDEX function (DSGI) 835, 890 Marker font 1642 marker symbol suppressing 980 MARREP function (DSGI) 836, 890 MARSIZE function (DSGI) 837, 891 MARTYPE function (DSGI) 838, 892 MATCHCOLOR option PIE, PIE3D, DONUT statements (GCHART) 1047 STAR statement (GCHART) 1061 _MATCHED_ variable 1148 Math font 1638 MAXCOLORS 394 MAXCOLORS= option, GDEVICE procedure 394 MAXDISP function (DSGI) 838 MAXIS= option BAR statement (GBARLINE) 968 BLOCK statement (GCHART) 1010 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1028
MaxMind, Inc. converting IP geocoding data from 1152 %MAXMIND autocall macro 1152 MAXNVERT= option CHART statement (GRADAR) 1419 MAXPOLY 395 MAXPOLY= option, GDEVICE procedure 395 MEAN option BAR statement (GBARLINE) 968 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1029 mean statistic 953, 968, 1001 numeric variable for 972 MEANLABEL= option HBAR, HBAR3D statements (GCHART) 1029 Melissa Data 1151 memory loading data sets into 1154 memory, open software fonts 360 MENUREMOVE= parameter, JAVA 499 MESSAGE function (DSGI) 893 message queuing 415 messages, writing in, DSGI for 864 metacodes 533 outputting with HTML from ODS (example) 538 METACODES= graphics option 537 metacodes zoom control 537 METACODESLABEL= graphics option 537 metadata adding to PDF les 122, 123 metagraphics device drivers translation command 411 Metagraphics device drivers color space specication 344 header generation 384 metacode le format 364 Metagraphics output, interactive 428, 533 character rotation angle 421 description string 389 enhancing Web presentations for 535 hardware text rotation angle 401 interactivity of 390 negative handshaking response 396 ODS with 534 run-time controls 536 sample programs 538 TRAILER records 427 translating metale into device commands 410 user-written part, les for 411, 412 Metagraphics window (GDEVICE) 1140 METAMAPS data set 1237 Metaview applet 446, 533, 534 enhancing Web presentations for 535 non-English resources and fonts 535 parameters, list of 536 run-time controls 536 sample programs 538 Microsoft Excel importing graphs into 119 Microsoft Ofce default CGM lter for 118 exporting graphs to 111 importing graphs into 118 Microsoft PowerPoint importing graphs into 120
1712
Index
Microsoft Word generating ActiveX graphs for 463 importing graphs into 118 sending output to RTF les 46 midpoint axes 968 MIDPOINT variable, Annotate facility 714 midpoints character 950 continuous numeric 951 discrete numeric 950 for numeric chart variable 968 GBARLINE procedure 950 GCHART procedure 996, 998 in horizontal bar charts 1076 in prism maps 1301 missing values and 969 ordering and selecting 952, 975, 1000 ordering and selecting for bar charts 1037 suppressing 970 values for bars 968 MIDPOINTS= option AREA statement (GMAP) 1247 BAR statement (GBARLINE) 968 BLOCK statement (GCHART) 1011 BLOCK statement (GMAP) 1254 CHORO statement (GMAP) 1263 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1029 PIE, PIE3D, DONUT statements (GCHART) 1047 PRISM statement (GMAP) 1270 STAR statement (GCHART) 1062 MIDPOINTS=OLD option BLOCK statement (GCHART) 1011 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1030 PIE, PIE3D, DONUT statements (GCHART) 1048 STAR statement (GCHART) 1062 military ZIP codes 1151 MINILEGENDFONTSIZE= parameter, JAVA 499 MINLNKWT= macro argument 576 MINOR= option AXIS statement 202, 1595 BAR statement (GBARLINE) 969 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1030 PLOT statement (GBARLINE) 979 minor tick marks 202, 211, 969 formatting 212 plot overlays 979 suboptions, list of 1595 with datetime values (example) 294 MISSING option AREA statement (GMAP) 1248 BAR statement (GBARLINE) 969 BLOCK statement (GCHART) 1011 BLOCK statement (GMAP) 1255 CHART statement (GRADAR) 1420 CHORO statement (GMAP) 1264 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1030 PIE, PIE3D, DONUT statements (GCHART) 1048 PRISM statement (GMAP) 1271 STAR statement (GCHART) 1062 missing values GBARLINE procedure 954 GCHART procedure 998
GCONTOUR procedure 1098 GTILE procedure 1520 in Annotate data sets 657 midpoints and 969 plot data sets 1321, 1348 MISSINGCOLOR= parameter, JAVA 500 MODE= option CHART statement (GRADAR) 1420 LEGEND statement 227, 236 PROC GKPI statement 1215 SYMBOL statement 264 MODEL 395 model number, output device 395 MODEL= option, GDEVICE procedure 395 modes 53 MODIFY statement GDEVICE procedure 1135 GREPLAY procedure 1482 MODULE 395 MODULE= option, GDEVICE procedure 395 MOVE function, Annotate facility 687, 1630 %MOVE macro, Annotate facility 750 MOVE= option, TITLE, FOOTNOTE, and NOTE statements 288, 293 MOVE statement GREPLAY procedure 1483 multiline axis values 206 legend labels 232 Music font 1643 MWIDTH= option PROC GFONT statement 1175
N
N= option AXIS statement options 212 N1= option PROC GREDUCE statement 1441 N2= option PROC GREDUCE statement 1441 N3= option PROC GREDUCE statement 1441 N4= option PROC GREDUCE statement 1441 N5= option PROC GREDUCE statement 1441 NACTION= macro argument 576 NAK 396 NAK= option, GDEVICE procedure 396 NAME= argument PROC GFONT statement 1169, 1173 NAME= macro argument 573 NAME= option BAR statement (GBARLINE) 969 BLOCK statement (GCHART) 1012 BLOCK statement (GMAP) 1255 BUBBLE statement (GPLOT) 1332 CHART statement (GRADAR) 1420 CHORO statement (GMAP) 1264 FLOW, TILE, TOGGLE statements (GTILE) 1527 GKPI procedure 1220 GSLIDE procedure 1513 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1030
Index 1713
PIE, PIE3D, DONUT statements (GCHART) 1048 PLOT statement (G3D) 1542 PLOT statement (GCONTOUR) 1106 PLOT statement (GPLOT) 1347 PRISM statement (GMAP) 1271 PROC GANNO statement 915, 921 SCATTER statement (G3D) 1548 STAR statement (GCHART) 1062 SURFACE statement (GMAP) 1277 TREPLAY statement (GREPLAY) 1491 NAME= parameter, JAVA 500 names Annotate facility 647, 655, 658 BY line catalog entries 216 color-naming schemes 168 colors 174 device nicknames 370 executable driver modules 395 lename extensions 359 fonts 1649, 1650 GRSEGs 102 macro variables 596 output lenames 102 paper type 401 native SAS/GRAPH devices 73 NAVIGATERENDERMODE= parameter, JAVA 500 NAXIS1= option GRID statement (G3GRID) 1570 NAXIS2= option GRID statement (G3GRID) 1571 NCOLS= option CHART statement (GRADAR) 1420 NCOLVAL= macro argument 576 NDATA= macro argument 576 NEAR= option GRID statement (G3GRID) 1571 needle plots 258 negative values block charts 1015 GTILE procedure 1520 _NEXT_ option LIST statement (GDEVICE) 1134 NFNTNAME= macro argument 576 NFNTSIZE= macro argument 577 NFNTSTYL= macro argument 577 NID= macro argument 577 NLABEL= macro argument 577 NLEVELS= option CHART statement (GRADAR) 1420 PLOT statement (GCONTOUR) 1107 NLINES= option SURFACE statement (GMAP) 1277 noadmgdf 332 NOADMGDF option 332 noautocopy 334 NOAUTOCOPY option 334 NOAUTOFEED option 335 NOAVALUE option GKPI procedure 1218 NOAXES option PLOT statement (GPLOT) 1347 NOAXIS option BAR statement (GBARLINE) 970 BUBBLE statement (GPLOT) 1332 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1030
PLOT statement (G3D) 1542 PLOT statement (GBARLINE) 979 PLOT statement (GCONTOUR) 1107 PLOT statement (GPLOT) 1347 SCATTER statement (G3D) 1549 NOBASEREF option BAR statement (GBARLINE) 970 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1031 NOBRACKETS option, AXIS statement options 202 NOBUILD argument PROC GFONT statement 1170 NOBVALUE option GKPI procedure 1218 NOBYLINE option PROC GREPLAY statement 1472 NOBYLINE statement GREPLAY procedure 1484 NOCELL option 338 NOCHARACTERS option 339 NOCIRCLEARC option 341 NOCITY option PROC GEOCODE statement 1159 NOCOLLATE option 342 NOCONNECT option STAR statement (GCHART) 1062 NODASH option 348 NODATELINE option PROC GPROJECT statement 1395 node-link diagrams 445, 546, 555 chart with simple arcs (example) 562 chart with weighted arcs (example) 564 DS2CONST macro with 557 hotspots 568 when to use 556 XML written to external le (example) 566 NODEBDR= macro argument 585 NODECYCLE option PROC GREMOVE statement 1453 NODESHAP= macro argument 585 NODISPLAY 355 NODISPLAY option 355 PROC GFONT statement 1175 NODROPCOLLISIONS option SYMBOL statement 264 NODRVQRY= option, GDEVICE procedure, executing before driver initialization 356 NOERASE= graphics option 358 NOERASE= option, GDEVICE procedure 358 NOFASTTEXT= graphics option 359 NOFILEONLY= graphics option 362 NOFILL= graphics option 362 NOFILL= option, GDEVICE procedure 362 NOFRAME option BAR statement (GBARLINE) 966 BUBBLE statement (GPLOT) 1329 CHART statement (GRADAR) 1417 HBAR, HBAR3D, VBAR, VBAR3D statements 936 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1024 PLOT statement (GCONTOUR) 1107 PLOT statement (GPLOT) 1343 NOFS option PROC GDEVICE statement 1129 PROC GREPLAY statement 1472 NOGFOOTNOTE= option, ODS HTML statement 192
1714
Index
NOGRAPHRC= graphics option 376 NOGROUPHEADING option PIE, PIE3D, DONUT statements (GCHART) 1048 STAR statement (GCHART) 1063 NOGTITLE= option, ODS HTML statement 192 NOHEADING option BLOCK statement (GCHART) 1012 PIE, PIE3D, DONUT statements (GCHART) 1048 STAR statement (GCHART) 1063 NOIMAGEPRINT GOPTIONS statement 188, 389 NOIMAGEPRINT graphics option 188, 389 NOJSOOBJECT= parameter, JAVA 500 NOKEYMAP option PROC GFONT statement 1171, 1175 NOLABEL option PLOT statement (G3D) 1542 SCATTER statement (G3D) 1549 NOLEGEND option AREA statement (GMAP) 1248 BAR statement (GBARLINE) 970 BLOCK statement (GCHART) 1012 BLOCK statement (GMAP) 1255 CHART statement (GRADAR) 1420 CHORO statement (GMAP) 1264 HBAR, HBAR3D, VBAR, VBAR3D statements 937 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1031 PIE, PIE3D, DONUT statements (GCHART) 1048 PLOT statement (GCONTOUR) 1107 PLOT statement (GPLOT) 1347 PRISM statement (GMAP) 1271 STAR statement (GCHART) 1063 NOLINE option PLOT statement (GBARLINE) 980 NOLIST option PROC GOPTIONS statement 1311 NOLOG option PROC GOPTIONS statement 1312 NOLOWBOUNDARY option GKPI procedure 1219 NOMARKER option PLOT statement (GBARLINE) 980 non-roman alphabet fonts 1638 NONEEDLE option SCATTER statement (G3D) 1549 noninteractive line mode 53 NONINTERLACED GDEVICE procedure 391 NONINTERLACED GOPTIONS statement 391 nonlinear curves horizontal variables along 1565 NOPCLIP 402 NOPIEFILL GDEVICE procedure 405 NOPIEFILL GOPTIONS statement 405 NOPLANE option HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1031 NOPLANE option, AXIS statement options 202 NOPROMPT= graphics option 380 NOROMAN option PROC GFONT statement 1171 NOROMHEX option PROC GFONT statement 1171 NOSCALE option GRID statement (G3GRID) 1571 NOSTATS option HBAR, HBAR3D statements (GCHART) 1031
NOSTIMER option PROC GEOCODE statement 1159 NOTE 279 NOTE statement 33, 196, 279, 292 BY statement with 218 notes 292 angle of rotation 280, 286, 289 boxes around 282, 283 colors for 282, 283, 346, 347 default characteristics, setting 292 dening text of 289, 293 fonts for 284 justication 285 positioning 288 size of 285, 387 spacing around 288 text breaks 293 underlining 291 NOTRANSPARENCY GOPTIONS statement 428 NOTRANSPARENCY= graphics option 523 NOTSORTED option BY statement (GREMOVE) 1454 NOTSORTED= option, BY statement 215 NOZERO option BAR statement (GBARLINE) 970 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1031 NOZEROREF option CHART statement (GRADAR) 1420 NOZIP option PROC GEOCODE statement 1160 NPARENT= macro argument 577 NPW= macro argument 577 NROWS= option CHART statement (GRADAR) 1421 NSCBACK= macro argument 577 NSCTEXT= macro argument 577 NSDATA= macro argument 577 NSFNTNAM= macro argument 578 NSFNTSIZ= macro argument 578 NSFNTSTY= macro argument 578 NSHAPE= macro argument 578 NSID= macro argument 578 NSIZE= macro argument 578 NSPW= macro argument 578 NSTYLE= macro argument 578 NSWHERE= macro argument 579 NTEXTCOL= macro argument 579 NTIP= macro argument 579 NTIPFMT= macro argument 579 NUMBER= option, AXIS statement options 212 numeric chart variables 940, 998 discrete 998 numeric formats supported by ACTIVEX 461 numeric response variables 1239 numeric values continuous 999 NUMGRAPH function (DSGI) 839 NURL= macro argument 579 NVALUE= macro argument 579 NWHERE= macro argument 579 NX=, NY= macro arguments 580
Index 1715
O
OBJECT element (HTML) 487 observations in Annotate data sets 645 in output data set (G3GRID) 1572 ordering for input map data sets 1454 ODS destinations 40, 189 changing current style with STYLE= option 137 default devices for 69 default styles and 133 LISTING destination 41 opening and closing 40 storing GRSEGs with multiple destinations 101 ODS documents replaying 107 ODS HTML 237 ODS HTML statement 196, 237 bar chart with drill-down (example) 321 multiple graphs and reports in Web page (example) 315 Web page, creating (example) 313 ODS output graphic options with 193 JAVAMETA driver with 534 metacodes (example) 538 name and location of 97 RUN-group processing 192 static graphics 506 titles and footnotes, controlling 192 ODS (Output Delivery System) graphics output les and 91 ODS statement 35 ODS statements 34 generating presentations 453 JAVA and ActiveX parameters and attributes 487 ODS USEGOPT statement 193 PARAMETERS= statement for applet parameters 538 ODS styles 40, 41 specifying 42 offset angle of rotation 289 axes 203 between Bitstream font letters 366 between display area and graphic 431 between displayed area and graph 385 between ll lines 363 between graphs and display 385, 431 legend 227, 235 legends 227, 236 text in graphics output 283, 288 OFFSET= option AXIS statement options 203 LEGEND statement options 227, 235 OFFSHADOW 396 OFFSHADOW= graphics option 396 one-level names 55 open destinations, ODS 190 OPENGRAPH function (DSGI) 840 OPENMODE= macro argument 580 OPTION= option PROC GOPTIONS statement 1312 OPTIONS statement 35 ORDER= option AXIS statement options 203, 207 LEGEND statement options 228 ORDERACROSS= option CHART statement (GRADAR) 1421
ordering axis values 203 legend values 228 ORIGIN= option, AXIS statement options 205 ORIGIN= option, LEGEND statement options 228, 236 origins axes 205 legends 228, 236 OTHER= option CHART statement (GRADAR) 1421 PIE, PIE3D, DONUT statements (GCHART) 1048 OTHERCOLOR= option PIE, PIE3D, DONUT statements (GCHART) 1048 OTHERLABEL= option PIE, PIE3D, DONUT statements (GCHART) 1049 OUT= argument PROC GINSIDE statement 1196 out-of-range plot variables 955, 1321 OUT= option PROC G3GRID statement 1568 PROC GEOCODE statement 1160 PROC GPROJECT statement 1395 PROC GREDUCE statement 1441 PROC GREMOVE statement 1453 outline fonts 1167 outline maps of Africa 1460 outlines bar charts 1037 block charts 1014 color for 963 colors 248 default 246 donut charts 1053 GBARLINE procedure 955 GCHART procedure 1002 pie charts 1053 slice colors and patterns 1053 star charts 1064 OUTLINES= parameter, JAVA 500 output See also graphics output generating with procedures 43 Java interactive output 471 sending to a le 44 sending to GRAPH window 43 sending to multiple open destinations 51 sending to PDF les 47 sending to RTF les 46 sending to Web pages 45 SVG 79 output data sets as input map data set 1449 controlling observations in (G3GRID) 1572 G3GRID procedure 1565 GEOCODE procedure 1149 output lenames 102 output formats exporting graphs to Microsoft Ofce 111 output map data sets GREMOVE procedure 1451 output printer bins 397 OUTSIDE= option BAR statement (GBARLINE) 971 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1031
1716
Index
OUTTRI= option PROC G3GRID statement 1569 overdrawing graphs 418 OVERFLOWCOLOR= parameters, JAVA and ActiveX OVERLAY option PLOT statement (GPLOT) 1347 PLOT statement, GPLOT procedure 1367, 1370 overlay plots 1367, 1370 overlaying graphics, Annotate facility 658 overlaying radar charts 1428 OVERLAYVAR= option CHART statement (GRADAR) 1421 overriding devices 72
500
P
page layout PDF les 122 PAGEPART= macro argument 588 paints, plot 257 paper feed 335, 398 paper size 398, 399 paper type, specifying 401 PAPERDEST 397 PAPERDEST= graphics option 397 PAPERFEED 398 PAPERFEED= graphics option 398 PAPERFEED= option, GDEVICE procedure 398 PAPERLIMIT 398 PAPERLIMIT= graphics option 398 PAPERSIZE 399 PAPERSIZE= graphics option 399 PAPERSOURCE 400 PAPERSOURCE= graphics option 400 PAPERTYPE 401 PAPERTYPE= graphics option 401 PARADIV= option PROC GPROJECT statement 1395 PARALLEL1= option PROC GPROJECT statement 1395 PARALLEL2= option PROC GPROJECT statement 1395 parallels calculating 1398 divisor for computing 1395 specifying values for 1395 parameters JAVA and ActiveX 487, 493 PARAMETERS= option, ODS statements 487 PARAMETERS= statement, ODS statement 538 Parameters window (GDEVICE) 1138 parametric language interpolation 257 PARTIAL option GRID statement (G3GRID) 1571 partial spline interpolation 1578 PATH 401 PATH= option, GDEVICE procedure 401 PATREP function (DSGI) 906, 908 PATTERN 238 PATTERN denitions 1356 displaying values of 1309 PATTERN denitions, BY statement with 218 PATTERN option PLOT statement (GCONTOUR) 1107 PROC GOPTIONS statement 1312
PATTERN statement 33, 196, 238 ActiveX and Java support for 1601 altering/canceling 245 images on bar chart bars 183 using 245 PATTERNID= option BAR statement (GBARLINE) 971 BLOCK statement (GCHART) 1012 BY line 216 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1032 patterns assigning 971 bar charts 1038 block charts 1014 block maps 1258 changing 957 contour plots 1120 GBARLINE procedure 955 GCHART procedure 1002 pie and donut chart slices 1053 plots 1356 star charts 1064 user-dened 1003, 1014, 1038 when patterns change 1014, 1038 patterns and lls 238 bar charts 240 built-in pie-ll capability 405 built-in polygon-ll capability 406 built-in rectangle capability 416 built-in rectangle-ll capability, device 362 color for 345 contour plots 242 default 246 ll color 239 lling area between plot lines (example) 304 for symbol plots 258 images as ll elements 239 images on bar chart bars 183 outline colors 248 pattern sequences 249 pie and star charts 243 spacing between ll lines 363 PATTERNSTRIP applet parameter 613, 615 PATTERNSTRIP= parameters, JAVA and ActiveX 500 PCLIP 402 PCLIP= graphics option 402 PCOLS 403 PCOLS= option, GDEVICE procedure 403 PDF les adding bookmarks 122 adding metadata to 122 changing page layout 122 default compression level 123 examples 123 fonts 121 multipage, with bookmarks and metadata 123 multiple-page, using BY-group processing 127 multiple-page, using GREPLAY procedure 127 PDF/A-1b compliant, with multiple graphs per page 125 sending output to 47 writing graphs to 121 PEMPTY variable, Annotate facility 723 pen speed, plotters 423 PENMOUNTS 404 PENMOUNTS= graphics option 178, 404
Index 1717
pens, active 404 PENSORT 404 PENSORT= graphics option 404 PENSORT= option, GDEVICE procedure 404 PERCENT option AREA statement (GMAP) 1248 BAR statement (GBARLINE) 971 BLOCK statement (GMAP) 1255 CHORO statement (GMAP) 1264 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1032 SURFACE statement (GMAP) 1277 PIE, PIE3D, DONUT statements (GCHART) 1049 STAR statement (GCHART) 1063 percentage statistic 953, 1001 percentages overriding default format 1248 percentiles, box plots 252, 254, 269, 301 PERCENTLABEL= option HBAR, HBAR3D statements (GCHART) 1032 PERCENTSUM option HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1032 performance GEOCODE procedure 1153 permanent data sets one-level names 55 PIE and PIE3D statements GCHART procedure 1039 PIE and PIE3D statements, GCHART procedure ActiveX and Java support for 1607 pie charts 8, 993 3-D 8 angling text in (example) 797 creating 1039 detail pie charts 993, 1093 grouping and arranging 1087 ordering and labeling slices 1085 outlines 1053 patterns 243 selecting and positioning slice labels 1052 slice patterns and colors 1053 statistic and group headings 1048, 1055 subgrouping 1084 sum statistic in 1081 terminology 997 pie-ll capability, device 405 PIE function, Annotate facility ActiveX and Java support for 1631 pie slices, drawing with Annotation facility 688 PIE statement, BY statement with 217 PIECNTR function, Annotate facility 1631 PIEFILL 405 PIEFILL GDEVICE procedure 405 PIEFILL GOPTIONS statement 405 PIEXY function, Annotate facility 1632 %PIEXY macro, Annotate facility 751 PLABEL= option PIE, PIE3D, DONUT statements (GCHART) 1049 PLAY function (DSGI) 869 plot data sets 1321 plot lines 264, 275 lling area between plot lines (example) 304 type of 264 plot overlays bar-line charts 975
interpolation methods 982 legends for 979 multiple plots 986 SYMBOL denitions 981 variable to plot 980 PLOT statement G3D procedure 1539 PLOT statement, G3D procedure ActiveX and Java support for 1625 PLOT statement, GBARLINE procedure 975 ActiveX and Java support for 1605 interpolation methods 982 options 976 SYMBOL denitions 981 syntax 975 PLOT statement, GCONTOUR procedure 1099 ActiveX and Java support for 1612 AUTOLABEL= suboptions 1109 axis order 1112 contour levels 1109 options 1101 required arguments 1101 syntax 1100 PLOT statement, GPLOT procedure 1336 ActiveX and Java support for 1617 connecting plot data points (example) 1365 different scales of values (example) 1376 lling areas in overlay plot (example) 1370 generating overlay plot (example) 1367 matching plot requests 1354 multiple plot requests 1354 options 1339 plots with drill-down for Web (example) 1379 plotting three variables (example) 1373 plotting two variables (example) 1362 required arguments 1338 syntax 1337 plot statistic frequency variable for 978 specifying 980 plot symbols 1350, 1356 altering or canceling 271 built-in drawing capability 425 colors for 252, 274, 346 colors for, rotating through (example) 299 default 277 displaying with DSGI 863 fonts of 254 GBARLINE procedure 981 in Annotate graphics output 700 interpolation 391 scatter plots 1549 size of 254, 269 specifying for plot points 273 suppressing the line connecting 980 plot variables out-of-range 955 PLOT2 statement, GPLOT procedure 1351 ActiveX and Java support for 1617 different scales of values (example) 1376 matching plot requests 1354 multiple plot requests 1354 options 1353 required arguments 1352 syntax 1351 plots
1718
Index
See also bubble plots See also contour plots See also G3D procedure See also high-low plots See also line plots See also regression plots See also scatter plots See also surface plots See also three-dimensional plots See also two-dimensional plots basics of 1319 box plots 252, 254, 269, 301 classication variables with 1317 connecting plot data points (example) 1365 different scales of values in (example) 1376 drill-down functionality (example) 1379 lling areas in overlay plot (example) 1370 generating overlay plot (example) 1367 generating simple bubble plots (example) 1357 high-low plots 256 interpolation methods 1319 labeling and sizing plot bubbles (example) 1358 legends in 978 links in 978 matching plot requests 1354 missing values 1321, 1348 multiple plot requests 1354 needle plots 258 order of points 976, 978 overlay plots 1367, 1370 patterns 1356 plotting three variables (example) 1373 plotting two variables (example) 1362 regression analysis 259 regression analysis plots 259 right vertical axis to bubble plot (example) 1360 standard deviations 262 step plots 263 symbols in 1350, 1356 three variables and legend 1354 two variables 1316 two vertical axes 1318, 1355, 1360 with multiple variables 1349 plotters active pens or colors 404 drawing elements in color order 404 paper size 398 pen speed 423 PLUS4 geocoding method 1155 no matches 1160 PLUS4 option PROC GEOCODE statement 1155 PNG device data tips for 600 PNG device driver 453 ACTXIMG, JAVAIMG vs. 508 developing web presentations 510 HTML les, generating 511 PNG output sample programs for static images 516 PNG presentations 448 POINT function, Annotate facility 1632 POINTLABEL= option, SYMBOL statement 264, 1603 points, drawing with Annotate facility 693 points, plot labels for 264
specifying for plot points 267 symbols for, specifying 267, 273 POLELAT= option PROC GPROJECT statement 1396 POLELONG= option PROC GPROJECT statement 1396 %POLY, %POLY2 macro, Annotate facility 752 POLY function, Annotate facility 1632 POLYCONT function, Annotate facility 1633 %POLYCONT macro, Annotate facility 752 polygon-ll capability, device 406 polygon fonts 1167 POLYGONCLIP 406 POLYGONCLIP= graphics option 406 POLYGONFILL 406 POLYGONFILL= graphics option 406 POLYGONFILL= option, GDEVICE procedure 406 polygons clipped (intersecting) 402, 406 drawing with Annotate facility 695 drawing with DSGI 861 enclosed, as holes 1288 map data sets and 1287 multiple 1288 reordering 1588 single 1287 vertices, maximum drawn 395 %POP macro, Annotate facility 753 portrait orientation 403, 415, 420 ports, how output is written to 377 POSITION= option AXIS statement options 210 LEGEND statement options 229, 232, 235, 236 POINTLABEL= specication 265 POSITION variable, Annotate facility 716 positioning Annotate graphics 652, 653 axis labels 199, 206, 207, 210 BY lines 216 legend label 226 legend text 232 legends 229, 235 plot point labels 265 text in graphics output 288 titles and footnotes, ODS output 192 postal abbreviations 1158, 1159 postal codes functions for 1280 POSTGEPILOG 407 POSTGEPILOG= graphics option 407 POSTGPROLOG 408 POSTGRAPH= graphics option 408 POSTGRAPH= option, GDEVICE procedure 408 POSTGRAPH1 408 POSTGRAPH2 408 pound sign #, variables as plot point labels 265 PPD le, location of 409 PPDFILE 409 PPDFILE= graphics option 409 PREGEPILOG 409 PREGEPILOG= graphics option 409 PREGPROLOG 410 PREGPROLOG= graphics option 410 PREGRAPH= graphics option 410 PREGRAPH= option, GDEVICE procedure 410 PREGRAPH1 410
Index 1719
PREGRAPH2 410 presentation graphics 20 Graph-N-Go for 23 PRESENTATION option PROC GREPLAY statement 1472 PRESENTATION window 1493 _PREV_ option LIST statement (GDEVICE) 1134 PREVIEW statement GREPLAY procedure 1484 previewing device output 427 previewing output 109 printers sending graphs directly to 109 printing 109 automatic 334 collating output 342 copies to print 369 duplex 357 duplex, binding edge for 336 ow control 382 graph orientation 420 IBM printers 368, 370, 372, 382 output bin, specifying 397 paper feed 335, 398 paper size 398, 399 paper tray, specifying 400 paper type, specifying 401 PPD le, location of 409 previewing output 427 protocol module, specifying 374 redrawing (overdrawing) graphs 418 reverse printing 420 saving and printing graphs 110 prism maps 18, 1232 annotating 1267 area heights relative to zero 1272 color for empty map areas 1268 color for legend text 1269 color for outlining empty map areas 1268 color for outlining non-empty map areas 1268 color for regions 1245 creating 1266 description of catalog entry 1269 dimensions of 1274 distinct colors for response values 1269 drill down 1269 drill-down legend 1270 legends 1270 light source coordinates 1273 midpoint ranges 1272 midpoints in 1270, 1301 missing values 1271 name of GRSEG catalog entry 1271 pattern for map areas 1267 percentages 1271 percentages, overriding default format 1272 producing a simple map 1299 response levels 1270 statistics 1272 stretching 1272 suppressing legends 1248, 1271 uniform legends and coloring 1273 viewing position 1274 width of map area outlines 1273
PRISM statement GMAP procedure 1266 PRISM statement, GMAP procedure ActiveX and Java support for 1614 PROC G3D statement 1538 PROC G3GRID statement 1568 PROC GANNO statement 914 PROC GAREABAR statement 933 PROC GBARLINE statement 958 PROC GCHART statement 1004 PROC GCONTOUR statement 1098 PROC GDEVICE statement 1129 PROC GEOCODE statement 1154 options 1155 PROC GFONT statement 1168 PROC GINSIDE statement 1196 PROC GKPI statement 1215 PROC GMAP statement 1243 PROC GOPTIONS statement 1310 PROC GPLOT statement 1322 PROC GPROJECT statement 1393 options 1393 PROC GRADAR statement 1411 PROC GREDUCE statement 1440 PROC GREMOVE statement 1452 PROC GREPLAY statement 1471, 1473 PROC GREPLAY window 1493 PROC GTILE statement 1521 PROC MAPIMPORT statement 1586 PROC steps 32 procedure output area Annotate facility 654 placement of graphics in 65 procedure statements 32 procedure termination, step code at 376 procedures generating output with 43 PROC steps 32 statements 32 subordinate statements 32 PROCESS 411 PROCESSINPUT 411 PROCESSINPUT= option, GDEVICE procedure 411 PROCESSOUTPUT 412 PROCESSOUTPUT= option, GDEVICE procedure 411 product codes 27 program mode GDEVICE procedure 1127, 1128, 1129 switching from 1134 programs 31 a typical program 31 Annotate DATA set 34 Base SAS language statements 35 DSGI functions and routines in DATA step 34 global statements 33 language elements used by 31 ODS statements 34 other statements and options 32 PROC steps 32 procedure statements 32 RUN-group processing 56 running 53 subordinate statements 32 PROJECT= option PROC GPROJECT statement 1396 projecting coordinates from spherical to Cartesian
1720
Index
See Cartesian coordinates projecting map data sets 1286 projection methods 1396 PROJECTION= parameter, JAVA 500 projection pole 1396 PROJECTIONRATIO= parameter, JAVA 500 PROMPT 412 PROMPT= graphics option 412 prompt messages to GSF 379, 523 PROMPTCHARS 413 PROMPTCHARS= graphics option 413 PROMPTCHARS= option, GDEVICE procedure prompts characters for, specifying 413 for installing ActiveX Control 458 specifying if used 412 proportion image quality across devices and 65 proportional fonts 1166 protocol module, specifying 374 Province Codes 1279, 1298 PROWS 415 PROWS= option, GDEVICE procedure 415 %PUSH macro, Annotate facility 753
413
Q
QMSG 415 QMSG= option, GDEVICE procedure quality of images across devices 65 QUIT statement 35 GDEVICE procedure 1136 GREPLAY procedure 1484 RUN-group processing 192 415
R
R= option PATTERN statement 240, 250 POINTLABEL= specication 266 SYMBOL statement 278 TITLE, FOOTNOTE, and NOTE statements 289 radar charts 12, 1409 creating 1412, 1427 modifying appearance of 1431 multiple classication variables in 1430 overlaying 1428 tiling 1429 radar charts (star charts) ActiveX and Java support for 1622 patterns 243 RADIUS= option PIE, PIE3D, DONUT statements (GCHART) 1049 raised mode GKPI procedure 1206, 1215 Range geocoding data sets for 1151 range of values 971 RANGE option AREA statement (GMAP) 1248 BAR statement (GBARLINE) 971 BLOCK statement (GMAP) 1255 CHORO statement (GMAP) 1264 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1033
PRISM statement (GMAP) 1272 RANGEDATA= option PROC GEOCODE statement 1160 RANGEDECIMAL option PROC GEOCODE statement 1160 RANGEKEYVAR= option PROC GEOCODE statement 1160 raster formats 113 RAXIS= option BAR statement (GBARLINE) 971 BLOCK statement (GCHART) 1012 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1033 HBAR statement 217 PLOT statement (GBARLINE) 980 VBAR statement 217 RBSIZING= macro argument 585 reading direction of text, changing (example) 800 record length, GSF, origins 376 %RECT macro, Annotate facility 754 rectangle-ll capability, device 362, 416 rectangles, drawing with Annotate facility 673 RECTFILL 416 RECTFILL= option, GDEVICE procedure 416 redrawing graphs 418 reduced map data sets 1285 reducing maps 1437 map of Canada 1445 REF= option BAR statement (GBARLINE) 972 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1033 PLOT statement (GBARLINE) 980 REFCOL= option PROC GFONT statement 1171 reference-line labels, axis 206, 209 reference lines 972 at major tick marks 962, 977 clipping at bars 963, 977 color of 962, 963, 977 colors 1102, 1103, 1328, 13 for plot overlays 980 line type for 967, 968, 978, 979 suppressing 970 width of 973, 981 REFLABEL= option, AXIS statement options 206, 208, 1595 REFLINES option PROC GFONT statement 1171 REGEQN option PLOT statement (GPLOT) 1348 registry subkeys specifying fonts 157 regression analysis plots 259 regression plots 13 RELZERO option BLOCK statement (GMAP) 1256 PRISM statement (GMAP) 1272 RENAME function (DSGI) 870 RENAME statement GDEVICE procedure 1136 RENDER 417 RENDER= graphics option 417 rendering fonts 359, 1635 Bitstream fonts 366, 417 resolution, setting 364
Index 1721
software fonts 424 storing font les 418 RENDERLIB 418 RENDERLIB= graphics option 418 RENDERMODE= parameter, JAVA 500 RENDEROPTIMIZE= parameter, JAVA 501 RENDERQUALITY= parameter, JAVA 501 REPAINT 418 REPAINT= graphics option 418 REPAINT= option, GDEVICE procedure 418 REPEAT= option LEGEND statement options 229 REPEAT= option, PATTERN statement 240, 250 REPEAT= option, SYMBOL statement 278 repeating animation loops 392 REPLAY statement GREPLAY procedure 1485 replaying output 106 DOCUMENT procedure 106 GREPLAY procedure 106 ODS documents 107 reserved names, macro variables 596 RESET 419 RESET= graphics option 419 resetting graphics options 223, 419 RESOL= option PROC GFONT statement 1176 resolution 61, 95, 97 display device 434, 435, 436, 437 exporting graphs to Microsoft Ofce 112 image interlacing 391 software fonts 364 RESOURCESFONTNAME= graphics option 537 response axis chart statistic and 974, 1036 response data displaying 1240 response data sets 1238 map data sets with 1238 merging with feature tables 1237 response levels 1239 in block maps 1292 response variables 1239 assigning formats to 1293 GBARLINE procedure 952 statistics for 1295 RESPONSESTAT= option HBAR, HBAR3D, VBAR, VBAR3D statements 937 RETAIN statement 656 return characters at record ends 371 return codes 376, 908 REVERSE 420 REVERSE= graphics option 420 reversing black and white 423 RGB color codes 169 SAS color names 173 RIGHTMARGIN= option, GDEVICE procedure 386 RIGHTMARGIN= option, GOPTIONS statement 386 roles 612 Roman alphabet text fonts 1638 ROMCOL= option PROC GFONT statement 1171 ROMFONT= option PROC GFONT statement 1172 ROMHEX option PROC GFONT statement 1172, 1176
ROMHT= option PROC GFONT statement 1172 ROTATE 420 ROTATE= graphics option 420 ROTATE= option AXIS statement options 211 GDEVICE procedure 420 PLOT statement (G3D) 1542 SCATTER statement (G3D) 1549 SURFACE statement (GMAP) 1278 TDEF statement (GREPLAY) 1489 TITLE, FOOTNOTE, and NOTE statements 289 ROTATE= suboption LABEL= option, DONUT statement (GCHART) 1052 ROTATE variable, Annotate facility 719 rotating surface maps 1303 rotating graphs for printing 420 rotating plot symbols through colors (example) 299 rotating plots 1537, 1553 ROTATION 421 ROTATION= option, GDEVICE procedure 421 ROWMAJOR option LEGEND statement options 229 rows in graphics output area 394, 421, 432 legends 226 ROWS 421 ROWS= option, GDEVICE procedure 421 RSTAT= option, HBAR and VBAR statements 944 RTF les sending output to 46 RUN-group processing 56 BY statements with 57 creating animated GIFs with 526 global and local statements with 56 GSLIDE procedure 1514 ODS and 192 WHERE statement with 57 RUN statement 35, 217 RUNMODE= macro argument 580 running programs 53 data sets and 54 engines and 56 environments and modes 53 RUN-group processing and 56 specifying input data set 54
S
sample programs 27 product codes for 27 SAS Color Naming Scheme (CNS) 174 SAS/GRAPH 4, 39 concepts table 23 product codes 27 SAS/GRAPH device 40 SAS/GRAPH fonts 153 SAS/GRAPH programs See programs SAS Maps Online 1241 SAS output 88 SAS registry changing default style in 137 viewing font specications in 156 SAS windowing environment 53
1722
Index
SASHELP.ZIPCODE data set 1149 SASPOWER= macro argument 589 SCALABLE 422 SCALABLE= option, GDEVICE procedure 422 Scalable Vector Graphics See SVG documents Scalable Vector Graphics devices 77 %SCALE macro, Annotate facility 755 SCALE option GRID statement (G3GRID) 1571 %SCALET macro, Annotate facility 756 SCALEX= option TDEF statement (GREPLAY) 1489 SCALEY= option TDEF statement (GREPLAY) 1489 scaling dash length in lines 349 data-dependent output 916 graphs 916 graphs with DSGI windows 804 hardware fonts 345, 421, 422 scatter plots 16, 1534 appearance of points 1551 axes, controlling 1537 connecting plot data points (example) 1365 data ranges 1537 input data sets 1536 plotting three variables (example) 1373 plotting two variables (example) 1362 rotating and tilting 1537 three-dimensional, syntax for 1546 two-dimensional 12 SCATTER statement G3D procedure 1546 SCATTER statement, G3D procedure ActiveX and Java support for 1625 SCLNKWT= macro argument 585 SCLWIDTH= macro argument 585 SCNSIZE= macro argument 585 script drill-down mode 479, 612, 620 search order of device catalogs 1127 segment boundaries 1208 segment colors 1209 SEGMENT variable creating map data sets and 1287 map data sets 1235 SEPCLASS= macro argument 589 SEPLOC= macro argument 589 SEPTYPE= macro argument 589 %SEQUENCE macro, Annotate facility 758 shadow color, legends 226 shadowing, legend frames 396 shape, legend values 229 SHAPE= option BLOCK statement (GMAP) 1256 HBAR3D, VBAR3D statements (GCHART) 1033 LEGEND statement options 229 SCATTER statement (G3D) 1549 shapeles 1585 excluding variables from 1590 le types 1585 including all variables from 1589 including selected variables from 1589, 1590 shapes in scatter plots 1549
SHORT option PROC GOPTIONS statement 1312 SHOWALL option PROC GFONT statement 1172 SHOWBACKDROP= parameter, JAVA 501 SHOWLINKS= macro argument 586 SHOWROMAN option PROC GFONT statement 1172, 1177 SHP les 1585 excluding variables from 1590 including all variables from 1589 including selected variables from 1589 SIDE option PLOT statement (G3D) 1542 SIMFONT 422 SIMFONT= graphics option 422 simple line plots 13 SIMPLEDEPTHSORT= parameter, JAVA 501 SIMPLETHRESHOLD= parameter, JAVA 502 SIMULATE font 1644 SINGULAR= option, POINTLABEL= specication 266 singularities, checking for 266 size aspect ratio 333 axis labels 199, 206, 207, 209 axis tick marks 201, 202, 212, 213 axis values 209 boxes in box plots 252 BY lines 216, 383 character cells 335 contour labels 254 contour lines 269 dash length in lines 349 display, in lines 379 enlarging graph areas with DSGI windows (example) 806 fonts 340 graphics output text 387 legend frame 226 legend frame drop shadows 396 legend label 226 legend values 229, 231 line thickness, default 393 paper 398, 399 paper feed increments 398 plot bubbles (example) 1358 plot print labels 265 plot symbols 254, 269 record length, to GSF 376 scatter plot points 1550, 1551 text in graphics output 285 titles and footnotes 193, 388 units of measurement 380 size, graphics output area 386, 433, 434, 435,, columns in 345, 386, 393, 403 rows in 394, 421, 432 SIZE= option SCATTER statement (G3D) 1550 SIZE variable, Annotate facility 720 sizing bubbles in bubble plots 1327 sizing errors 66 SKIPMISS option PLOT statement (GPLOT) 1348 slice labels 1064 %SLICE macro, Annotate facility 758
Index 1723
SLICE= option PIE, PIE3D, DONUT statements (GCHART) 1049 STAR statement (GCHART) 1063 slices ordering and labeling 1085 slider KPI charts 1204 smooth line t 260 SMOOTH option PLOT statement (GCONTOUR) 1107 GRID statement (G3GRID) 1571 smoothing spline smoothing 1567 smoothing plot lines 257 software fonts 422 open at one time 360 rendering 424 resolution 364 where stored 1636 sorting grouped observations 215 plot data set observations 1321 space between bars 972 space data sets 1187 creating 1188 variables 1188 SPACE= option BAR statement (GBARLINE) 972 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1034 SPACEDATA= option PROC GFONT statement 1177 spacing angle of rotation 289 between Bitstream font letters 366 between display area and graphic 431 between displayed area and graph 385 between ll lines 363 legends 227, 236 text in graphics output 283, 288 spatial data formats 1585 SPCLASS= macro argument 589 special characters 158 HTML entities 638 Special font 1644 special plot symbols 267 SPEED 423 SPEED= graphics option 423 speed of plotter pens 423 SPEED= option CHART statement (GRADAR) 1421 SPEED= option, GDEVICE procedure 423 speedometer KPI charts 1205, 1224 reversed colors 1225 SPEEDOMETER statement GKPI procedure 1216 spherical coordinates, converting to Cartesian See Cartesian coordinates SPIDERWEB option CHART statement (GRADAR) 1421 spine labels 1064 SPKLABEL= option CHART statement (GRADAR) 1421 spline interpolation 261, 274, 1566, 1580 partial 1578
SPLINE option GRID statement (G3GRID) 1572 spline smoothing 1567, 1576 SPLIT= option, AXIS statement options 206 SPOKESCALE= option CHART statement (GRADAR) 1421 SPREAD= macro argument 586 SSFILE1=, ..., SSFILE5= macro arguments 590 SSFREF1=, ..., SSFREF5= macro arguments 590 SSHREF1=, ..., SSHREF5= macro arguments 590 SSMEDIA1=, ..., SSMEDIA5= macro arguments 590 SSREL1=, ..., SSREL5= macro arguments 590 SSREV1=, ..., SSREV5= macro arguments 590 SSTITLE1=, ..., SSTITLE5= macro arguments 590 SSTYPE1=, ..., SSTYPE5= macro arguments 591 STACKED= parameter, JAVA 502 STACKPERCENT= parameter, JAVA 502 STAGGER option AXIS statement 206 standard deviations 262 star charts 9, 995 See also radar charts creating 1055 discrete numeric variables in 1090 patterns and outlines 1064 spine and slice labels 1064 statistic and group headings 1063, 1066 sum statistic in 1089 STAR statement GCHART procedure 1055 STAR statement, GCHART procedure BY statement with 217 STARAXIS= option CHART statement (GRADAR) 1422 STARCIRCLES= option CHART statement (GRADAR) 1422 STARFILL= option CHART statement (GRADAR) 1422 STARINRADIUS= option CHART statement (GRADAR) 1422 STARLEGEND= option CHART statement (GRADAR) 1423 STARLEGENDLAB= option CHART statement (GRADAR) 1423 STARMAX= option STAR statement (GCHART) 1063 STARMIN= option STAR statement (GCHART) 1063 STAROUTRADIUS= option CHART statement (GRADAR) 1423 stars, drawing circle of (example) 665 STARSTART= option CHART statement (GRADAR) 1423 STARTYPE= option CHART statement (GRADAR) 1423 state boundaries removing from U.S. map 1455 STATE function (DSGI) 841 state map data (U.S.) visual center of state 1238 state postal abbreviations 1158, 1159 statement options overriding style attributes with 138 statements 195 Base SAS language statements 35 global 33
1724
Index
ODS 34, 35 STATFMT= option AREA statement (GMAP) 1248 BLOCK statement (GMAP) 1256 CHORO statement (GMAP) 1264 PRISM statement (GMAP) 1272 SURFACE statement (GMAP) 1278 static graphics 505 adding drill-down to Web presentations 514 creating with ODS 506 developing presentations with GIF, JPEG, SVG, PNG 510 presentations developed with ACTXIMG, JAVAIMG sample programs for 514 static images in presentations 442, 443, 447 statistic headings pie and donut charts 1048, 1055 star charts 1063, 1066 STATISTIC= option AREA statement (GMAP) 1248 BLOCK statement (GMAP) 1256 CHORO statement (GMAP) 1264 PRISM statement (GMAP) 1272 SURFACE statement (GMAP) 1278 statistics See also chart statistics displaying above bars 971 displaying inside bars 967 for response variables 1295 in bar-line charts 974 in horizontal bar charts 1036, 1076 in vertical bar charts 1037 weighted 1001 weighted (GBARLINE) 984 weighted (GRADAR) 1410 step codes 376 STEP= option, SYMBOL statement 267 step plots 263 stock market high, low, close data 256 storing Annotate graphics 919 clipped polygons 402 DSGI graphs 774 fonts 1645 graphics catalogs 1654 graphics output as les 362 Java plug-in 490 PPD le 409 rendered font les 417, 418 STRETCH option BLOCK statement (GMAP) 1256 CHORO statement (GMAP) 1265 PRISM statement (GMAP) 1272 PROC GMAP statement 1244 stretching maps GMAP procedure 1244 strings appending to graphics data records 371 prexing output records 380 sending to devices or les 372, 373 stroked fonts 1166 style attribute versus device entry parameters 132 style attributes 133 overriding with statement options 138
512
style elements 133 for device-based output 144 GraphColors 142 GraphFonts 143 modifying 141 STYLE= option ODS destination statements 137 STYLE= option, AXIS statement options 207 style templates 133 STYLE variable, Annotate facility 720 styles 41, 131 See also appearance of graphs changing current style with STYLE= option 137 changing default style in SAS registry 137 changing font specications used by 163 default 49 examples of output using different styles 134 modifying 140 modifying fonts or colors 141 modifying GraphFonts and GraphColors style elements 141 ODS destinations and default styles 133 precedence of appearance option specications 139 recommended 134 specifying 137 specifying with multiple open destinations 51 turning off 151 viewing list of styles provided by SAS 139 stylesheets, macro arguments for 589 SUBGROUP= option BAR statement (GBARLINE) 972 BLOCK statement (GCHART) 1013 HBAR, HBAR3D, VBAR, VBAR3D statements 937 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1034 HBAR and VBAR statements 944 PIE, PIE3D, DONUT statements (GCHART) 1049 SUBGROUP variable, Annotate facility 724 subgrouping 3-D vertical bar charts 1073 area bar charts 942, 944 block charts 1068 donut or pie charts 1084 subordinate statements 32 subsetting map data sets 1285, 1444 subsetting map data sets 1398, 1404 example 1404 substitution strings drill-down tags as 614 removing blanks from data values 613 variables as 615 SUM option BAR statement (GBARLINE) 972 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1034 sum statistic 953, 972, 1001 in bar charts 1071 in block charts 1066 in pie charts 1081 in star charts 1089 numeric variable for 972 SUMLABEL= option HBAR, HBAR3D statements (GCHART) 1034 SUMVAR= option BAR statement (GBARLINE) 972
Index 1725
BLOCK statement (GCHART) 1013 CHART statement (GRADAR) 1424 HBAR, HBAR3D, VBAR, VBAR3D statements 937 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1034 PIE, PIE3D, DONUT statements (GCHART) 1050 PLOT statement (GBARLINE) 980 STAR statement (GCHART) 1063 suppressing axes 1107 BUBBLE statement 1332 PLOT statement, G3D procedure 1542 PLOT statement, GPLOT procedure 1347 SCATTER statement, G3D procedure 1549 surface maps 19, 1233 annotating 1276 axes, controlling 1537 color for drawing 1276 creating 1275 description of catalog entry 1277 distance decay function 1276 name of graphics output le 1277 name of GRSEG catalog entry 1277 number of lines for drawing 1277 percentages 1277 percentages, overriding default format 1278 physical dimensions of 1278 producing a simple map 1302 rotating 1278 rotating and tilting 1303, 1537 statistics 1278 tilting 1278 surface plots 15, 1533, 1552, 1555 appearance of surface 1544 data ranges 1537 input data sets 1536 rotating 1553 three-dimensional, syntax for 1539 tilting 1554 SURFACE statement GMAP procedure 1275 SURFACESIDECOLOR= parameter, JAVA 502 SVG device driver ACTXIMG, JAVAIMG vs. 508 developing web presentations 510 HTML les, generating 511 SVG documents 77 browser support for 83 output from devices 79 reasons for creating 78 system options for 84 terminology 77 SWAP 423 SWAP function, Annotate facility 700 SWAP= graphics option 423 %SWAP macro, Annotate facility 759 SWAP= option, GDEVICE procedure 423 SWFONTRENDER 424 SWFONTRENDER= graphics option 424 SYMBOL 251, 425 SYMBOL denitions 1350, 1356 displaying values of 1309 GBARLINE procedure 981 plot requests assigning 1351 SYMBOL denitions, BY statement with 218 symbol fonts creating gures for 1191
SYMBOL function, Annotate facility 1633 SYMBOL= graphics option 425 SYMBOL option LEGEND statement options 230 PROC GOPTIONS statement 1312 SYMBOL= option, GDEVICE procedure 425 SYMBOL statement 33, 196, 251 ActiveX and Java support for 1602 altering or canceling 271 box plots, modifying (example) 301 contour plots and 1114 rotating plot symbols through colors (example) 299 using 270 symbols GBARLINE procedure 955, 956 in ACTIVEX 461 special Java symbols 474 SYMBOLS 425 SYMBOLS= option, GDEVICE procedure 425 syntax conventions 24 system fonts 154 %SYSTEM macro, Annotate facility 759 system options SVG documents and 84 system resources closing destinations to save 51
T
T= option, AXIS statement options 211 T= option, LEGEND statement options 233 TARGET= option GKPI procedure 1220 TARGETDEVICE 427 TARGETDEVICE= graphics option 425 TC argument ? statement (GREPLAY) 1474 LIST statement (GREPLAY) 1482 TC= option PROC GREPLAY statement 1472 TC statement GREPLAY procedure 1485 TCOPY statement GREPLAY procedure 1486 TDEF statement GREPLAY procedure 1487 TDELETE statement GREPLAY procedure 1490 TEMPLATE argument ? statement (GREPLAY) 1474 LIST statement (GREPLAY) 1482 TEMPLATE DESIGN window 1494 TEMPLATE entries 1467 TEMPLATE= option PROC GREPLAY statement 1473 TEMPLATE procedure modifying styles 140 viewing list of styles provided by SAS 139 TEMPLATE statement GREPLAY procedure 1490 templated graphs 21 templates 1467 assigning 1490 copying or duplicating 1486 creating 1498, 1500 dening or modifying in catalogs 1487
1726
Index
deleting 1490 GREPLAY template code 1655 managing 1496 replaying graphics output in 1498 replaying graphs into 1504 replaying GSLIDE procedure output in 1502 style templates 133 transporting 1653 Templates window viewing list of styles provided by SAS 139 terminating drivers 357 terminology fonts 1166 graphics output 88 TEXALIGN function (DSGI) 842, 895 TEXCOLOR function (DSGI) 843, 896 TEXEXTENT function (DSGI) 843 TEXFONT function (DSGI) 845, 897 TEXHEIGHT function (DSGI) 845, 898 TEXINDEX function (DSGI) 846, 899 TEXPATH function (DSGI) 847, 899 TEXREP function (DSGI) 847, 900 text 865 angle of 401 as axis values 204, 206, 207 as legend values 228, 230 axis text, formatting 208 block charts 1015 BY lines 215 color of 963, 977 donut chart labels 1051 for contour labels 1115 HTML entities 638 in Annotate graphics output 685 reading direction, changing (example) 800 text color 346 text description suboptions AXIS statement 212 text slides 20 combining output onto one slide 21 enhancing 22 templated graphs 21 text slides for presentations 1509 Annotate graphics, displaying 1510, 1516 producing (example) 1514 TEXT variable, Annotate facility 726 TEXUP function (DSGI) 848, 901 three-dimensional plots 15 contour 16 scatter 16 surface 15 tick mark values GKPI procedure 1209 tick marks color of 977 minor 969, 979 tick marks, axes 201, 202, 211 formatting 212 offset 203 scatter plots 1551 suboptions, list of 1595 surface plots 1543 with datetime values (example) 294 TICK= option, AXIS statement options 211 TICK= option, LEGEND statement options 233 Tile applet 471
tile charts 11 creating 1522, 1528 TILE statement GTILE procedure 1522 TILELEGEND= option CHART statement (GRADAR) 1424 TILELEGLABEL= option CHART statement (GRADAR) 1424 tiles 1519 tiling radar charts 1429 TILT= option PLOT statement (G3D) 1543 SCATTER statement (G3D) 1550 SURFACE statement (GMAP) 1278 tilting surface and scatter plots 1537 surface maps 1303 surface plots 1554 TIPBACKCOLOR= parameter, JAVA 502 TIPBORDERCOLOR= parameter, JAVA 502 TIPMODE= parameters, JAVA and ActiveX 502 TIPS= macro argument 586 TIPS= parameters, JAVA and ActiveX 502 TIPSTEMSIZE= parameters, JAVA and ActiveX 503 TIPTEXTCOLOR= parameters, JAVA and ActiveX 503 TIPTYPE= macro argument 586 TITLE 279 TITLE denitions displaying values of 1309 TITLE option PROC GOPTIONS statement 1312 TITLE statement 33, 196, 279, 291 ActiveX and Java support for 1604 BY statement with 218 displaying with GOPTIONS procedure 1312 enhancing titles (example) 307 titles 291 angle of rotation 280, 286 boxes around 282, 283 colors for 282, 283, 346, 347 default characteristics, setting 292 dening text of 289, 293 enhancing (example) 307 fonts 365 fonts, color, and size (ODS output) 193 fonts for 284 hyperlinks for 288 justication 285 ODS output 192 placement in graphics output area 65 positioning 288 size of 285, 387, 388 spacing around 288 text breaks 293 underlining 291 titles macro, arguments for 591 TOGGLE statement GTILE procedure 1522 tokens, GDDM 370 traditional map data sets See also map data sets clipping 1398, 1404 traditional map data sets, projecting coordinates from spherical to Cartesian See Cartesian coordinates trafc light KPI charts 1206, 1226
Index 1727
TRAILER 427 TRAILER= option, GDEVICE procedure 427 TRAILER records 427, 428 TRAILERFILE 428 TRAILERFILE= option, GDEVICE procedure 428 trailers for animated sequences 522 TRANLIST= macro argument 596 TRANS function (DSGI) 849 transformations, DSGI 793 translation table, ASCII-to-EBCDIC 429 TRANSNO function (DSGI) 849, 904 TRANSPARENCY 428 transparency, image 428 TRANSPARENCY GOPTIONS statement 428 TRANSPARENCY= graphics option 523 transporting and converting graphics output 1651 TRANTAB 429 TRANTAB= graphics option 429 TRANTAB= option, GDEVICE procedure 429 tray, paper 400 TREEDIR= macro argument 586 TREESPAN= macro argument 587 Treeview applet 444, 546 DS2TREE macro with 547 enhancing presentations for 548 hotspots 552 when to use 546 XML embedded in HTML le (example) 550 XML written to external le (example) 551 TREPLAY statement GREPLAY procedure 1491 troubleshooting Annotate data sets 660 Web output 635 TrueType fonts supplied by SAS 154 TTAG= macro argument 591 two-dimensional bar charts 183 two-dimensional plots 12 bubble 15 high-low 14 regression 13 scatter 12 simple line 13 two-dimensional scatter plots 12 two-sided printing 336, 357 TXT2CNTL function, Annotate facility 702 %TXT2CNTL macro, Annotate facility 760 TYPE 429 TYPE= option BAR statement (GBARLINE) 973 BLOCK statement (GCHART) 1013 GDEVICE procedure 429 GKPI procedure 1220 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1035 PIE, PIE3D, DONUT statements (GCHART) 1050 PLOT statement (GBARLINE) 980 STAR statement (GCHART) 1063
UCC= graphics option 430 UCC= option, GDEVICE procedure 430 UCC values 430 ULX= option TDEF statement (GREPLAY) 1489 ULY= option TDEF statement (GREPLAY) 1489 unclipped polygons, storing 402 UNDERFLOWCOLOR= parameters, JAVA and ActiveX 503 UNDERLIN= option, TITLE, FOOTNOTE, and NOTE statements 291, 293 underlining in titles, footnotes, and notes 291 unicode code points 158 Unicode encoding 157 Unicode references for character data 595 uniform fonts 1166 UNIFORM option AREA statement (GMAP) 1249 BLOCK statement, GMAP procedure 1265 BLOCK statement (GMAP) 1257 CHORO statement (GMAP) 1265 GPLOT procedure 217 PRISM statement (GMAP) 1273 PROC GFONT statement 1177 PROC GMAP statement 1244 PROC GPLOT statement 1323 unit area 1240 containing another area 1289 enclosed polygons as holes 1288 multiple polygons 1288 single polygon 1287 unit areas combining, in map data sets 1449 units of measurement 380 Annotate graphics 653 Universal Printer shortcut devices 73, 75 unmatched area boundaries 1439, 1451 unreduced map data sets 1286 UPDATE function (DSGI) 870 URL drill-down mode 481, 612 URLs drill-down 986 URX= option TDEF statement (GREPLAY) 1489 URY= option TDEF statement (GREPLAY) 1489 U.S. city map data 1238 U.S. map removing state boundaries from 1455 U.S. state map data visual center of state 1238 user-created fonts storing 1167 user-dened control characters, device 430 user-dened patterns 1003, 1014, 1038 user input, enabling 431 USERFMT= parameters, JAVA and ActiveX 503 USERINPUT 431
U
U= option, TITLE, FOOTNOTE, and NOTE statements 291, 293 UCC 430
V
V= option, SYMBOL statement 267, 273 V6COMP 433 V6COMP graphics option 433
1728
Index
VALUE= option AXIS statement 207, 1595 LEGEND statement 1601 LEGEND statement options 230 PATTERN statement 240 PIE, PIE3D, DONUT statements (GCHART) 1051 STAR statement (GCHART) 1064 SYMBOL statement 267, 273 values on axes 207 order of 203 splitting (multiline) 206 values on legends order of 228 size and shape of 229 variable roles 612 variables Annotate facility 647, 655, 658, 702 as substitution strings 615 classication, plotting 1317 declaring as plot point labels 265 DENSITY 1437 identication variables 1240 link and enhancement variables in presentations 603 macro variable names 596 plotting three variables (example) 1373 plotting two variables (example) 1362 response variables 1239 variance 262 VAXIS= option BUBBLE statement (GPLOT) 1332 PLOT statement (GCONTOUR) 1107 PLOT statement (GPLOT) 1348 VBAR and VBAR3D statements drill-down functionality in bar chart (example) 620 GAREABAR procedure 934 GCHART procedure 1607 VBAR statement GCHART procedure 1016 VBAR3D statement GCHART procedure 1016 VBULLET statement GKPI procedure 1216 vector formats 113 vector graphics les, rendering software fonts 424 Version 6, SAS/GRAPH defaults for programs 433 vertical axes multiple in plots 1355 vertical axes, multiple in plots 1318, 1360 vertical bar charts 8, 991 BAR statement, GBARLINE procedure 1605 creating 1016 GAREABAR procedure 934 statistics in 1037 subgroup labels (example) 663 subgrouping 3-D charts 1073 vertical bar-line charts 959 vertical variables G3GRID procedure 1565 vertices, maximum drawn 395 VIEW2D= parameters, JAVA and ActiveX 503 VIEWPOINT=2D= parameter, JAVA 503 VIEWPORT function (DSGI) 851, 905 viewports, DSGI 791, 801 VMINOR= option BUBBLE statement (GPLOT) 1332
PLOT statement (GCONTOUR) 1107 PLOT statement (GPLOT) 1348 VORIGIN 431 VORIGIN= graphics option 431 VPOS 432 VPOS function (DSGI) 852, 906 VREF= option BUBBLE statement (GPLOT) 1332 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1348 VREVERSE option BUBBLE statement (GPLOT) 1332 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1349 VSIZE 433 VSIZE function (DSGI) 852, 906 VSIZE= graphics option 433 setting size of graphics area 94 VSIZE= option, GDEVICE procedure 433 VSLIDER statement GKPI procedure 1216 VSPACE= macro argument 573 VTRAFFICLIGHT statement GKPI procedure 1216 VZERO option BUBBLE statement (GPLOT) 1332 PLOT statement (GPLOT) 1349
W
W= option, AXIS statement options 213 W= option, SYMBOL statement 269 WAUTOHREF= option BUBBLE statement (GPLOT) 1332 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1349 WAUTOREF= option BAR statement (GBARLINE) 973 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1035 PLOT statement (GBARLINE) 981 WAUTOVREF= option BUBBLE statement (GPLOT) 1333 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1349 Weather font 1644 Web output Annotate facility for 541 Annotate variables for 658 developing for Metaview Applet 533 developing with ACTXIMG and JAVAIMG drivers 512 enhancing with GIF, JPEG, SVG, PNG drivers 510 generating presentations 453 HTML les, generating with GIF, PNG, SVG, JPEG 511 page formatting, macro arguments for 587 presentation features 450 presentation types 442, 449 static graphics 505 stylesheets, macro arguments for 589 troubleshooting 635 Web pages bar chart with drill-down (example) 321 combining graphs and reports (example) 315 creating with ODS HTML (example) 313 sending output to 45
Index 1729
Web presentations adding drill-down links to 514 developing with GIFANIM device 521 weighted statistics calculating (GBARLINE) 954, 966 calculating (GRADAR) 1410 GBARLINE procedure 984 GCHART procedure 1001 WFRAME= option CHART statement (GRADAR) 1424 GSLIDE procedure 1513 WHEN variable, Annotate facility 658, 727 WHERE statement 35 RUN-group processing with 57 white and black, reversing 423 WHREF= option BUBBLE statement (GPLOT) 1333 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1349 WIDTH= macro argument 573 WIDTH= option AXIS statement 208 AXIS statement options 213 BAR statement (GBARLINE) 973 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1035 SYMBOL statement 269 WIDTH variable, Annotate facility 728 width variables GAREABAR procedure 932 WIDTHSTAT= option HBAR, HBAR3D, VBAR, VBAR3D statements 937 wind speed and direction charts 1433 WINDOW function (DSGI) 853, 907 windowing environment 53 windowing mode GDEVICE procedure 1127 windows, DSGI 791 enlarging graph areas with DSGI windows (example) 806 scaling graphs with (example) 804 windrose charts 1424, 1433 WINDROSE option CHART statement (GRADAR) 1424 WINDROSECIRCLES= option CHART statement (GRADAR) 1424 WOUTLINE= option BAR statement (GBARLINE) 973 BLOCK statement (GCHART) 1014 BLOCK statement (GMAP) 1257 CHORO statement (GMAP) 1265 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1036 PIE, PIE3D, DONUT statements (GCHART) 1051 PRISM statement (GMAP) 1273 STAR statement (GCHART) 1064 WREF= option BAR statement (GBARLINE) 973 HBAR, HBAR3D, VBAR, VBAR3D statements (GCHART) 1036 PLOT statement (GBARLINE) 981 WSACTIVE function (DSGI) 854 WSOPEN function (DSGI) 855 WSPOKES= option CHART statement (GRADAR) 1424
WSTARCIRCLES= option CHART statement (GRADAR) 1425 WSTARS= option CHART statement (GRADAR) 1425 WSTAT= option, HBAR and VBAR statements chart with subgroups and variable percentages WVREF= option BUBBLE statement (GPLOT) 1333 PLOT statement (GCONTOUR) 1108 PLOT statement (GPLOT) 1349
944
X
X and Y coordinates comparing to map data set 1195 X variable example 1236 map data sets 1234 X variable, Annotate facility 729 XAXIS= option PLOT statement (G3D) 1543 SCATTER statement (G3D) 1551 XBINS= parameter, JAVA 503 XC variable, Annotate facility 730 XLAST variable, Annotate facility 740 XLATEX= option TDEF statement (GREPLAY) 1489 XLATEY= option TDEF statement (GREPLAY) 1489 XLIGHT= option PRISM statement (GMAP) 1273 XLSTT variable, Annotate facility 740 XMAX 434 XMAX= graphics option 434 setting resolution 96 XMAX= option, GDEVICE procedure 434 XMLFILE= macro argument 581 XMLFREF= macro argument 581 XMLTYPE= macro argument 581 XMLURL= macro argument 581 XPIXELS 435 XPIXELS= graphics option 435 setting resolution 96 setting size of graph 95 XPIXELS= option, GDEVICE procedure 435 XSIZE= option BLOCK statement (GMAP) 1257 CHORO statement (GMAP) 1265 PRISM statement (GMAP) 1274 SURFACE statement (GMAP) 1278 XSYS variable, Annotate facility 732 XTICKNUM= option PLOT statement (G3D) 1543 PLOT statement (GCONTOUR) 1108 SCATTER statement (G3D) 1551 XVIEW= option BLOCK statement (GMAP) 1257 PRISM statement (GMAP) 1274 XYTYPE= option PLOT statement (G3D) 1543
Y
Y and X coordinates comparing to map data set 1195
1730
Index
Y variable example 1236 map data sets 1234 Y variable, Annotate facility 734 YAXIS= option PLOT statement (G3D) 1543 SCATTER statement (G3D) 1551 YBINS= parameter, JAVA 503 YC variable, Annotate facility 736 YLAST variable, Annotate facility 740 YLIGHT= option PRISM statement (GMAP) 1273 YLSTT variable, Annotate facility 740 YMAX 436 YMAX= graphics option 436 setting resolution 96 YMAX= option, GDEVICE procedure 436 YPIXELS 437 YPIXELS= graphics option 436, 437 setting resolution 96 setting size of graph 95 YPIXELS= option, GDEVICE procedure 436, 437 YSIZE= option BLOCK statement (GMAP) 1257 CHORO statement (GMAP) 1265 PRISM statement (GMAP) 1274 SURFACE statement (GMAP) 1278 YSYS variable, Annotate facility 737 YTICKNUM= option PLOT statement (G3D) 1543 PLOT statement (GCONTOUR) 1109 SCATTER statement (G3D) 1551 YVIEW= option BLOCK statement (GMAP) 1257 PRISM statement (GMAP) 1274
Z variable, Annotate facility 738 ZAXIS= option PLOT statement (G3D) zero values block charts 1015 1520 1151 GTILE procedure 1543 1551 SCATTER statement (G3D)
ZIP + 4 extensions 1157, 1159 alternative source for ZIP codes geocoding with 1148 U.S. military 1151 ZIP geocoding method ZIP option PROC GEOCODE statement 1155 ZMAX= option PLOT statement (G3D) ZMIN= option PLOT statement (G3D) zoom controls 537 ZOOM= macro argument 587 537 ZOOMCONTROLENABLED= graphics option 537 ZOOMCONTROLMAX= graphics option ZSYS variable, Annotate facility 739 ZTICKNUM= option PLOT statement (G3D) ZVIEW= option BLOCK statement (GMAP) 1257 PRISM statement (GMAP) 1274 1544 1551 SCATTER statement (G3D) ZOOMCONTROLMIN= graphics option 537 1544 1551 SCATTER statement (G3D) 1544 1551 SCATTER statement, G3D procedure 1155 ZIP code variables 1158, 1159
Z
z/OS JAVAIMG driver in 513
Your Turn
We welcome your feedback. 3 If you have comments about this book, please send them to [email protected]. Include the full title and page numbers (if applicable). 3 If you have comments about the software, please send them to [email protected].
66
Whether you are new to the work force or an experienced professional, you need to distinguish yourself in this rapidly changing and competitive job market. SAS Publishing provides you with a wide range of resources to help you set yourself apart. Visit us online at support.sas.com/bookstore.
SAS Press
Need to learn the basics? Struggling with a programming problem? Youll find the expert answers that you need in example-rich books from SAS Press. Written by experienced SAS professionals from around the world, SAS Press books deliver real-world insights on a broad range of topics for all skill levels.
SAS Documentation
support.sas.com/saspress
To successfully implement applications using SAS software, companies in every industry and on every continent all turn to the one source for accurate, timely, and reliable information: SAS documentation. We currently produce the following types of reference documentation to improve your work experience: Online help that is built into the software. Tutorials that are integrated into the product. Reference documentation delivered in HTML and PDF free on the Web. Hard-copy books.
support.sas.com/publishing
Subscribe to SAS Publishing News to receive up-to-date information about all new SAS titles, author podcasts, and new Web site features via e-mail. Complete instructions on how to subscribe, as well as access to past issues, are available at our Web site.
support.sas.com/spn
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are trademarks of their respective companies. 2009 SAS Institute Inc. All rights reserved. 518177_1US.0109
66