1
votes

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.

1

1 Answers

3
votes

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.