BookmarkSubscribeRSS Feed
xappppp
Calcite | Level 5

in proc tabulate, if the case is simply like this

---------------------------------------------------

TABLE Gender*Blood,

              City*n;

---------------------------------------------------

Then I will get a table like following:

GenderBloodChicago

LA

MA14
B23
FA32
B41

Where you can see the gender column cells are merged within each level and with only one input. How can I have the cell unmerged and with the levels repeated in each row. like following. I know proc report probably can do this similar thing. but my tables are really complicated with all kinds of statistics and i wanna stick with proc tabulate. let me know if anyone have some good idea.

GenderBloodChicago

LA

MA14
MB23
FA32
FB41
4 REPLIES 4
ballardw
Super User

What do you want?

xappppp
Calcite | Level 5

clearly as the second table shows, in want the first row class (gender) with levels unmerged.

ballardw
Super User

When I first looked at your post the tables didn't show.

Depending on the statistics and other complexity of the tables I have often preprocessed the data using summary or even tabultate to get the statistics ant then used tabulate or sometimes proc print to display similar results.

Cynthia_sas
Diamond | Level 26

Hi:

  The way that TABULATE works with using the asterisk (*) operator, whether there are 19 levels of blood or 2 levels of blood within GENDER, then the rows for GENDER will span the rows for BLOOD.

TABLE Gender*Blood,    City*n;

 

There is no way in TABULATE to repeat nested or crossed values on every row (such as for GENDER), because, by default, TABULATE wants to make you a "nice" table with the "spanning" behavior. PROC REPORT would do what you want. But you said that you need TABULATE for "all kinds of statistics". REPORT has all the same statistics except the keywords for percentages and the KURTOSIS and SKEWNESS. And, because REPORT has the COMPUTE block, you could still calculate row percents or col percents if you needed to. Kurtosis and skewness are probably the only deal breakers, then.

cynthia

pix of REPORT output with LOTS of statistics and repeated values


report_fillin_rows.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 Update

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