BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Suzy_Cat
Pyrite | Level 9

Hi there,

 

Hope to receive some help with perl expression, where there are two columns to compare with, the match column should be flagging should obs where it matches. example as below:

 

ColumnA    Column B     Mached

ABC01       ABC1            Y

PAB1         PAB01          Y

Cob1         COB1            Y

BDD01      BDC01          N

 

Thanks for helping.

 

Cheers

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Build on this:

 

data want;
set have;
s1 = prxchange("s/01/1/", -1, string1);
s2 = prxchange("s/01/1/", -1, string2);
match = upcase(s1) = upcase(s2);
run;
PG

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

You have two almost identical questions in two threads. Are both actual questions? 

Suzy_Cat
Pyrite | Level 9
Hi Chris, Thank you for pointing out the duplicates - have deleted now. It was due to system issue and I did not know the 1st attempte was successful.
PGStats
Opal | Level 21

Build on this:

 

data want;
set have;
s1 = prxchange("s/01/1/", -1, string1);
s2 = prxchange("s/01/1/", -1, string2);
match = upcase(s1) = upcase(s2);
run;
PG
Suzy_Cat
Pyrite | Level 9
That is super. Solves my problem perfactlyt. Thank you PG!
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1186 views
  • 1 like
  • 3 in conversation