0
votes

Why is the HTML destination always open in SAS, and why should you reset the ODS to open for HTML at the end of a program?

Do these two lines of code both work to reset the ODS to HTML? The first one is hard to follow


ods html path="%qsysfunc(pathname(work))"

ods preferences;
1
HTML is the default output as of SAS 9.4 so it's always open. Should you always reset it? That's a personal preference. No, those two lines of code do not do the same things. - Reeza
"The first one is hard to follow" opens an HTML file in the work library path which is guaranteed to exist in your SAS session. This way you don't end up with files everywhere. - Reeza
Thanks very much. This was in the Base Sas Specialist book " The HTML destination remains closed until you end your current SAS session or until you re-open the destination. It is good programming practice to reset the ODS destination to HTML output (the default setting) at the end of your programs. ods html path="%qsysfunc(pathname(work))"; " But I'm not sure why opening a HTML file in the work library helps reset the ods? Is it because that's where HTML files usually go by default? What does the ods preferences statement do, just reset HTML global settings? - Ryan M
Not familiar with the ODS PREFERENCES stateement, I'd refer you to the documentation there. I think why they say reset the ODS HTML is to separate your output but that's a personal preference choice IMO. - Reeza
Basically, see what happens when you do reset it, and when you don't between programs. What happens to the output? In one case all is on the same file in the other they go to separate files. - Reeza

1 Answers

0
votes

You can open the SAS display manager session preferences dialog as follows:

  • menu Tools/Options/Preferences...
  • command DLGPREF
  • submit code DM DLGPREF

The Results tab shows the session settings that statement ODS PREFERENCES will reset to. For example my currents settings have Create HTML unchecked, but if it were, the folder would be the WORK folder.

enter image description here

Any changes you make to Preferences will be maintained between sessions by checking General: Save settings on exit. When unchecked the settings will be either the installation defaults or the last saved settings.

enter image description here