BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear all,

 

We are migrating to SAS 9.4 from SAS 9.2. And I found a difference in the ods html text output, please see code below:

 

SAS 9.2

 

ods html file='C:\data\test.html'(no_top_matter no_bottom_matter);

ods html text="This is a test.";

ods html close;

 

generates this html output:

 

<div class="l UserText">This is a test.</div>

 

SAS 9.4 same code, html output:

 

<table width="100%" style=" border: 0px solid #000000; border-spacing: 0px;" cellspacing="0" cellpadding="0" rules="none" frame="void">

<tr>

<td class="l usertext">This is a test.</td>

</tr>

</table>

 

This is a problem for me because I have a html output where I generate 3 report and use this layout (with html <table>): first row: 2 reports next to each other. Second row: 3rd report below the first 2 reports from row 1. I programmed it like this:

 

Ods html text = “<table>”;

 

Ods html text =” <tr>”;

Ods html text = “ <td>”;

%output_report1;

Ods html text = “ </td>”

Ods html text = “ <td>”;

%output_report2;

Ods html text = “ </td>”;

Ods html text =” </tr>”;

 

Ods html text = “ <tr>”;

Ods html text = ” <td colspan=’2’>”;

%output_report3;

Ods html text = “ </td>”;

Ods html text =” </tr>”;

 

Ods html text = “</table>”;

 

With the new surrounding code of ods html text in SAS 9.4 this does no longer works and returns a real weird output/layout.

 

So my question is: Is there a way to tell ods html text to react like in SAS9.2 and not to use the <table> Code around my text?

 

Best wishes

Eva

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Hi Eva

 

Have a look at the ODS LAYOUT functionality.

 

The sample below shows an example, how to use it.

 

ods html file="c:\temp\sample.html";

ods layout gridded columns=2;
ods region;
title "title 1";
  proc print data=sashelp.class(obs=5);
    where sex = "F";
  run;

ods region;
title "title 2";
  proc print data=sashelp.class(obs=5);
    where sex = "F";
  run;

ods region column_span=2;
title "title 2";
  proc print data=sashelp.cars(obs=10);
  run;

ods layout end;
ods html close;

View solution in original post

6 REPLIES 6
BrunoMueller
SAS Super FREQ

Hi Eva

 

Have a look at the ODS LAYOUT functionality.

 

The sample below shows an example, how to use it.

 

ods html file="c:\temp\sample.html";

ods layout gridded columns=2;
ods region;
title "title 1";
  proc print data=sashelp.class(obs=5);
    where sex = "F";
  run;

ods region;
title "title 2";
  proc print data=sashelp.class(obs=5);
    where sex = "F";
  run;

ods region column_span=2;
title "title 2";
  proc print data=sashelp.cars(obs=10);
  run;

ods layout end;
ods html close;
Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Bruno,

 

thanx for the example. Looks easy. I'll try that one.

 

But generally is there a way (maybe through sas templates) to influence the ods html text - i.e. to remove the <table> around it? Unfortunately I have never used that but heard about it.

 

Best wishes

Eva

Cynthia_sas
SAS Super FREQ
Hi:
Unfortunately, it is NOT the style template that determines which HTML tags get written to the output file. That is the job of the TAGSET template that controls the ODS destination "markup" language that is written around the output from the SAS procedure.. If you want to alter the HTML that is automatically written by ODS, then you either need to switch to a different HTML-based destination or work with Tech Support or explore Bruno's suggestion for using ODS LAYOUT/ODS REGION or explore Kurt's suggestion of using DATA _NULL_.

cynthia
Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Cythia,

 

thanks for the answer. A pity though that I can't change it.I prefered the <div> around the text to the <table>, because logically a text has nothing to do with a table.

I'll use Bruno's suggestion then with the ods layout.

 

Best wishes

Eva

Eva
Quartz | Level 8 Eva
Quartz | Level 8

So now that I know I can't change the way ods html text is written into the html code I use this solution:

 

 

data _null_;
     file _webout;
     put "<table>";
     put " <tr>";
     put "  <td>";
run;

......

data _null_;
     file _webout;
     put "  </td>";
     put " </tr>";
     put "</table>";
run;

 

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
  • 5355 views
  • 0 likes
  • 4 in conversation