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

This maybe overly simple but I am stuck...

 

My data is like this:

IDSeriesS_DaysP_days
111_30150_200
251_30150_200
351_30150_200
4191_120NP
5561_90NP
6561_900_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.

1 ACCEPTED SOLUTION

Accepted Solutions
TheNovice
Quartz | Level 8

I figured it out 🙂

count(case when (p_days ='NP') then ban end) as NP

View solution in original post

1 REPLY 1
TheNovice
Quartz | Level 8

I figured it out 🙂

count(case when (p_days ='NP') then ban end) as NP

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 724 views
  • 0 likes
  • 1 in conversation