Hi,
How can i get SAS to ignore / inside my target text? For example, I want to find the following texts: INDACATEROL and INDACATEROL/GLYCOPYRRONIUM
when i use the argument pattern_id=prxparse('/( INDACATEROL| INDACATEROL/GLYCOPYRRONIUM)/i');
it is returning error message because of the "/" inside the parentheses.
You have to MASK or ESCAPE the characters that have special meaning to RegEx by adding a backslash before them.
pattern_id=prxparse('/( INDACATEROL| INDACATEROL\/GLYCOPYRRONIUM)/i')
Did you really mean to include the spaces at the start of the search strings? What about words that are at the beginning of the string being examined? And did you really mean to require two spaces before INDCATAROL alone and only one space before INDACATEROL/GLYCOPYRRONIUM?
Without that extra space on the first pattern anything that would match the first pattern would also match the start of the second pattern.
I don't want to mask it but consider it as a part of my target string. I want SAS to extract it with the slash. For example "CLOTRIMAZOLE/HYDROCORTISONE" is a single word that I want to pick up.
"Masking" in this context means it loses its special function and is considered part of the data.
Did you try it?
You have to MASK or ESCAPE the characters that have special meaning to RegEx by adding a backslash before them.
pattern_id=prxparse('/( INDACATEROL| INDACATEROL\/GLYCOPYRRONIUM)/i')
Did you really mean to include the spaces at the start of the search strings? What about words that are at the beginning of the string being examined? And did you really mean to require two spaces before INDCATAROL alone and only one space before INDACATEROL/GLYCOPYRRONIUM?
Without that extra space on the first pattern anything that would match the first pattern would also match the start of the second pattern.
I inserted a space at the beginning of the character variable. Now it's working.
Thanks to both of you.
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!
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.