Is it possible to remove an apostrophe only at the end of a word in SAS EG query builder?
I have the following data:
And would like a new computed column to show:
Thanks
Don't know if the query builder uses the TRANWRD function.
The tranwrd function replaces in the first parameter, the string found in the second parameter if present, with the third parameter. We use double quotes to encase a single quote to avoid syntax:"' " to indicate single quote followed by space.
If you have other characters that occur after the the single quote that are not letters that may indicate something else to change then repeat.
Here is an example with code:
data have; input var $30.; datalines; EMPLOYEES' BANK ARTISANS' BANK TEACHERS' RETIREMENT SYSTEM DEVELOPER'S MORTGAGE COMPANY ; data want; set have; var = tranwrd(var,"' "," "); run;
Don't know if the query builder uses the TRANWRD function.
The tranwrd function replaces in the first parameter, the string found in the second parameter if present, with the third parameter. We use double quotes to encase a single quote to avoid syntax:"' " to indicate single quote followed by space.
If you have other characters that occur after the the single quote that are not letters that may indicate something else to change then repeat.
Here is an example with code:
data have; input var $30.; datalines; EMPLOYEES' BANK ARTISANS' BANK TEACHERS' RETIREMENT SYSTEM DEVELOPER'S MORTGAGE COMPANY ; data want; set have; var = tranwrd(var,"' "," "); run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.