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

hi would like to search in a character variable in a large dataset.  This variable "seriesdescription" contains free entry of text data (see screenshot).  I have a set of 50 different strings in lower case that are buried in this variable at various positions.

I was using this code

vista=0;

if index(lowcase(seriesdescription),'3pl loc')>0 then vista=1;

if index(lowcase(seriesdescription),'cine')>0 then vista=1;

if index(lowcase(seriesdescription),'lge')>0 then vista=1;

 

I tried scan function but could not make it work.

but that is very cumbersome.  Do you have a better solution ?  thanks 

rykwong_0-1677270203794.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
Patrick
Opal | Level 21

@rykwong Please post the same question only once.

This is a duplicate of https://communities.sas.com/t5/SAS-Programming/need-help-using-index-function-to-seach-for-multiple-... where you've got already some answers.

rykwong
Quartz | Level 8

my apology.  I thought the first one did not get through.  many thanks for the answers

SASKiwi
PROC Star

Also providing example data in screenshots is useless as we can't copy and paste it into code examples. Please provide the data in a usable form like a simple copy and paste.

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
  • 3 replies
  • 1168 views
  • 2 likes
  • 3 in conversation