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

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.

 

 

CFC_SAS_Communities_400x225.jpgCFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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