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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.