BookmarkSubscribeRSS Feed
Kalai2008
Pyrite | Level 9

Hi,

I am trying to get the percentage using the levenshtein function, but the code is not working in SAS.

(x1-x2)/x1

 

(maX(length(stringa), length(stringb)) - levenshtein(stringa, stringb))) /

max(length(stringa),length(stringb)) as lev_perc

 

PS: I need to run the program in EAP hive using SAS, so i need to use the function that is compatible to hive too.

 

Thanks for checking

 

3 REPLIES 3
ChrisHemedinger
Community Manager

Maybe you want the COMPGED function, which is the Levenshtein distance in SAS.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
ballardw
Super User

It think that should be COMPLEV function if you want the specific Levenshtein distance.

Kalai2008
Pyrite | Level 9


Thanks, I have tried both functions and not working.

COMPGED(stringa, stringb) AS VALUE1,

COMPLEV(stringa, stringb) AS VALUE2,

 

ERROR: Prepare error: Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 1:53 Invalid

function 'COMPGED'

 

ERROR: Prepare error: Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 1:53 Invalid

function 'COMPLEV'

 

May be its not working in Hive EAP

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 594 views
  • 1 like
  • 3 in conversation