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

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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