DATA Step, Macro, Functions and more

Comparing two variables

Reply
Contributor
Posts: 25

Comparing two variables

[ Edited ]

I have two variables named MNEMONIC and Details. I need to compare values in these variables and find out if replacing Mnemonic with Details creates value.

 

I'm using COMPGED to compare these variables as below

 

GED_SCORE = COMPGED(UPCASE(STRIP(COMPRESS(MNEMONIC,' :_/\-'))) ,
                    UPCASE(STRIP(COMPRESS(DETAILS,' :_/\-')))) ;

 

And have written few conditions to remove records which doesnt fetch me any value if I replace MNEMONIC with Details

 

IF GED_SCORE = 0 THEN DELETE ;

 

IF GED_SCORE < 35 THEN DELETE ;

 

Could anyone please suggest better way of doing this ?

 

Sample Dataset: { Edited }

 

Mnemonic               Details
ABC:Test_Admin      All Britain Corp Test Admin User
ESPC                        East Special Port Center
Memo                      Memo by post
Green_Card_holder  Green Card Holder

 

Replacing Mnemonic with Details for 1st and 2nd records create high value ;  For 3rd value provided is average and for last replace doesn't provide any value as it is the same words replaced by special characters.

 

There are about 2 millions of records and just for performance reasons I don't want to replace all of them. Hope this helps.

 

{ Edited }

 

Main reason for doing this fuzzy_logic is to save space.

PROC Star
Posts: 7,363

Re: Comparing two variables

It would help if you provided an example dataset.

 

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 25

Re: Comparing two variables

Thank you for your response, Tried giving a small 5 records dataset as example.

Super User
Super User
Posts: 7,401

Re: Comparing two variables

Not sure what we can suggest, you haven't told us anything other than you have that line of code.  If it works then good.  I can certainly suggest not coding all in uppercase as it makes it virtually unreadable.

PROC Star
Posts: 7,363

Re: Comparing two variables

What are you trying to accomplish? Are you trying to save space, combine similar "details", or something else?

 

Art, CEO, AnalystFinder.com

 

Ask a Question
Discussion stats
  • 4 replies
  • 145 views
  • 0 likes
  • 3 in conversation