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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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