BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I need to read a file for each row and I need to generate an HTML page with the values from the file.

Earlier, I hardcoded the HTML commands in the SAS program. My requirement is to create a HTML template and read the data from the file and populate the data on to the HTML page.

Benefits of doing this is that I can change the message on the HTML template instead of changing the messages in the SAS program.
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
Have you tried this:
[pre]
ods html file='c:\temp\somefile.html' style=sasweb;
proc print data=sashelp.class;
run;
ods html close;
[/pre]

This would take the data in SASHELP.CLASS and write out each row to an HTML file entitled SOMEFILE.HTML stored in the c:\temp directory.

Before ODS, people sometimes used code like this to generate their own HTML page:
[pre]
data _null_;
set sashelp.class end=eof;
file 'c:\temp\myowncode.html';
** write some html at the top of the file;
if _n_ = 1 then do;
put '';
put 'wombat';
end;
** write something out for every row;
put '';
** write something out at the end of the data;
if eof then do;
put '
' Name '' Age '
';
end;
run;
[/pre]

How you would approach a solution to your question depends on what you want to do. If you have a basically tabular HTML report and you have a customized CSS file that has all your font and color preferences, then you could invoke ODS this way and use your own CSS file:
[pre]
ods html path='c:\temp' (url=none)
file='usemystye.html'
stylesheet=(url='http://myserver.com/styledir/style.css');
.... rest of code...
ods html close;
[/pre]
OR you could generate a SAS style template to contain the colors and fonts preferences that you have.

Another kind of template you could use with ODS is a TAGSET template that would allow you to change the kind of MARKUP language tags that were written out around your data.

But, I'm not sure that you're talking about an ODS HTML template in the context of what you can do with ODS. I wonder whether you are talking about the kind of CGI templates that you can make and then populate with Perl or PHP or ASP or other scripting languages. (as described here:
http://html-template.sourceforge.net/article.html )

In either case, your best bet may be to contact SAS Technical Support so they can determine exactly what kind of existing program you have and what kind of conversion program is best for your solution.

Good luck,
cynthia
deleted_user
Not applicable
Hi Cynthia,

This what I am using earlier. The code that I had written on the mainframe is using the ODS concept. I had to move the code that is running on the mainframe to the SAS EG. But major processing will be done on mainframe. When ever the changes need to be applied on the HTML page, I had to change the code in the program. I do not want to that. I want to change the text changes of the HTML page instead of changing them in the code. I want to use the HTML page as a blank template, where the gaps can be filled by reading the dataset.

Thanks,
Vinod
Cynthia_sas
SAS Super FREQ
Without looking at your code, it is hard to understand what it is you want to do. If you were using ODS HTML, even on the mainframe, then there's not much you would have had to change in your program, except the code in the middle of the ODS "sandwich".

If you want to alter the HTML tags themselves -- for example, ODS writes out a <TABLE> tag for your output with <TD> tags for each cell. If you wanted to write out an Ordered List with <OL> and <LI> tags instead of the tags that ODS writes out (or you wanted to insert some JavaScript into the HTML page), then you CAN change the tagset template that is used to create your HTML output.

You would have to use PROC TEMPLATE to create a modified version of the HTML tagset template. I suggest that you contact SAS Tech Support, because they CAN look at your existing code and they can make suggestions about how you could alter the tagset template for HTML in order to generate the kind of output you want.

It is also possible with ODS to create XML files, so if your web server had a mechanism to transform from XML to HTML, and if you knew what your XML requirements would be to build an XML "data island", then you might also consider creating XML output. Tech Support could help you with this task as well.

For information on contacting Tech Support, refer to: http://support.sas.com/techsup/contact/index.html

Good luck,
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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 685 views
  • 0 likes
  • 2 in conversation