BookmarkSubscribeRSS Feed
pjpnk
Fluorite | Level 6

Can someone please explain why we need a close statement in Output Delivery System in SAS.  The sample code is below:

 

ods html close;
Pankajwa
2 REPLIES 2
Kurt_Bremser
Super User

This statement closes the file (ends access by the SAS process), but more importantly, it writes information that is needed to get structural integrity. In HTML, this means that ending tags like

</BODY>
</HTML>

are written.

Cynthia_sas
Diamond | Level 26

Hi:
With interfaces like Enterprise Guide and SAS Studio, it frequently appears as if no ODS statements are needed at all in your code. However, you will notice that most of the code in our book also has a beginning ODS statement --
ODS HTML path="..." file="...";
*** more SAS code;
ODS HTML CLOSE;

So that the close statement always "matches" an open statement for the destination.

When you are taking full control over the output -- such that you control the output location and file name, then it's like your Mom said -- if you open it you should close it. So any ODS "open" statement needs a matching ODS "close" statement or uses the universal
ODS _ALL_ CLOSE;

Hope this helps,
Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1449 views
  • 3 likes
  • 3 in conversation