BookmarkSubscribeRSS Feed
deleted_user
Not applicable
is it simple?
for a worksheet generated via tagsets.excelXP
... to modify the column headers handling (PROC TEMPLATE ?) to "Top-align", so that they don't overlap the autofilter widget.

I have little confidence as I approach this ... including that I'll be able to find the relevant documentation of the features of PROC TEMPLATE 😉

Your support is appreciated.. greatly

PeterC
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
There is a style attribute called VJUST and in regular ODS HTML, RTF, PDF, etc, you'd use that. But sometimes Excel doesn't like the SAS style alignment. Perhaps one of the ODS developers knows whether Excel respects VJUST.

cynthia
deleted_user
Not applicable
Thank you Cynthia....

I'm missing something. [pre]ods _all_ close ;
ods tagsets.excelxp file= odsout( url= none) rs= none ;
ods tagsets.excelxp options( height= '20'
absolute_column_width= '10' ) ;
proc print LABEL data= sashelp.class style(header)={vjust=Top} ;
LABEL AGE = 'LETS TRY to wrap A WIDE LABEL FOR AGE' ;
run;
ods _all_ close ;

NOTE: This is the Excel XP tagset (SAS 9.1.3, v1.70, 06/05/07)[/pre] The fileref ODSOUT is effective at delivering the generated xml, into excel.

The control of cell heights and column widths work just fine for me.

I was hoping to pin down control of justification within the PROC PRINT syntax.
Oddly, on the workbook generated, the only cells that do not have the "wrap" attribute, are the column headers (practicaly the only cells I would want to wrap!)

Does this mean I have to go into PROC TEMPLATE ?


PeterC
deleted_user
Not applicable
so, it was time to delve into PROC TEMPLATE (see later).
That allowed my proc print syntax to become a little simpler :[pre]proc print LABEL data= sashelp.class style(header)= Header ;[/pre]

The definition of the "style(header)= Header" header was made in :[pre]PROC TEMPLATE;
DEFINE style styles.myXstyle ;
parent = styles.default;
style Header from Header /
just = left
vjust = top;
END;
run;[/pre] and that style with the special Header is invoked with [pre]ods tagsets.excelxp file= odsout( url= none) rs= none style=myXstyle ; [/pre]

It will do for now, but does seem a little convoluted, especially when style requests like justification are able to be defined within the proc print syntax.

PeterC
Cynthia_sas
SAS Super FREQ
Peter:
In my limited understanding of ExcelXP, I think the issue has to do with how Microsoft respects or does not respect style information. The SAS style template goes into building the in-line style section for the ExcelXP XML file. Then the style overrides that come into the picture, via the procedure syntax are put "down" in the tag for the cell or element itself.

I think that Microsoft, by design, mostly respects what comes in via the in-line style section. I do find that backgrounds and foreground colors, fonts, formats and cell types are generally respected when they come into the XML via a style override (procedure syntax) -- but very frequently alignment seems to be ignored.

Although it may seem like the PROC TEMPLATE method is convoluted, do remember that if your PROC PRINT was followed by a PROC GLM or a PROC REG or a PROC MEANS, that their headers would ALSO be affected by the STYLE template and since they do not have any internal syntax to change their headers, this is a good thing.

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