BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
Hello,

The below code works but I don't understand how. It uses ODS to create an output .html file. What I don't understand is why is it using ODS HTML with ODS PDF CLOSE? I was expecting to see ods html with ods html close.

Thanks for your input.


ODS Listing CLOSE;
ODS HTML style=barrettsblue

body="V:\TMT\\Output\MAP_&campaign_id._Excl_Waterfall.html";
proc report
.......
.......
run;

ODS PDF CLOSE;
ODS LISTING;
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Uhhh - can you share with us who wrote the code? And I expect you will not see any SAS-generated diagnostic message when the PDF destination is closed, even if not open. Keep in mind that your open ODS destination(s) will be closed automatically at the end of your session/job.

Are you just curious to see the SAS code in your program or are you attempting to debug a "perceived" problem symptom?

Scott Barry
SBBWorks, Inc.
KevinC_
Fluorite | Level 6
Hi sbb,

I am just curious to see why this works. The person who wrote this code has moved on elsewhere.

The code works and I don't see any errors associated with this ODS code. Is 'ods html close' the proper way to close the destination ?

Thanks.
Cynthia_sas
Diamond | Level 26
Hi:
This will not put any error messages in your log, but it is a problem. For one thing, the HTML file is left open and any subsequent ODS HTML statement will clobber this file. The ODS PDF CLOSE should be corrected to either:
[pre]
ODS _ALL_ CLOSE or ODS HTML CLOSE;
[/pre]

To me, it looks like this might have been an ODS PDF job to start that possibly got used as a model for an ODS HTML job and someone just forgot, or did not know a SAS programmer's mother's best ODS advice:
"If you open it (an ODS destination), you must close it (the SAME ODS destination)."

cynthia
KevinC_
Fluorite | Level 6
Hi Cynthia,

Thanks for your explanation.

So looks like the HTML file is left open.. that makes sense because I have noticed all of the proc freq's that come after this ODS step is included in the HTML document.. I was wondering how those proc freq's got into the HTML document. Now I see..

Thanks to all of you!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1916 views
  • 0 likes
  • 3 in conversation