BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ANKH1
Pyrite | Level 9

Hi,

We want to produce a table where the first column header is aligned to the left but the second column header is centered. I have this code and I don't know how to change it to get the display I want. How can you modify? I am not familiar with proc report.

proc report data= dsin nowd missing split = '~'
style(report)={frame=box}
style(header)={font=('Times New Roman', 8 pt) just=center background=lightgrey}
style(column)={font=('Times New Roman', 8 pt) just=left};
column label sample;
define label / display "This is a header" style(column)={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style(column)={just=center cellwidth = 3 cm};
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
define label / display "This is a header" style(column)={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style(column)={just=center cellwidth = 3 cm};

Try this. Remove the location qualifier (column) from your style overrides in the DEFINE statement. 

 

define label / display "This is a header" style={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style={just=center cellwidth = 3 cm};

View solution in original post

5 REPLIES 5
A_Kh
Barite | Level 11

You should use style (header)= attributes in the define statements (which is individual) and remove justifications from the proc report statement (which is general).

 

proc report data= dsin nowd missing split = '~'
style(report)={frame=box}
style(header)={font=('Times New Roman', 8 pt) background=lightgrey}
style(column)={font=('Times New Roman', 8 pt) };
column label sample;
define label / display "This is a header" style(header)= {just=left} style(column)={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style(header)= {just=center} style(column)={just=center cellwidth = 3 cm};
run;

 

ANKH1
Pyrite | Level 9
Thank you for replying!
data_null__
Jade | Level 19
define label / display "This is a header" style(column)={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style(column)={just=center cellwidth = 3 cm};

Try this. Remove the location qualifier (column) from your style overrides in the DEFINE statement. 

 

define label / display "This is a header" style={just=left cellwidth = 12.0 cm asis=on};
define sample / display "sample" style={just=center cellwidth = 3 cm};
ANKH1
Pyrite | Level 9
Thank you!
ballardw
Super User

Not a very clear description of what you want. Do actually want the second column centered or not?

Hard to test code without data.

 

You can override procedure level settings in the Display statement:

define label / display "This is a header" style(column)={just=left cellwidth = 12.0 cm asis=on}
                                          style(header)={just=left}
;

for example changes  the HEADER setting for Label to left justify leaving other settings alone.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 1688 views
  • 0 likes
  • 4 in conversation