This maybe overly simple but I am stuck...
My data is like this:
ID | Series | S_Days | P_days |
1 | 1 | 1_30 | 150_200 |
2 | 5 | 1_30 | 150_200 |
3 | 5 | 1_30 | 150_200 |
4 | 1 | 91_120 | NP |
5 | 5 | 61_90 | NP |
6 | 5 | 61_90 | 0_30 |
I need to count the number of ID's where P_days = NP and does not equal NP and group it by Series and S Days
I wrote the following but it's not working...
proc sql;
create table test as
select Series ,s_days
(case when p_days = 'NP' then count(ban) end) as NP,
(case when p_days ^= 'NP' then count(ban) end) as Pay
from Master
group by Series, S_days
;
quit;
would really appreciate any suggestions. Thank you.
I figured it out 🙂
count(case when (p_days ='NP') then ban end) as NP
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.