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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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