BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm using proc tabulate and outputting to excel through ODS html. I can't get any of the justification options in the style= command to work. Any suggestions? thanks.
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
Excel is very picky about how you specify style attributes in an HTML file. In fact, Excel is "happier" rendering HTML 3.2 tags, or Microsoft-specific HTML tags than it is rendering HTML 4.0 tags.
One thing you can try is to use a different method of creating your HTML and see whether the justification is handled differently:
[pre]
ods html3 file='ht3.html' style=sasweb;
ods msoffice2k file='mso.html' style=sasweb;
...your SAS code ...
ods _all_ close;
[/pre]

You can try either of these methods of creating HTML files and see if Excel accepts the justification attributes better.

Otherwise, you have a few other choices:
1) create a Spreadsheet Markup Language XML file using ODS TAGSETS.EXCELXP and see if the justification attributes are honored:
ods tagsets.excelxp file='xpfile.xls' style=sasweb;
...your SAS code ...
ods _all_ close;

[/pre]


2) With any of the HTML methods, investigate using the HTMLSTYLE attribute in a STYLE= override (for PRINT, REPORT or TABULATE) to see whether you can specify a justification attribute that will be respected by Excel)

3) With the XML-based ExcelXP method, investigate using the TAGATTR attribute in a STYLE= override to see whether you can specify a justification attribute that will be respected by Excel.)

Just remember that one of the areas of difference between Microsoft and the W3C, in respect to style attributes and CSS style specifications for HTML was in the area of text alignment and how and where that style attribute should be specified.

You may wish to work with Tech Support on this question, as they can look at your code and look at your data and advise you about the best approach.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 957 views
  • 0 likes
  • 2 in conversation