DATA Step, Macro, Functions and more

HTML results include all output from previous code

Reply
Super Contributor
Posts: 398

HTML results include all output from previous code

Hello,

 

I have a user with an issue where she is running multiple chuncks of sas code and she wants each result in it's own html file not combined.  Currently it takes all the output and creates the html file.

 

I had her try using the following code, but it isn't working as expected.  She gets blank results even when the log says there should be data.

 

        ods html close;
        ods html;

 

Is there an option in SAS to make every result a seperate html file?

 

Thank you

Occasional Contributor
Posts: 7

Re: HTML results include all output from previous code

[ Edited ]

Hi Jerry,

here is some trivial example to output data in two different files. Hope this is what you are looking for.

 

 

ods html body="/folders/myfolders/sasuser.v94/test1.html";
data test;
x=1;
run;

proc print data=test;
run;
ods html close;
ods html body="/folders/myfolders/sasuser.v94/test2.html";
data test2;
y=2;
run;

proc print data=test2;
run;
ods html close;

This produces two html files with different sets.

 

Of course you might have to adjust the filesnames (after body=) as you like.

 

Super Contributor
Posts: 398

Re: HTML results include all output from previous code

jefreytag,

 

Thanks for the reply. 

I don't mean to create the actual html files myself. 

I'm talking about the html files that SAS generates when there are results to view.  

 

Within options -> Perferences -> Results

Create listing, Create HTML and View results as they are generated are check.

 

The HTML file that SAS is creating is showing all the output not just the output from that specific SAS code.

 

Occasional Contributor
Posts: 7

Re: HTML results include all output from previous code

You mean you only want to have some of the general output printed? Like when you have three "proc print"s, you only want the output from the third? Or do you want to open multiple result tabs? I still do not quite get it.

SAS Super FREQ
Posts: 8,745

Re: HTML results include all output from previous code

Hi:
The automatic HTML file that SAS creates is a cumulative file. So if you turn on the automatic HTML file creation, the file you get is cumulative, when you are using SAS in the Windows environment. If you are using SAS University Edition or SAS Enterprise Guide, then every task or program gets one HTML file.

So the answer to your question, is really, to take full control of the output by using explicit HTML files.

If you are asking about how to control SAS on Windows, using the SAS Display Manager, then this paper has some suggestions and examples:
https://support.sas.com/resources/papers/proceedings12/250-2012.pdf

I prefer the "full control" method, as previously illustrated with the FILE= option in an ODS HTML statement. If that cumulative HTML file is not desired, then full control allows your user the best way to get exactly what they want.

cynthia
Super Contributor
Posts: 398

Re: HTML results include all output from previous code

Hi Cynthia,

 

Thank you so much for your reply.  We are using Base SAS in a windows eviroment.  Is there a way to clear the cumulative output every time before she runs the next section of code?

 

I will read the paper and see what I can use from there.  Thank you for your help.

SAS Super FREQ
Posts: 8,745

Re: HTML results include all output from previous code

Hi:
Whether you can clear the cumulative output depends on your version of SAS. In SAS 9.2, the answer was NO, you couldn't clear the cumulative output easily and start over. In SAS 9.4, yes, you should be able to stop the cumulative output when you use the RMB in the Results Window and choose delete.

I am still a big fan of the full control method. It works in any version of SAS on any operating system.

cynthia
Ask a Question
Discussion stats
  • 6 replies
  • 248 views
  • 0 likes
  • 3 in conversation