10月 032011
Most SUG presentations are written in PowerPoint – they may even be written in Word first, and then fancied up a bit in PowerPoint – but they are rarely written in SAS. But Louise Hadden, from Abt Associates Inc, had a need to produce a lot of PDF presentations. She [...]
8月 062011
I bet that many of you reading our blog are familiar with accomplished SAS users and authors Lauren Haworth, Cynthia Zender, and Michele Burlew. Together, they form a powerful triumvirate of SAS experience. If you get a chance to pick up their book Output Delivery System: The Basics and Beyond [...]
7月 202011

With SAS 9.3, it’s pretty clear that SAS wants everyone to start using HTML as their base output format. That’s actually been a good idea since SAS 9 was first released. HTML output is easier to read, takes less paper if you print it, and is easier to deliver to the world or to integrate into other documents than the “print file,” the paginated monospace text of the Listing destination format that SAS relied on for the previous four decades. And though HTML might seem more complicated than Listing, it’s not actually any harder to create. You will find a series of changes in SAS 9.3 that make the transition easier.

  1. HTML is now the default destination if you are running SAS in the GUI windowing environment. That is, you don’t have to use any ODS statements to get HTML output.
  2. ODS graphics have been separated from SAS/GRAPH and moved entirely to base SAS. ODS graphics are now included in your HTML output with just a base SAS license. If you use the Listing destination, you can still use ODS graphics, but you have to look at the graphics separately, an approach we will all quickly come to see as an unnecessary inconvenience.
  3. There are improvements in the DOCUMENT procedure to make it more compatible with the PRINT procedure, and to allow arbitrary text to be added to a document. These changes are especially useful if you are using the DOCUMENT procedure for formatted output such as HTML output.
  4. There was a sense that ODS style attributes were converging with CSS attributes when SAS 9 was released, and that continues with several new ODS style attributes in SAS 9.3. The new attributes such as WHITESPACE, PADDING, and BORDERCOLLAPSE provide ODS support for attributes that you would take for granted in CSS formatting of an HTML document.
  5. There is a new style, HTMLBlue, that enhances readability and makes more efficient use of space when displaying tables. It also, in my opinion, just looks more glamorous in a graphic design sense. The HTMLBlue style is the default style for the HTML destination in SAS 9.3.

There are two tricky points with HTML being the default destination. First, if you were already running a program in SAS 9.2, you may want to keep its output style the same as before. There are three new system options that, used together, can provide the SAS 9.2 behavior, so that you don’t have to rewrite your programs to keep them from changing.

Second, while HTML is the default destination in the GUI windowing environment, Listing remains the default in all other environments. This means the output format could change just because you run a program in a different way. If this is a problem, add ODS statements to the program to explicitly select the destination you want and close the destination you don’t want. This is not as big a change as it might sound. You can start a program with this statement to close all ODS destinations, without having to know which ones are open:

ods _all_ close;

Follow this with an ODS HTML, ODS LISTING, or other ODS statement to open the destination of your choice. This is all it takes to get consistent ODS output from a program, not affected by where you run it.

If you have older programs that use the PRINTTO procedure to select a destination file for output, you need to know that the PRINTTO procedure works only for the Listing destination, and not for any other ODS destination. Even for the Listing destination, it is simpler to select destination files using the ODS LISTING statement. However, continue to use the PRINTTO procedure if you use it to temporarily reroute the SAS log, or use it with the Listing destination to combine the log and output in the same file.

7月 082011
Dear Miss SAS Answers,

I have a problem getting PDF, HTML, and RTF output from the Output Delivery System (ODS). It asks me to connect to a remote browser. When I try that, I have a connection failure. I am using Base SAS 9.2 software. What am I doing wrong?

      Not Browsing

Dear Not Browsing,

It is funny that you should ask that question, as I just had another SAS programmer ask the same question this week!

The solution is to use the HELPBROWSER SAS system option. You can either add this OPTIONS statement at the beginning of your SAS code containing ODS statements:

      options helpbrowser = sas;

or you can add this line to your sasv9.cfg file (for Windows and UNIX) or your sas.exe invocation:


The HELPBROWSER SAS system option specifies the browser to use for SAS Help and ODS output. The valid values are as follows:

REMOTE specifies to use the remote browser for the Help. The location of the remote browser is determined by the HELPHOST and the HELPPORT system options. This is the default value for the OpenVMS, UNIX, z/OS, and Windows 64-bit operating environments.

