BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Onyx | Level 15

Hello

I want to add a total row after each origin.(There are 3 origins : Asia,Europe ,USA so I need to add 3 total rows)

What is the way to do it please?

 

proc tabulate data=sashelp.cars  out=want_a1(drop=_type_ _page_ _table_) format=comma21. MISSING;
 class origin   Type   Cylinders ;
 table origin='Factory Origin'*Type='Type of Car' all='TOTAL', (Cylinders='Number_Cylinders' )*(n=''*f=comma21.) all='TOTAL' / rts=10  misstext='0';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Maxim 6: Google Is Your Friend.

A search for "sas subtotal proc tabulate" immediately leads to this communities post (first hit), which gives me this solution:

 

proc tabulate data=sashelp.cars  out=want_a1(drop=_type_ _page_ _table_) format=comma21. MISSING;
 class origin   Type   Cylinders ;
 table (origin='Factory Origin' all="Origin Total")*(Type='Type of Car' all='TOTAL'), (Cylinders='Number_Cylinders' )*(n=''*f=comma21.) all='TOTAL' / rts=10  misstext='0';
run;

 

 

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

Maxim 6: Google Is Your Friend.

A search for "sas subtotal proc tabulate" immediately leads to this communities post (first hit), which gives me this solution:

 

proc tabulate data=sashelp.cars  out=want_a1(drop=_type_ _page_ _table_) format=comma21. MISSING;
 class origin   Type   Cylinders ;
 table (origin='Factory Origin' all="Origin Total")*(Type='Type of Car' all='TOTAL'), (Cylinders='Number_Cylinders' )*(n=''*f=comma21.) all='TOTAL' / rts=10  misstext='0';
run;

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1 reply
  • 736 views
  • 0 likes
  • 2 in conversation