Page One

Campus Computing News

Summer Computing Hours

Do you have something to sell?

Lab-of-the-Month: The COM Lab

Renew PRAS Accounts for the Summer

Today's Cartoon

RSS Matters

SAS Corner

The Network Connection

List of the Month


Short Courses

IRC News

Staff Activities

Subscribe to Benchmarks Online

Research and Statistical Support

SAS Corner

By Dr.Karl Ho, Research and Statistical Support Services Manager

HTMLizing your SAS charts and maps *

In one of my previous articles, I evaluated the new SAS graphical tool, Graph-N-Go and introduced the new modes of graphics SAS can generate using this new tool. One of the appealing features of this new tool is to publish charts to Web pages. Conventionally, the easiest way to publish a chart is to convert or snapshot the chart into a graphical format such as GIF or JPEG and then insert the file to a Web page file.  In SAS 8, a more innovative method is available: to embed the data into the charts and make them interactive. This article introduces this new method and provides sample codes for rendering SAS charts and maps Web-ready and interactive.

By using SAS/GRAPH Applets for Java, you can generate graphics that allow you to "drill down" and get more details of each graph element as represented by bars or slices of the pie in a bar chart and pie chart respectively.

From SAS version 8.0 onwards, the SAS/GRAPH module can create three types of charts using Java Applets: Contour, Graphs and Maps. In the new generation of SAS charts or maps, users can run PROC GCHART or PROC GMAP and publish results into an HTML file. The Java Graph and Java Map applets can generate "drill-down" charts and maps, allowing users to conduct on-line analysis on the groups or individual unit of the data set using the internet browser.

Java Graph Applet

The following example illustrates generating a drill-down bar-chart that possesses clickable bars that lead to next level of data.  


For instance, clicking on the yellow bar, the 1999 company sale from the Eastern state of North Carolina will give a "drill-down" bar graph of sales from the Eastern states in both 1998 and 1999 for annual comparison. 

Pointing your cursor to each segment of the bar will indicate variable values regarding that segment of the bar. Continuing to clicking on that segment will generate another bar chart representing next level of data, illustrating comparison of the two Eastern states, NC and MA, in that year.

Before you try it out, learn to control the mouse in the Java-enabled charts. To control the Java-applet chart, right click the object and you can select from a list of commands including a link to an on-line help page.  To return to the first level, you can either reload the page or hold down shift and control key simultaneously and left click on any object. Try out this on-line interactive chart: 

GraphApplet Example

Sample program of  the Java-enabled Chart - In this sample program, you can generate a bar chart that has pie chart at the first drill-down level.

Java Map Applet 

Generating the map is similar but a different procedure PROC GMAP.  The Java Map gives data of each state when you point your cursor over the state.

MapApplet Example

Sample program of the Java-enabled Map

Big Caveats

The new class of Java applets are not entirely bug-free. They are not omnipotent and do not work in some browser environments. They work best in the Windows version of Internet Explorer version 5 onwards. For other browsers or other platforms, the mileage varies a great deal, mostly due to the compatibility of Java applet source in browsers other than the Windows version of IE. That being said, this opens a new front in presenting graphical data using the Internet and packing more information into graph, which already excels a thousand words, agreed?  

* Materials in this article are mostly extracted from the SAS technical support site. For more sample programs and features, consult the SAS Web site titled SAS/GRAPH Applets for Java