1

I am trying to make adjustments to my HTML output from SAS ODS.

This is all I have:

ODS HTML FILE = 'C:\filename.html' options(pagebreak='no');

proc print data=dataset noobs;

run;

ODS HTML CLOSE;

RUN:

Ideally, I would just have columns have an autofit if possible.

Any help is appreciated.

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55
user1624577
  • 547
  • 2
  • 6
  • 15

1 Answers1

3

Take the default style, and modify it so that the DATA style element (see documentation here) has the white-space:nowrap CSS style applied to it. Save the changes to a new style called 'my_style'.

The white-space:nowrap is the bit of magic that will force the text not to line-break once it gets too long.

proc template;
  define style my_style;
    parent = styles.default;
    style data from data / htmlstyle="white-space:nowrap";
  end;
run;   

Print out the table using out new modified style:

ods html style=my_style;

proc print data=sashelp.webmsg;
run;

ods html close;

Some more notes.... Sometimes SAS will actually support the actual CSS style that you need to change in which case you should use that (instead of htmlstyle=). Find the complete list here.

Also, your default style may not actually be named styles.default. To find the name of your default style, go to Tools->Preferences->Results and get the name from the 'Style' dropdown box. This is for the base SAS editor. For EG, it may be slightly different but I'm sure you'll be able to find it.

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55
  • Hmm, looks like this works depending on the style you specify in the template to modify. For example, the `styles.default` works fine. But if I change it to `styles.htmlblue` it doesn't appear to be working (at least not in the SAS HTML Internet Explorer preview window. – Robert Penridge Feb 18 '15 at 22:01
  • Fixed by changing `style cell from cell` to `style data from data`. – Robert Penridge Feb 18 '15 at 22:05
  • Thanks - I ended up using proc report instead of proc print and was able to format the way I needed it. This is good though; thanks for the response. – user1624577 Feb 19 '15 at 17:48