Hi All,
I have
ID currdate pvecnt nvecnt
1 11apr2016 0 2
1 12 apr 2016 3 4
1 13apr2016 5 5
1 16apr2016 6 10
i need 2 vars sum(pve/nve) cnt on weekend and sum(pve/nve) cnt on weekday
logic i used
proc sql;
select id ,(case when pvecnt >0 and nvecnt>0 and weekday(currdate) in (1,7) then sum(pvecnt,nvecnt) as weekend_cnt,
case when pvecnt >0 and nvecnt >0 and weekday(currdate) not in (1,7) then sum(pvecnt,nvecnt) as weekday_cnt)
from table group by id;
quit;
rather than getting 1 result m getting 4 rows and sum of their vars in horizontally
what i want :
id wknd_cnt wkdy_Cnt
1 16 17
i'm not considering row where either of pvecnt or nvecnt is 0.
Thanks
... View more