BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
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

6 REPLIES 6
slchen
Lapis Lazuli | Level 10

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

 

or 

 

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

 

Ravikumarkummari
Quartz | Level 8

tried but not giving desired output

Reeza
Super User
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/
Cynthia_sas
SAS Super FREQ

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


header_only_centered.png
Ravikumarkummari
Quartz | Level 8

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.

Cynthia_sas
SAS Super FREQ
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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 5718 views
  • 1 like
  • 4 in conversation