UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS FAQ
How can I create an interactive 2-D scatter plot as an ActiveX object using ODS?

The Output Delivery System (ODS) in SAS version 7 and higher provides a great deal of control over the output from SAS procedures including graphics. For example, ODS provides a simple way of creating interactive graphs as Microsoft ActiveX objects. An ActiveX object of a plot on a webpage allows a user to change the appearance of the plot interactively on the webpage. It is worth noticing that an ActiveX object only works on Internet Explorer and the ActiveX controls have to be enabled to make it work.

This page assumes that you use Internet Explorer version 6 and higher. With Internet Explorer version 6 and above, you can easily copy and paste any of the plot that you obtain by modifying the original one to other application programs, such as Word.

This FAQ page will show how to create a scatter plot as an ActiveX object embedded in a webpage and how to make use some of the features that an ActiveX object offers.

It is very easy to create an ActiveX object from proc gplot.  Here is a sample code for creating an HTML page for the object. Our webpage will be called scatter.html and is located in the d:\temp folder.

options device = activex;
ods html body = 'd:\temp\scatter.html';
proc gplot data = hsb2;
  plot write*math = female ;
run;
quit;

goptions reset = all;
ods html close;

Here is the link to the page that we just created. Now let's see what we can do with the plot. Remember at anytime that you want to get the original plot back, you can simply refresh the page.

Understanding mouse control

Every point on the plot is associated with a tool tip box that shows the values of all the variables involved in that observation.

Right-clicking on the mouse will bring up the menu on plot options shown in the middle of the plot below.



Holding down the left button of  the mouse also does some really nice things to the plot, such as resizing it.

Taking away the grouping variable female

Right-click on the plot area, follow Options->Data, you will see the window on the left below, select None for the Subgroup and click on Apply, you will see that the plot is changed to the plot shown below.

       

 

Changing title of the plot

We may want to change the title of the previous plot to something more meaningful. Right-click on the plot area and follow Options->Lengend.




 

Changing plotting symbol(s)

We can change the shape and the size of a plotting symbol

   

 

Changing plot type

You can also change the type of your plot. For example, we may want compare the mean writing scores between female and male group. Right-click on the plot area, then follow Chart Type -> Vertical Bars. Then from Options -> Data shown below, change Category variable to female and Subgroup to None. Then click on Apply. The plot changed is shown below.

 
 

Adding regression line to the plot

You can add different types of lines to the plot. For example, you can add regression line to the plot. Right-click on the plot area, and choose Plot Options.

   

There are many other features that we have not shown here. The best way to learn them is to play with the webpage itself.

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California