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

 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;

1 ACCEPTED SOLUTION

Accepted Solutions
TMiles
Quartz | Level 8
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

4 REPLIES 4
Astounding
PROC Star

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.

TMiles
Quartz | Level 8

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.

ballardw
Super User

May want

 

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

TMiles
Quartz | Level 8
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;



sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 4107 views
  • 0 likes
  • 3 in conversation