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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 790 views
  • 0 likes
  • 1 in conversation