有这样一个数据集a,如下:
customerID product name price discount (%) weekid area product category
现在想计算出,(1)在同一商品类别同一个地区同一个周,打折(即price discount>0)的商品有多少;
(2)在同一商品类别同一个地区同一个周,商品数量有多少。
我用如下程序计算(1)和(2):
proc sql;
create table pa as
select *, count(product name) as variable1
from res_data.p
where price discount>0
group by product category, weekid, area;
quit;
proc sql;
create table pb as
select *, count(product name) as variable2
from res_data.p
group by product category, weekid, area;
quit;
请问这样计算正确吗?为什么计算出来的(1)和(2)是相等的。数据中price discount有很多是等于0的,也就是不打折的商品