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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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