BookmarkSubscribeRSS Feed
NCNyrk
Calcite | Level 5
I am trying to create some very simple spreadsheets using HTML (XML output is too large) but would like to right-justify certain columns from a PROC PRINT. I've tried using .r style with HTMLCSS, but didn't get anywhere. Not sure what else to try...?
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
I tried this with ODS HTML3
[pre]
title; footnote;
ods html3 file='c:\temp\testjust_ht3.xls' style=sasweb;
proc print data=sashelp.class;
var name /style(data)={htmlstyle="text-align:right;" cellwidth=1in};
var age height;
run;
ods html3 close;
[/pre]

And when I opened the HTML 3.2 file with Excel, the Name was right-justified (I made the cellwidth bigger, so you could see the effect without enlarging the name column manually).

There must be some difference between HTML 3.2 (ODS HTML3) and the HTML generated by HTMLCSS (ODS HTMLCSS) and Excel's interpretation of the 2 versions of HTML tags -- The "vanilla" HTML 3.2 file and text-align worked with Excel and the HTMLCSS-generated file did not (even though it was HTML 3.2). Very strange -- but it didn't work at all with regular ODS HTML (HTML 4.0 tags) or ODS MSOFFICE2K (MS-HTML tags) -- so I suspect some HTML/Excel strangeness at work.

If you must use HTMLCSS or HTML4, then you might consider contacting Tech Support for further help.

cynthia
NCNyrk
Calcite | Level 5
That did it!

Thanks as always, Cynthia
NCNyrk
Calcite | Level 5
Cynthia,

When using the same approach with Proc Report, I do not seem to be able to force the column width using CELLWIDTH...does that option not work in Proc Report in HTML 3.2 code?

Thanks,
Kryn
Cynthia_sas
SAS Super FREQ
Hi:
Well, it may be Tech Support time...when I do this:
[pre]
title; footnote;
ods html3 file='c:\temp\testjust_ht3x.xls' style=sasweb;

proc report data=sashelp.class nowd;
define name /style(column)={htmlstyle="text-align:right;" cellwidth=2in};
define age / display;
define height /display;
run;
ods html3 close;
[/pre]

I get name right-aligned in a BIGGER column -- is it really 2 inches??? It doesn't look like it to me, but it IS bigger than it is without the CELLWIDTH style override.

So, I'm not sure what's happening.

cynthia

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
  • 880 views
  • 0 likes
  • 2 in conversation