BookmarkSubscribeRSS Feed
shuchidxt_gmail_com
Obsidian | Level 7

Hi ,
 
I am looking for quick method to exactly find  two string "CASE" AND PARTY in a field.
 
Example:my data looks like below and I want to pick count for below highlighted records having PARTY and CASE mentioned in the string.
 
CASE_11233108000001 1
CASE_11233108000004 1
CASE_11233108000005 1
CASE_11233108000006 1
CASE_11233108000013 1
CASE_11233108000015 1
CASE_11233108000016 1
CASE_11233108000018 1
CASE_11233108000019 1
CASE_11233108000020 1
INCIDENT_51233108000001 3
INCIDENT_51233108000004 3
INCIDENT_51233108000005 3
INCIDENT_51233108000006 3
INCIDENT_51233108000013 3
INCIDENT_51233108000015 3
INCIDENT_51233108000016 3
INCIDENT_51233108000018 3
INCIDENT_51233108000019 3
INCIDENT_51233108000020 3
PARTY_X234306CASE_11233108000005 1
PARTY_X2367375CASE_11233108000004 1
PARTY_X2412976CASE_11233108000006 1
PARTY_X242762CASE_11233108000001 1
PARTY_X234306INCIDENT_51233108000005 1
PARTY_X2367375INCIDENT_51233108000004 1
PARTY_X2412976INCIDENT_51233108000006 1
PARTY_X242762INCIDENT_51233108000001 1

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Like this?

data WANT; 
  SET HAVE;
  COUNT + ( index(VAR,'PARTY') & index(VAR,'CASE') );
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 400 views
  • 0 likes
  • 2 in conversation