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.

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