DATA Step, Macro, Functions and more

ODS HTML - Store generated HTML code in dataset

Reply
Occasional Contributor
Posts: 7

ODS HTML - Store generated HTML code in dataset


Hi,

I would like to store the generated HTML code(including all tags) as text/string in a dataset column instead of printing it out into a HTML document. Is there an ODS option to do this in SAS?

Any hints appreciated, thank you.

Onur

Super Contributor
Posts: 282

Re: ODS HTML - Store generated HTML code in dataset

Posted in reply to Onur_Goekcen

Hi,

I'm not sure if there is an option to do this.

It might not be efficient, but have you considered creating the file then reading it in SAS to create your data set.

Regards,

Amir.

SAS Super FREQ
Posts: 8,868

Re: ODS HTML - Store generated HTML code in dataset

Posted in reply to Onur_Goekcen

Hi,

There is no ODS option to automatically do this in your ODS invocation statement or SAS options. However, you can always post-process the HTML file, after ODS creates the file, and read the HTML into a SAS dataset (using INFILE/INPUT syntax). However, I don't really understand why you would want to do this. It is possible, but I'm not sure what the utility of such a dataset would be.

cynthia

Occasional Contributor
Posts: 7

Re: ODS HTML - Store generated HTML code in dataset

Posted in reply to Onur_Goekcen

Hi, thanks for your replies.

We are generating approx. 5k HTML files(each file is the evaluation result of a risk method) per year in scope of our risk method validation process. These outputs are published in our web platform only and are not accessed directly.To ease the maintenance of physically stored files, we are tending to this approach.

I'll try to read the files after they are generated.

Onur

SAS Super FREQ
Posts: 8,868

Re: ODS HTML - Store generated HTML code in dataset

Posted in reply to Onur_Goekcen

Hi,

  I guess I don't understand the maintenance issues. Wouldn't you just add HTML files for every year or risk scenario? So, as long as you have write access to a browser folder, this year, you might have something like this:

report_2010_r1.html

rejport_2010_r2.html

report_2011_r1l.html

report_2011_r2.html

report_2012_r1.html

report_2012_r2.html

report_2013_r1.html

report_2013_r2.html

...and then next year you would add report_2014_r1.html etc, etc...

  As long as you keep your original datasets that were used to create the HTML files, you should be able to recreate any of the HTML files. Or, you could store the procedure results in an ODS DOCUMENT store, for archive purposes. Having the HTML tags and output in a SAS dataset just give you a different maintenance issue -- instead of 5K HTML files, won't you have 5K SAS datasets to maintain if you make a dataset for every HTML file? Once you had the HTML in a SAS dataset, how do you envision using these SAS datasets?  Also, I don't understand what you mean when you say that the outputs are "published in our web platform only and are not accessed directly." If the HTML outputs are not accessed, why bother saving them?

  If you're using SAS/IntrNet or the BI Platform or stored processes, you could dynamically generate an output when you need it. Or you could have a macro program that took a year or a set of parameters to control the number of HTML files that were created.

cynthia

Ask a Question
Discussion stats
  • 4 replies
  • 308 views
  • 0 likes
  • 3 in conversation