The SAS Output Delivery System and reporting techniques

SASbook: Output Delivery System:: The Basics and Beyond

Reply
Occasional Contributor
Posts: 9

SASbook: Output Delivery System:: The Basics and Beyond

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
Super User
Posts: 10,568

Re: SASbook: Output Delivery System:: The Basics and Beyond

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
SAS Super FREQ
Posts: 9,426

Re: SASbook: Output Delivery System:: The Basics and Beyond

[ Edited ]

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

Ask a Question
Discussion stats
  • 2 replies
  • 174 views
  • 3 likes
  • 3 in conversation