Help using Base SAS procedures

Proc Tabulate PctSum demominator error

Accepted Solution Solved
Reply
Contributor
Posts: 43
Accepted Solution

Proc Tabulate PctSum demominator error

 I am having trouble calculating the % of total for the 2nd level in my nesting.  I get the error "PctSum base is not in table. A PctSum crossing has no denominator"

 

here is my code:

 


proc tabulate data=c2 missing;
class yrmon status item_status_at_order daysonsale;
var demandafterdisc;
table yrmon='' * ((status='' all=' ')
* demandafterdisc=' ' * f=dollar12. * sum=' ' demandafterdisc=' '*pctsum<status all>),
item_status_at_order=' ' all='Total' daysonsale=' ' all='Total';
format daysonsale sale. item_status_at_order $cmat.;
title1 ' ';
run;


Accepted Solutions
Solution
‎08-03-2016 04:43 PM
Contributor
Posts: 43

Re: Proc Tabulate PctSum demominator error

I was able to figure it after many tries -see below:


proc tabulate data=c2 missing;
class yrmon status item_status_at_order daysonsale;
var demandafterdisc;
table (yrmon='' * (status='' all=' ')
* demandafterdisc=' ' * (sum='Sales'*f=dollar12. pctsum<status all>='% of Total'*f=comma6.2)),
item_status_at_order=' ' all='Total' daysonsale=' ' all='Total';
format daysonsale sale. item_status_at_order $cmat.;
title1 ' ';
run;



View solution in original post


All Replies
Super User
Posts: 5,516

Re: Proc Tabulate PctSum demominator error

Here's the change I would try.  You now have this line:

 

* demandafterdisc=' ' * f=dollar12. * sum=' ' demandafterdisc=' '*pctsum<status all>),

 

Try this instead:

 

* (demandafterdisc=' ' * f=dollar12. * sum=' ' pctsum<status all>)),

 

As it stands now, the space before the second DEMANDAFTERDISC= means that the only classification variable being used is YRMON.

 

This recommendation untested, as you might imagine.  So let's see what happens.

Contributor
Posts: 43

Re: Proc Tabulate PctSum demominator error

Posted in reply to Astounding

new error   -  maybe i'll just move the table without the % to EXCEL and calc...

ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * status * PctSum * item_status_at_order.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * status * PctSum * All.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * status * PctSum * daysonsale.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * status * PctSum * All.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * All * PctSum * item_status_at_order.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * All * PctSum * All.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * All * PctSum * daysonsale.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : yrmon * All * PctSum * All.

Super User
Posts: 11,343

Re: Proc Tabulate PctSum demominator error

Posted in reply to Astounding

May want

 

* (demandafterdisc=' ' * f=dollar12. * (sum=' ' pctsum<status all>) )),

Solution
‎08-03-2016 04:43 PM
Contributor
Posts: 43

Re: Proc Tabulate PctSum demominator error

I was able to figure it after many tries -see below:


proc tabulate data=c2 missing;
class yrmon status item_status_at_order daysonsale;
var demandafterdisc;
table (yrmon='' * (status='' all=' ')
* demandafterdisc=' ' * (sum='Sales'*f=dollar12. pctsum<status all>='% of Total'*f=comma6.2)),
item_status_at_order=' ' all='Total' daysonsale=' ' all='Total';
format daysonsale sale. item_status_at_order $cmat.;
title1 ' ';
run;



☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 502 views
  • 0 likes
  • 3 in conversation