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;
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.
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.
May want
* (demandafterdisc=' ' * f=dollar12. * (sum=' ' pctsum<status all>) )),
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.