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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 826 views
  • 0 likes
  • 2 in conversation