The SAS Output Delivery System and reporting techniques

spanned header align center and by variable groups align also center

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 111
Accepted Solution

spanned header align center and by variable groups align also center

Hi Good evening all,

Need suggession in proc report. i used the below code for sashelp.class

 

ods tagsets.excelxp file="D:\New folder\sample.xls" style=minimal;
proc report data=sashelp.class nowd
STYLE(HEADER)={BACKGROUND=STEELBLUE FOREGROUND=WHITE FONTWEIGHT=BOLD FONT_FACE='CALIBRI' FONT_SIZE=10PT JUST=CENTER}
STYLE(REPORT)={BACKGROUND=WHITE FOREGROUND=BLACK BORDERCOLOR=WHITE FONT_FACE='CALIBRI' FONT_SIZE=10PT};
column sex ('Details' weight height);
define sex/ group;
define age/group;
define height /display;
define weight/display;
run;
ods tagsets.excelxp close;

 

the row header sex should be in center

by group variable of sex (F,M) that are also in center

the actual output we are getting and desired output i had attached in excel file.

please help me in this regard.

 

Thanks in advance.


Accepted Solutions
Solution
‎12-22-2015 07:54 AM
SAS Super FREQ
Posts: 8,647

Re: spanned header align center and by variable groups align also center

Hi:
I do not believe that "textalign" is the correct style attribute. I have always used vjust=m or verticalalign=m. In the doc, it explains that just= and textalign= both apply to horizontal justification -- please see:
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0xi2cygmfk0wkn1ei62... and also
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0xi2cygmfk0wkn1ei62...

cynthia

View solution in original post


All Replies
Super Contributor
Posts: 264

Re: spanned header align center and by variable groups align also center

After define sex/group style={just=center};

 

or 

 

style(column)={just=center}  in proc report option.

 

Frequent Contributor
Posts: 111

Re: spanned header align center and by variable groups align also center

tried but not giving desired output

Grand Advisor
Posts: 16,419

Re: spanned header align center and by variable groups align also center

Use the SPANROWS option on the proc report statement. I don't believe there's a way to get the header merged into one cell using TAGSETS.

http://blogs.sas.com/content/sastraining/2011/02/28/whats-so-great-about-spanrows/
SAS Super FREQ
Posts: 8,647

Re: spanned header align center and by variable groups align also center

Hi:

  It's not clear to me what you want. Just running your code, I can see that the header for SEX -is- centered -- you have to make the column wider to see the centering. But you only put JUST=CENTER on the STYLE(HEADER) override.

 

  If you want to see the F and M also centered, then you need to do an override on the DEFINE for the SEX variable, as Reeza showed.

define sex / group style(column)={just=c};

 

  If you want to "span" the row area then use the SPANROWS option.

 

cynthia

 

header_only_centered.png

Attachment
Frequent Contributor
Posts: 111

Re: spanned header align center and by variable groups align also center

ods rtf file="D:\New folder\sample123.rtf" style=overrides;
proc report data=sashelp.class nowd
STYLE(HEADER)={BACKGROUND=STEELBLUE FOREGROUND=WHITE FONTWEIGHT=BOLD FONT_FACE='CALIBRI' FONT_SIZE=10PT JUST=CENTER}
STYLE(REPORT)={BACKGROUND=WHITE FOREGROUND=BLACK BORDERCOLOR=WHITE FONT_FACE='CALIBRI' FONT_SIZE=10PT} SPANROWS;
column sex ('Details' weight height);
define sex / group style(column)= {just=center textalign=middle} ;
define age/group;
define height /display;
define weight/display;
run;
ods rtf close;

 

 

tried with ods rtf but desired output is not coming.

please suggest me.

Solution
‎12-22-2015 07:54 AM
SAS Super FREQ
Posts: 8,647

Re: spanned header align center and by variable groups align also center

Hi:
I do not believe that "textalign" is the correct style attribute. I have always used vjust=m or verticalalign=m. In the doc, it explains that just= and textalign= both apply to horizontal justification -- please see:
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0xi2cygmfk0wkn1ei62... and also
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0xi2cygmfk0wkn1ei62...

cynthia
Post a Question
Discussion Stats
  • 6 replies
  • 850 views
  • 0 likes
  • 4 in conversation