Hello @Julie99999
Strip does work inside call execute.
As a reminder Call Execute generates a code that executes after the current data step.
Therefore the arguments to Call Execute should generate a complete SAS code.
The argument to Call Execute as has been posted in this question does not result in a complete data step code.
Further the instance of variable cbsa_title following the "if" is local to the code generated by call execute and needs to be defined within the code forming the argument of the call execute. Here this local value of cbsa_title is being compared to value of cbsa_title from outside the call execute.
I am giving a sample code below. I have used cbsa_title_local and cbse_title_external to emphasize the the difference.
data _null_;
IND_COAST="SOMETHING";
cbsa_title_external="PITTSBURGH PA PMSA ";
call execute(
'data _null_;
cbsa_title_local="PITTSBURGH PA PMSA ";
if cbsa_title_local ="'||strip(cbsa_title_external )|| '" then IND_COAST = "' ||strip(IND_COAST)||' ";
put IND_COAST=;
run;');
run;
The operative portion of the output from the log shows that strip function works and prints the expected value for IND_COAST.
NOTE: CALL EXECUTE generated line. 1 + data _null_;cbsa_title_local="PITTSBURGH PA PMSA ";if cbsa_title_local ="PITTSBURGH PA PMSA" then IND_COAST = "SOMETHING ";put IND_COAST=;run; IND_COAST=SOMETHING
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 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.