BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gil_
Quartz | Level 8
I tried using prxmatch would it be easier to use index? I am looking for word text4, text 7, and text9.
Sometimes they are misspell for example tex4
The index works if its one and spelled correctly
Data test;
Set test;
Text_position( varaible,"text4");
Run;
This works great i need to add the additional text7 and text9
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Fuzzy matching words is hard. You’ll also make mistakes, so decide if it’s worth the effort first.

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

INDEX is faster.

PRXMATCH is more flexible.

 

POS=prxmatch('/(TEXT?4|TEXT7|TEXT9)/',STRING);
Reeza
Super User
Fuzzy matching words is hard. You’ll also make mistakes, so decide if it’s worth the effort first.
Gil_
Quartz | Level 8
The output is 0 even though the words is there. What is ? In text4
ChrisNZ
Tourmaline | Level 20

The output is 0 even though the words is there. What is ? In text4

 

Make the search case insensitive?

Add i after the second slash in the regular expression.

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
  • 4 replies
  • 1240 views
  • 1 like
  • 3 in conversation