I am trying to remove special characters in variable NAME. I want a variable to flag that the name has changed so if there is such character in the NAME string, set this to 1. My question is, what would be the most efficient way to achieve this?
My code is:
data Names;
input name & $32.;
datalines;
B/E Aerospace Inc 005
A H Belo Corp12
A. H. BELO CORP 412
A-H BELO CORP 125
A - H BELO CORP 124
;
run;
data names;set names;
name1=compress(name,'','adk');
run;
What I want:
Name Flag
BE Aerospace Inc 005 Yes
A H Belo Corp12 No
A H BELO CORP 412 Yes
AH BELO CORP 125 Yes
A H BELO CORP 124 Yes
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.