DATA Step, Macro, Functions and more

Comparing strings with symbols from different alphabets

Reply
Contributor
Posts: 20

Comparing strings with symbols from different alphabets

Hello experts!

 

I want to compare two strings which contains symbols from different alphabets (e.g. Russian and English). I want that symbols which looks similarly is considered as equal to each other. 

 

E.g. in the word "Mom" letter "o" is from English alphabet (code 043E in Unicode), and in the world "Mоm" letter "о" is from Russian alphabet (code 006F in Unicode). So ("Mom" = "Mоm") => false, but I want it would be true. Is there some standard SAS function or I should wright a macro to do it.

 

Thanks!

 

Frequent Contributor
Posts: 79

Re: Comparing strings with symbols from different alphabets

Dmitry,

 

  Have you considered the ENCODING= data set option?

 

The value for ENCODING= indicates that the SAS data set has a different encoding from the current session encoding. When you read data from a data set, SAS transcodes the data from the specified encoding to the session encoding. When you write data to a data set, SAS transcodes the data from the session encoding to the specified encoding. 

 

  Depending on your data sets or raw files, other ENCODING= options might be more appropriate.

 

Good luck,

 

Kevin

 

 

Ask a Question
Discussion stats
  • 1 reply
  • 179 views
  • 0 likes
  • 2 in conversation