BookmarkSubscribeRSS Feed
sasuser_sk
Quartz | Level 8

Hello, 

I have proc tabulate below and want to align my column to top. I have tried using vjust=T but that does not work. Maybe I am not putting vjust in the right place. Can someone please help here. Thank you!

 

Proc Tabulate DATA=WORK.FINAL_RESULT f=10.2 S=[foreground=black just = c]     ;

      VAR Acct_ID;

      CLASS "Group of Deals"n;

      CLASS Week;

      classlevels Week/style = {font_weight=bold  width=1.5in};

      classlevels "Group of Deals"n /style = {font_weight=bold width=1in just =c };

      TABLE /* Row Dimension */

            Week= '' all='Total',

/* Column Dimension */

'Group of Deals'n = ''*(Acct_ID=''*N='') All=''*n='Total' ;

 

RUN;

4 REPLIES 4
ballardw
Super User

WHICH column? You don't show a VJUST anywhere so you should show that as well.

Which is you active ODS style? and which ODS destination?

We may need example data to test code.

 

You may want VERTICALALIGN, not VJUST.

Getting any

sasuser_sk
Quartz | Level 8

I am sorry but I mostly get confused while asking questions and do no represent my question well. Here is my code with ODS statement and example of my output. I want to align C1,C2,C3 to the top as currently they are in the bottom of the cell. I do not know how to show data in this case but hope that output picture helps!. Thank you!

 

ods excel file= "&SAS_Folder.&ReportFileName." options (sheet_interval='table' sheet_name='Gross Loads' suppress_bylines='on' embedded_titles='ON' embedded_footnotes='ON');

title j=l "Weekly Loads - Q1 2021" ;

footnote j = l "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";

PROC TABULATE DATA=WORK.FINAL_RESULT f=10.2 S=[foreground=black just = c vjust=c]   ;

         VAR Acct_ID;

     CLASS "Group of Deals"n;

     CLASS Week;

     classlevels Week/style = {font_weight=bold  width=1.5in};

     classlevels " Group of Deals"n /style = {font_weight=bold width=1in just =c };

     TABLE /* Row Dimension */

            Week= '' all='Total',

/* Column Dimension */

Group of Deals'n = ''*(Acct_ID=''*N='') All=''*n='Total' ;

 

RUN;

RUN; QUIT; title;footnote;

sasuser_sk_0-1624315619942.png

 

 

ballardw
Super User

First thing I see is that you would have to have some other variable column heading creating a very tall cell to begin with and there isn't anything in your code that does that. Proc Tabulate for such short text values as C1 through C4 and Total, which would be the visible column headings, isn't going to make any cells high enough for a vertical alignment to be visible or to have the upper left box that tall either.

 

So, you need to show what is making those cells that tall in the first place.

 

For example:

proc tabulate data=sashelp.class;
   class sex;
   classlevels sex/style=[verticalalign=C];
   var height;
   table height,
         sex=' ' all='Total'
   ;
run;

None of the column headings would have the 5 or 6 "row height" appearance you show. So there is something left out.

Cynthia_sas
SAS Super FREQ

Hi: Sometimes to see the impact of verticalalign, you need to force the headers and rows to be tall, as shown in #1 below:

Cynthia_sas_0-1624321981618.png

 

So then you can see that for TALL header cells and rowheader cells the default alignment in the vertical direction is TOP. But for data cells, the default vertical alignment is BOTTOM.

 

  That can be changed with overrides as shown in #2. My code builds on the previous code, with tall column headers and tall rows to show the impact of the overrides.

 

Cynthia

 

Here's the full code:

proc tabulate data=sashelp.class;
   title '1) default alignment is Top for tall header cells and bottom for tall data cells';
   class sex;
   classlevels sex/style=[height=.75in];
   var height;
   table sex,
         height='This is the Height' all='Total'
     /box={label='This is a long text string that will make the column headers tall' style={width=1.5in}};
  keylabel sum=' ' n=' ';
run;

proc tabulate data=sashelp.class;
   title '2) change alignment for header and data cells';
   class sex /style=[just=C];
   classlevels sex/style=[verticalalign=m just=c height=.75in];
   var height /style={verticalalign=M};
   table sex,
         sum*height='This is the Height' n*all*{style={verticalalign=m}}
     /box={label='This is a long text string that will make the column headers tall' style={width=1.5in}};
  keylabel sum=' ' n=' ' all='Total';
  keyword all / style={verticalalign=B};
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1160 views
  • 0 likes
  • 3 in conversation