SAS specifies to use the SAS browser for the Help. This is the default for the Windows 32-bit operating environment.

To see the current value of this option, submit the following SAS code:

      proc options option=helpbrowser value;

This option has been available since SAS 9.0, so I suspect people are running into it now when moving to a 64-bit Windows system, as the default value is different.

I hope this helps you see your ODS output. Happy SAS programming!
     Miss SAS Answers
5月 262011
SAS Enterprise Guide has about 150 options that you can customize in the Tools->Options window. With each release, the development team adds a few more options that have been asked for by customers, and they rarely decommission any existing options. It's getting quite crowded on some of those options windows!

Alas, the team has not yet discovered how to implement the "Read my mind" option (but believe me, it's been requested), so it remains up to you to investigate the options that are offered and select those that suit the way that you want to work.

I use SAS Enterprise Guide every day to get work done, and I've got some favorite settings that I like to run with that help me to be more productive. Here are my top 5.

Replace results: Replace without prompting

How to find it: Tools->Options->Results->Results General, under the Managing Results heading.

The Replace Results option
After you set this option, you'll never again see this message "Do you want to replace results? Yes, No, or Cancel" when you re-run a task or program. Your results will always be replaced, which is what most people almost always want.

Turn off Show generated wrapper code in SAS log

How to find it: Tools->Options->Results->Results General...about halfway down the window. This option really helps to declutter your SAS log within SAS Enterprise Guide. I've written about this option in more detail in a previous post.

Show full details when viewing SAS libraries in File Dialog

How to find it: Tools->Options->General...about 1/3 of the way down the page. Checking this option allows you to see more details about the data sets in your libraries before you add them to your project. Read more about the File Details option in an earlier post.

Turn off Show Welcome window at start-up

How to find it: Tools->Options->General...top option. Or, check the box that says "Don't show this window again" the next time you see the "Welcome to SAS Enterprise Guide" window. This tells SAS Enterprise Guide, "Hey, the honeymoon is over. Get out of the way and let's get to work."

The Welcome window does provide handy one-click access to your most recently used projects. But you can also get to those via File->Recent Projects. Bonus added in the 4.3 release: File->Recent Programs, which provides easy access to SAS program files that you've opened recently.

Change default SAS Report style to Plateau

How to find it: Tools->Options->Results->SAS Report, Appearance section. The default ODS output style for SAS Report is Analysis. It's a nice clean style, but I prefer Plateau because it's a bit more concise and can fit more information on a screen. Here: take a look at this sample to see what I mean. There are lots of different styles: experiment and see which one you like the best.

Change Graph Format to PNG

How to find it: Tools->Options->Results->Graph, Graph Format. The PNG graph option

The default graph format for items such as bar chart and line charts is ActiveX. ActiveX has been the default output format in SAS Enterprise Guide since 1999, when the product shipped with version 1.0 on top of SAS Version 8. Back then, the quality of the charts produced using the ActiveX graph control was pretty impressive when compared to the output produced using GIF or similar static chart types.

The ActiveX device tells SAS to generate verbose scripting code as part of the SAS Report or HTML output. Then a client-side control is used to render the graph. This allows for some interactivity in the graph, but it also comes with a limitation: if the graph contains lots of data points, the script gets larger, and that can make for a very large output file.

SAS/Graph has come a long way since the early days of SAS Enterprise Guide, and with SAS 9.2 we like to recommend the PNG device for most applications. The PNG (or GIF or JPEG devices) respect the SAS graph styles and look pretty nice. If you use ODS Graphics (or the SGPLOT procedure), you get PNG already since ActiveX isn't supported.

Whoops, that's 6 options, not 5! Once I get going it's difficult to stop. I've got some other favorites that I recommend for certain situations (working with databases, making the best of network latency, collaborating with teammates on projects); those will provide good topics for a future post.

What about you? Do you have a favorite set of options for SAS Enterprise Guide, or even SAS in general? Post back in the comments.

4月 292011
ods listing close;
ods html path='c:\sasdata' body='ods01.html';
proc format;
    value $sexfmt  'F'='Female'
      value $sexback 'F'='red'
      value $actback 'LOW'='cxBBDDCC'
proc tabulate data=sasuser.admit format=4.1 style={background=ywh};;
      var fee / style=<parent>;
      var age height weight / style={background=yellow};
      class sex actlevel / style={background=white};
      classlev sex / style={background=$sexback.};
      classlev actlevel / style={background=$actback.};
      table sex*actlevel*(age height weight fee*{style=<parent>}), min max mean sum / box={style={background=ltgray}};
      keyword min max mean sum/ style={background=orange};
      format sex $sexfmt.;
ods html close;
ods listing;

The SAS System

BOX Min keyword Max keyword Mean keyword Sum keyword
Sex CLASS ActLevel CLASS   34.0 44.0 39.8 159
Height VAR 66.0 69.0 67.0 268
Weight VAR 140 163 149 596
Fee VAR+
125 *{style=<parent>} 150 *{style=<parent>} 137 *{style=<parent>} 549 *{style=<parent>}
Age VAR 22.0 49.0 32.5 130
Height VAR 61.0 64.0 62.5 250
Weight VAR 118 172 138 552
Fee VAR+
85.2 150 111 445
Age VAR 32.0 43.0 39.3 118
Height VAR 63.0 67.0 65.0 195
Weight VAR 123 151 137 411
Fee VAR+
125 150 141 424
Age 25.0 29.0 27.0 81.0
Height 72.0 76.0 74.3 223
Weight 168 193 183 549
Fee 85.2 125 98.4 295
Age 34.0 60.0 48.3 145
Height 71.0 73.0 71.7 215
Weight 154 191 168 503
Fee 125 150 133 399
Age 30.0 54.0 41.5 166
Height 69.0 72.0 70.5 282
Weight 147 183 169 676
Fee 125 150 144 574

4月 132011
Just flew back from Vegas, and boy, are my arms tired! (ba-dump)

If you attended SAS Global Forum, you probably learned a lot of things you didn't know. But if you were a SAS employee, you also learned a lot of things you didn't know. One of the perks of being able to attend SAS Global Forum as an employee is the opportunity to find out (and try out) new features in the software as well as to find out the latest information about our services. So, without further ado, here are 4 Things I Learned at SAS Global Forum:

  1. You folks are crazy about SAS! My paper on "SG Procedures for the Non-Statistician" was scheduled for 8:00 AM on the final day of the conference, in a city where there are more than a few excuses to stay out late. I was expecting that my presentation would wind up being a dialogue between me and the session chair, while reasonable people slept in late. However, we had a full room of graphics fans, even at that early hour!

  2. ODS Graphics is getting the ultimate power tool. I attended Dan Heath and Sanjay Matange's presentation on Annotate for SG Procedures and the ability to annotate graphs (coming in SAS 9.3) makes the SG procedures the tool of choice for both statistical and non-statistical graphics applications. The Annotate facility for ODS graphics will be similar to Annotate for "classic" SAS/GRAPH procedures--you create a data set containing observations that control what is added to a graph. Most importantly, data-dependent annotation will be supported.

  3. A lot of people are interested in e-Learning. I spent most of my time in the Demo Area near the Self-Paced e-Learning Demo, where SAS users had a chance to try out some of our e-Learning courses. As I mentioned in a previous post, this is a good way to learn SAS when your schedule won't permit you to take a course on a fixed schedule.

  4. You'll get instant graphs with the SG procedures in SAS 9.3. If you are currently using ODS graphics (including SG procedures), you have to click on the graph in the Results window to display it with your host graphics viewer. In SAS 9.3 ODS graphics will generate HTML output by default and the output will immediately display in the SAS Results Viewer, thus saving you the step of explicitly having to open the graph.
      And if you've stayed with me so far, here are 5 things I learned about Las Vegas in general:

      1. There are few things in life worth $125 a ticket, but Cirque de Soleil's LOVE is one of them. Words can't describe it, so I won't try. Just save up and go.

      2. If you are coming to Las Vegas and you don't gamble, bring your own chair. I knew that there were no clocks or windows in the casinos, but I didn't know that there is no place to sit in a casino or hotel lobby except at a slot machine.

      3. Las Vegas appears to have a local ordinance requiring you to smoke. If you are a male between 45 and 60, you must smoke a cigar.

      4. Even if you don't like New York, New York, New York New York is neat. (This sentence is actually grammatically correct).

      5. Bring money. Lots of it. And bring even more.

      Thankyou. Thankyouverymuch. You've been a wonderful audience.