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;
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.