BookmarkSubscribeRSS Feed
AlexHuang
Calcite | Level 5

Hi Cynthia,

I have another problem with the row header alignment.

kp.JPG

the number fields in the row header is always aligned right.

How can I align them left.

I have tried these methods

1.

replace RowHeader from Header /

just = center

2.

proc tabulate data=  missing order=formatted style=[just=center]  ;

table &row * {style=[just=left]}

but none of above works.

Please help. Thanks a lot!

Cynthia_sas
SAS Super FREQ


Hi:

  It's hard to say. The REPLACE statement went away in SAS 9.2, so your style code is suspect unless you are still running SAS 9.1.3. But, you didn't show your whole template, and besides, what you specify in a style template would apply to ALL the row headers the same way. That's why I prefer to use style overrides in my CLASS and CLASSLEV statements, so I can possibly apply one set of style attributes to one variable and another set of style attributes to another variable.

  Also, any style adjustments you make on the PROC TABULATE statement or on the TABLE statement ONLY apply to the calculated table cells, shown in pink in the #1 output below. What you specify in the TABULATE or TABLE statements would have no impact on the row title (or row header) area in TABULATE output. Next, you show a macro variable &ROW -- but where is your CLASS statement or statements??? It would be those statements where your overrides would be specified (or the CLASSLEV, depending on whether you wanted to style the headers for the CLASS variables or the class levels for the variables.

  Take a look at the attached code and screenshots. BTW, this was a really OLD post that you piggy-backed your question onto, and it was already a long post with several back and forth questions. Your tagging onto the old post made it even longer. I generally recommend that you start a new post and then either reference the older post or just let us know that you've tried a solution posted in an earlier post. Certainly, this second question about row headers was off-topic from the first, older post, which started out as a PROC TABULATE post, but then turned into being about PROC REPORT. I would recommend that if you have another question, that you start a new forum post instead of tacking your question onto an older post.

cynthia

ods tagsets.excelxp file='c:\temp\align_hdr.xml'

    style=sasweb;

         

proc tabulate data=sashelp.class style={background=pink};

  class age sex;

  var height;

  table age*sex all,

        height*(min max) / box='1) Override on TABULATE Stmt';

run;

  

proc tabulate data=sashelp.class;

  class age / style={just=c background=pink color=black};

  class sex / style={just=c background=yellow color=black};

  classlev age / style={just=c};

  classlev sex / style={just=l};

  var height/style={just=r};

  table age*sex all,

        height*(min*{s={just=l}} max*{s={just=c}})

      /box="2) With Overrides Other Stmts";

  keyword all / style={just=c color=cyan};

  keyword min max / style={just=l color=red};

run;

 

ods tagsets.excelxp close;


override_tab_stmt.pngoverride_other_stmts.png

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
  • 16 replies
  • 2137 views
  • 0 likes
  • 4 in conversation