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

Hello

In the following proc  tabulate I get an error related to the following statements:

1-  all='TOTAL2'*SUM=''

2-  all='TOTAL2'*rowpctn=''

May anyone help to fix the error please?

title;
proc tabulate data=sashelp.cars  out=want_a1(drop=_type_ _page_ _table_) format=comma21. MISSING;
 class origin    Type /order=formatted ;
 VAR  invoice;
table (origin='' All='Total1')
      , (Type='Car Type' )*(n=''*f=comma21.) all='TOTAL2'*N='' / rts=10 box='Factory Location'  misstext='0'  style=[pretext='Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(rowpctn=''*f=comma21.1) all='TOTAL2'*rowpctn='' / rts=10 box='Factory Location'  misstext='0'  style=[pretext='Tamhil Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*SUM=''*f=comma21.1)  all='TOTAL2'*SUM=''  / rts=10 box='Factory Location'  misstext='0'  style=[pretext='SUM Haamadot MLS'];

 table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*rowpctsum=''*f=comma21.1)  all='TOTAL2'*rowpctsum=''   / rts=10 box='Factory Location'  misstext='0'  style=[pretext='Tamhil Sum Haamadot'];
run; 
 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The ENTIRE LOG would be helpful. "An error" is really not very descriptive.

If it hadn't been for use of a SAS supplied data set you would have to provide such which gets:

16   proc tabulate data=sashelp.cars   format=comma21. MISSING;
17    class origin    Type /order=formatted ;
18    VAR  invoice;
19   table (origin='' All='Total1')
20         , (Type='Car Type' )*(n=''*f=comma21.) all='TOTAL2'*N='' / rts=10 box='Factory
20 ! Location'  misstext='0'  style=[pretext='Number of transactions'];
21
22   table (origin='' All='Total1')
23         , (Type='Car Type' )*(rowpctn=''*f=comma21.1) all='TOTAL2'*rowpctn='' / rts=10
23 ! box='Factory Location'  misstext='0'  style=[pretext='Tamhil Number of transactions'];
24
25   table (origin='' All='Total1')
26         , (Type='Car Type' )*(invoice=''*SUM=''*f=comma21.1)  all='TOTAL2'*SUM=''  / rts=10
26 ! box='Factory Location'  misstext='0'  style=[pretext='SUM Haamadot MLS'];
27
28    table (origin='' All='Total1')
29         , (Type='Car Type' )*(invoice=''*rowpctsum=''*f=comma21.1)  all='TOTAL2'*rowpctsum=''
29 !  / rts=10 box='Factory Location'  misstext='0'  style=[pretext='Tamhil Sum Haamadot'];
30   run;

ERROR: Statistic other than N was requested without analysis variable in the following nesting :
       Origin * All * Sum.
ERROR: Statistic other than N was requested without analysis variable in the following nesting :
       All * All * Sum.

Which is because you ask for SUM and PCTSUM without the variable.

proc tabulate data=sashelp.cars   format=comma21. MISSING;
 class origin    Type /order=formatted ;
 VAR  invoice;
table (origin='' All='Total1')
      , (Type='Car Type' )*(n=''*f=comma21.) all='TOTAL2'*N='' 
     / rts=10 box='Factory Location'  misstext='0'  
      style=[pretext='Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(rowpctn=''*f=comma21.1) all='TOTAL2'*rowpctn='' 
    / rts=10 box='Factory Location'  misstext='0'  
      style=[pretext='Tamhil Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*SUM=''*f=comma21.1)  all='TOTAL2'*invoice*SUM='' 
      / rts=10 box='Factory Location'  misstext='0'  
        style=[pretext='SUM Haamadot MLS'];

 table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*rowpctsum=''*f=comma21.1)  all='TOTAL2'*invoice*rowpctsum=''   
      / rts=10 box='Factory Location'  misstext='0'  
     style=[pretext='Tamhil Sum Haamadot'];
run; 

The statistics like Sum and Pctsum need to know which variable(s) are to be summed or similar.

 

 

View solution in original post

1 REPLY 1
ballardw
Super User

The ENTIRE LOG would be helpful. "An error" is really not very descriptive.

If it hadn't been for use of a SAS supplied data set you would have to provide such which gets:

16   proc tabulate data=sashelp.cars   format=comma21. MISSING;
17    class origin    Type /order=formatted ;
18    VAR  invoice;
19   table (origin='' All='Total1')
20         , (Type='Car Type' )*(n=''*f=comma21.) all='TOTAL2'*N='' / rts=10 box='Factory
20 ! Location'  misstext='0'  style=[pretext='Number of transactions'];
21
22   table (origin='' All='Total1')
23         , (Type='Car Type' )*(rowpctn=''*f=comma21.1) all='TOTAL2'*rowpctn='' / rts=10
23 ! box='Factory Location'  misstext='0'  style=[pretext='Tamhil Number of transactions'];
24
25   table (origin='' All='Total1')
26         , (Type='Car Type' )*(invoice=''*SUM=''*f=comma21.1)  all='TOTAL2'*SUM=''  / rts=10
26 ! box='Factory Location'  misstext='0'  style=[pretext='SUM Haamadot MLS'];
27
28    table (origin='' All='Total1')
29         , (Type='Car Type' )*(invoice=''*rowpctsum=''*f=comma21.1)  all='TOTAL2'*rowpctsum=''
29 !  / rts=10 box='Factory Location'  misstext='0'  style=[pretext='Tamhil Sum Haamadot'];
30   run;

ERROR: Statistic other than N was requested without analysis variable in the following nesting :
       Origin * All * Sum.
ERROR: Statistic other than N was requested without analysis variable in the following nesting :
       All * All * Sum.

Which is because you ask for SUM and PCTSUM without the variable.

proc tabulate data=sashelp.cars   format=comma21. MISSING;
 class origin    Type /order=formatted ;
 VAR  invoice;
table (origin='' All='Total1')
      , (Type='Car Type' )*(n=''*f=comma21.) all='TOTAL2'*N='' 
     / rts=10 box='Factory Location'  misstext='0'  
      style=[pretext='Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(rowpctn=''*f=comma21.1) all='TOTAL2'*rowpctn='' 
    / rts=10 box='Factory Location'  misstext='0'  
      style=[pretext='Tamhil Number of transactions'];

table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*SUM=''*f=comma21.1)  all='TOTAL2'*invoice*SUM='' 
      / rts=10 box='Factory Location'  misstext='0'  
        style=[pretext='SUM Haamadot MLS'];

 table (origin='' All='Total1')
      , (Type='Car Type' )*(invoice=''*rowpctsum=''*f=comma21.1)  all='TOTAL2'*invoice*rowpctsum=''   
      / rts=10 box='Factory Location'  misstext='0'  
     style=[pretext='Tamhil Sum Haamadot'];
run; 

The statistics like Sum and Pctsum need to know which variable(s) are to be summed or similar.

 

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 882 views
  • 1 like
  • 2 in conversation