BookmarkSubscribeRSS Feed
smeyerch
Calcite | Level 5
Hi,



I'm running the same SAS program in version 9.1.3 and in version 9.2


An HTML output file is being produced using these statements:



[pre]
ods html path ="C:/Temp" file ="MyFile.html" ;
title1 "My-Title-1";

data _null_;
set work.mydata;
by descending year;
file print ps=80 ls=200 ll=remain;
if first.year then
put ''
' Lines as per: ' year
'
';

put ...;
......
run;
ods html close;
[/pre]


(Maybe it's not very elegant using a data step, but it has worked fine so far.)



But now: The appearance of the html files in a browser is quite different between the two versions of SAS.

It sounds not like a big deal to handle this but I just don't find the clue.

On another occasion (basically the same data-step), I produce frames, ToC and Table of Pages - they all look perfect.

The issue arouses only in the 'file=' output.



The cause of the different appearance lies in a single html-"table"-tag description:



9.1.3 produces:


[pre]


[/pre]


9.2 produces:


[pre]

Lines as per: 2011


[/pre]


If I replace just the definition of the 9.2-table-tag with the 9.1.3-table-tag using a text editor like notepad the output appears exactly the same in both versions.



My fruitless efforts have been so far:



1.

I have tried to make my on style and use it:



[pre]
proc template;
define style myownstyle ;
parent = styles.default ;
replace Table /
borderspacing= 1
padding = 7
rules = groups
frame = box
bordercolor = #000000 ;
end;
run;
[/pre]


Comparing the 9.1.3 'default' style with the one in 9.2 shows (as expected) differences -
except for the table definition.


There are no specific properties specified for 'table'. So that did not help.




2.

The html file contains a lot of css-definitions. As 'class=Batch' is used, I tried to make my own css-file using the EnterpriseGuide 4.3 Style Manager.

But I didn't succeed having the 'ods html'-statement READ my css-file. It always wanted to WRITE it.

I got lost in the documentation about 'ods markup tagset=htmlcss stylesheet='.



Am I ending up using a data step and process the html-file like



[pre]
filename myFile "C:/Temp/MyFile.html";
data _null_;
length text $ 400;
infile myFile length=reclen truncover;
file myFile ps=200 noprint;
input @;
input text $varying400. reclen;

if text = '<92-table>'
then text = '<913-table>';

put text $varying400. reclen;
run;
[/pre]
???


That would work but it hurts, doesn't it. We should not manipulate the outcome but we do want to control the production, don't we?



Please, I kindly invite you to share your ideas with me.



Thanks

Lines as per: 2011
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
There are several things to try. However, if you are generating this output in the context of a stored process using the BI Platform, then you may want to work with Tech Support.

1) try using ODS HTML3 versus ODS HTML. Some changes between the 2 version is that ODS HTML3 generates HTML 3.2 compliant tags -- this was a version of HTML, in which the CSS was not required. ODS HTML in SAS 9 generates HTML 4.01 compliant tags. In the HTML 4 spec, in-line CSS or external CSS references were required.

2) If you do use ODS HTML3, then one thing you can do is either point to a "dummy" css file
[pre]
ods html3 path='c:\temp' (url=none)
file='ht3_fakecss.html'
stylesheet=(url='nothing.css');

proc print data=sashelp.class;
run;

ods html3 close;
[/pre]

or point to a "real" css file:
[pre]
ods html3 path='c:\temp' (url=none)
file='ht3_real_css.html'
stylesheet=(url=http://www.wombat.com/styledir/corpstyle.css');

proc print data=sashelp.class;
run;
ods html3 close;
[/pre]

In the first instance, a link tag will be built that points to a file called "nothing.css" -- which is just a fake name -- this will remove any inline style and keep any <font> tags out of the HTML tags. The <TABLE> tag will be generated the "old way", as you desire. In the second instance, assuming that you do have a corporate CSS file that you want/need to use, then the STYLESHEET= option points to the real location of the real CSS file to be used.

CSS and stylesheets work slightly differently on the BI platform. Not all client applications will use a CSS stylesheet -- for example, Web Report Studio and the SAS Add-in for Microsoft Office (PowerPoint) might both use different CSS (defined in the XML that styles WRS, for example; or as style is defined for the SASReport XML received by PowerPoint).

You might want to work with Tech Support, anyway, as the technique you show (FILE PRINT PS=80 LS=200 and LL=remain) are LISTING only techniques and might not work with ODS HTML. Or, if they have worked in the past, they might not continue to work as they did in the past.

cynthia


this is a useful page:
http://support.sas.com/rnd/base/ods/templateFAQ/Template_csstyle.html#defaults
smeyerch
Calcite | Level 5
Hi Cynthia,

Thank you for your hyper-fast reply with those valueable hints. (You acutally saved my weekend)

First I tired ODS HTML3 without any further style- or stylesheet-parameter.
It delivered the best results, a 99.8% match to the version 9.1.3 output. (In appearance only of course. The actual file contents is rather different as expected.)

The "dummy" css approach came close too. I would have had to work on background colors and fonts but the borders/frames/boxes looked fine.

The "real" css shows a 95% match. The 'light' that 'shines' from top left onto the page makes the frame appear a bit different. But it is very interesting to modify the css file and reload the ready html output in the browser and see how changes instantly apply.
(Pardon my childish enthusiasm but as a bone dry data cruncher discovering web technologies is fascinating 🙂


The code is running in SAS Foundation, there is no BI platform or -studio involved. Anyway, I hope the underlying legacy system is not running for long anymore. That would give us the chance to get rid of this data-step html output creation.


Thanks again for your support. It has improved my understanding of the pricipals of html output building a lot.
Kevin_SAS
SAS Employee
In each version of SAS, we have been trying to move to using more CSS attributes and fewer tables to do the formatting. The class=batch should be drawing the border on the output, but it sounds like you aren't seeing that. You could try adding borders to the batch style element similarly to the way that you tried with table as follows:

proc template;
define style myownstyle ;
parent = styles.default ;
class batch /
bordercolor = #000000
borderwidth = 1px
borderstyle = solid;
end;
run;
smeyerch
Calcite | Level 5
Hi Kevin,



Thank you for your example of proc template.


You are right, I do not see a border around the table and fonts are also different from the 9.1.3 version.



I have noticed the statement

[pre]
border: 1px solid #000000;
[/pre]
in the .Batch{} definition of the SAS 'default' style. Wouldn't this cover the statements in your example?



Working with the style editor in Enterprise Guide produced this .Batch{} definition for my own css file (see reply to cynthia). It contains your statements:


[pre]
.Batch{
font-family: 'sas monospace','courier new',courier,monospace;
font-size: x-small;
color: #000000;
background-color: #D3D3D3;
font-style: normal;
font-weight: normal;
padding-top: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-left: 7px;
margin-top: 1px;
margin-right: 1px;
margin-bottom: 1px;
margin-left: 1px;
border-width: 1px;
border-style: solid;
border-color: #000000;
border-collapse: separate;
border-spacing: 1px;
}
[/pre]


The next time I'm faced with such a challange I'll re-write the program to avoid using a data step to produce html output.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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