Help using Base SAS procedures

ODS html/ ODS pdf close

Reply
Regular Contributor
Posts: 173

ODS html/ ODS pdf close

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;
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS html/ ODS pdf close

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.
Regular Contributor
Posts: 173

Re: ODS html/ ODS pdf close

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.
SAS Super FREQ
Posts: 8,861

Re: ODS html/ ODS pdf close

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
Regular Contributor
Posts: 173

Re: ODS html/ ODS pdf close

Posted in reply to Cynthia_sas
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!
Ask a Question
Discussion stats
  • 4 replies
  • 222 views
  • 0 likes
  • 3 in conversation