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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 909 views
  • 3 likes
  • 3 in conversation