BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I am running proc tabulate code.

It is working perfect.

I just need to add a row of total (total column is already done in this code)

What is the way to do it please?


proc format;
value MisgCCFmt
0='a.0'
0-<4999.99='b.0-5K'
5000='c.5K'
5000-7500='d.5K-7.5K'
7500-10000='e.7.5K-10K'
10000-15000='f.10K-15K'
15000-20000='g.15K-20K'
20000-30000='h.20K-30K'
30000-50000='i.30K-50K'
50000-high='j.50K+'
;
run;


proc format;
value DropPCTFmt
-0.1-< 0='a.0 TO -10'
-0.2-< -0.1='b.-10 TO -20'
-0.3-< -0.2='c.-20 TO -30'
-0.4-< -0.3='d.-30 TO -40'
-0.5-< -0.4='e.-40 TO -50'
-0.6-< -0.5='f.-50 TO -60'
-0.7-< -0.6='g.-60 TO -70'
-0.8-< -0.7='h.-70 TO -80'
-0.9-< -0.8='i.-80 TO -90'
-0.95-< -0.9='j.-90 TO -95'
-0.99-< -0.95='k.-95 TO -99'
-1-< -0.99='l.-99 TO -100'
-1='m.-100'
;
run;


proc tabulate data=Raw_data(where=( YYY>5000 )) ;
class   YYY   PCT_DROP ;
var  ID;
table YYY=''*Customers=''*N=''*format=comma12. ,
       PCT_DROP="PCT_DROP"  all='TOTAL'/row=float box="misg_CC";
Format YYY   MisgCCFmt.     PCT_DROP   DropPCTFmt.;
run;
2 REPLIES 2
ed_sas_member
Meteorite | Level 14

Hi @Ronein 

 

It seems that the 'all' option is missing just before the comma in the TABLE Statement:

proc tabulate data=Raw_data(where=( YYY>5000 )) ;
class   YYY   PCT_DROP Customers;
var  ID;
table YYY=''*Customers=''*N=''*format=comma12. all='TOTAL',
       PCT_DROP="PCT_DROP"  all='TOTAL'/row=float box="misg_CC";
Format YYY   MisgCCFmt.     PCT_DROP   DropPCTFmt.;
run;
Ronein
Onyx | Level 15

Thank you,

When I add  all='Total'  before comma then I get  empty table and alert  "One or more tables in the report contains error".

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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
  • 2 replies
  • 2337 views
  • 0 likes
  • 2 in conversation