BookmarkSubscribeRSS Feed
gandikk
Obsidian | Level 7

There are 2 fields called Company Name and Tradestyle. My requirement is if company name is ABC Company "Software" and the tradestyle is Software; I have to change the company name to ABC Company. That means I have to remove the string in double quotes from the Company Name if it is matched to Tradestyle. Can anyone help on this?

SAS@EMMAUS
1 REPLY 1
Kurt_Bremser
Super User

if company_name = 'ABC Company "Software"' and tradestyle = 'Software' then company_name = 'ABC Company';

More generic:

if substr(company_name,length(company_name)-length(tradestyle)-1) = '"'!!trim(tradestyle)!!'"' then

company_name = substr(company_name,1,length(company_name)-length(tradestyle)-3);

Please avoid to post the same question to multiple communities in the future.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1275 views
  • 0 likes
  • 2 in conversation