BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9

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

6 REPLIES 6
jefreytag
Fluorite | Level 6

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.

 

jerry898969
Pyrite | Level 9

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.

 

jefreytag
Fluorite | Level 6

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.

Cynthia_sas
SAS Super FREQ
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
jerry898969
Pyrite | Level 9

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.

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1235 views
  • 0 likes
  • 3 in conversation