Lesson 45:  ODS


Video:  More traffic lighting and ODS

Now we will see how we can highlight a whole row based on the value of one column.

This is done using a compute block in proc report, as shown below.

ods html file="c:\stats\manpresults.xls" style=minimal;
proc report data=manpresults nowindows split="/";
  columns variable estimate stderr tvalue probt;
  define variable/display "Variable/Name";
  define estimate/display "Parameter/Estimate";
  define stderr/display "Standard/Error";
  define tvalue/display "Test/Statistic" width=9;
  define probt/display "P-/Value";
  compute probt;
    if probt<.05 then
    call define(_row_, "style", "style=[foreground=red font_weight=bold]");
ods html close;

The compute block begins with the keyword "compute" and ends with "endcomp."  Although it looks like we are saying we will compute the value of probt, this is not what it means.  Actually it is a computation based on the column probt.  Some other kinds of compute blocks can actually compute values for a new column.  Here we are using an "if" statement to apply a style whenever a condition on probt is met.  There could be multiple styles applied with more "call define" statements based on different values of probt.  The syntax of the compute block is, unfortunately, quite complex.  You can find it in the documentation for proc report, but be prepared to wade through several links to different sections before putting it all together.

Survey of documentation about proc report and ODS.

ODS Graphics in proc reg.



Refer to the used cars data set which can be created with this program: usedcars.sas.  Use the ideas of this lesson to demonstrate what you can do with proc report on this data.  Be creative, use your own ideas and imagination to create an attractive report.

Copyright reserved by Dr.  Dwight Galster, 2006.  Please request permission for reprints (other than for personal use) from dwight.galster@sdstate.edu  .  "SAS" is a registered trade name of SAS Institute, Cary North Carolina.  All other trade names mentioned are the property of their respective owners.  This document is a work in progress and comments are welcome.  Please send an email if you find it useful or if your site links to it.