Hello @Feyng819,
The simplest way to combine the two replacements would be to apply the second PRXCHANGE function call to the result of the first, i.e., replace "variable" in the second call with the entire prxchange(...) expression of the first. In this particular case, however, it is also possible to use the OR operator (|) like this:
prxchange('s/^The\b|\bworld\b//',-1,variable);
This would remove the word "The" from the beginning of the string in variable as well as all occurrences of the word "world". (Note the case-sensitivity without the "i" modifier at the end of the regular expression.)
Hello @Feyng819,
The simplest way to combine the two replacements would be to apply the second PRXCHANGE function call to the result of the first, i.e., replace "variable" in the second call with the entire prxchange(...) expression of the first. In this particular case, however, it is also possible to use the OR operator (|) like this:
prxchange('s/^The\b|\bworld\b//',-1,variable);
This would remove the word "The" from the beginning of the string in variable as well as all occurrences of the word "world". (Note the case-sensitivity without the "i" modifier at the end of the regular expression.)
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.