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
SAS Super FREQ

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 932 views
  • 3 likes
  • 3 in conversation