BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15
Hello
I am using proc tabulate to create summary table.
As you can see in the photo rhe cells in date column are merged in multiple rows .
I want to ask ahat is way to see the value on each row as you can see in the photo.
4 REPLIES 4
andreas_lds
Jade | Level 19

I can't see any photo. Have you checked the docs of proc tabulate? If it is possible to prevent merging, i am sure you will find the option in the docs.

Kurt_Bremser
Super User

Please post the source dataset (data step with datalines), the code you used, and an example for the expected result (we can easily recreate your current result by running your code on your data).

RichardDeVen
Barite | Level 11

I think you are asking about the merged cells in the first row.

This happens because the labels for the row dimension classes are shown there

 

The table option NOCELLMERGE puts the row dimension labels in a separate row.  However, this is often also not desired, and you will end up modifying the table statement more -- delabeling the row row header and placing the label in the upper left hand box.  This is done using <class>='' and / box="<class>" in the table statement.

 

Example:

proc format;   
  picture MBT (fuzz=0)
    1E03-<1000000='0000 ' (prefix='' mult=.001)
  ;
run;

ods html5 file='tabulate.html';

title "Default TABULATE";
proc tabulate data=sashelp.shoes;
  class region product ;
  var sales;
  label Sales = 'Sales $(,000)';

  table 
    product
    , 
    sales*sum=''*f=MBT. * region
  ;

  where region <= 'Canada' and product < 'S';
run;


title "NOCELLMERGE";
proc tabulate data=sashelp.shoes;
  class region product ;
  var sales;
  label Sales = 'Sales $(,000)';

  table 
    product
    , 
    sales*sum=''*f=MBT. * region
  / 
    NOCELLMERGE                                         /* prevent the first row cell merging */
  ;

  where region <= 'Canada' and product < 'S';
run;

title "NO Row dim header and BOX";
proc tabulate data=sashelp.shoes;
  class region product ;
  var sales;
  label Sales = 'Sales $(,000)';

  table 
    product=''                               /* ='' removes row dim header */
    , 
    sales*sum=''*f=MBT. * region
  / 
    BOX=[label='Product' style=[VerticalAlign=bottom]]   /* manually enter removed row dim header in the 'BOX' cell */
  ;

  where region <= 'Canada' and product < 'S';
run;


ods html close;

Output:

image.png

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1731 views
  • 3 likes
  • 5 in conversation