BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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
Meteorite | Level 14

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".

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 943 views
  • 0 likes
  • 2 in conversation