BookmarkSubscribeRSS Feed
DaveLarge
Calcite | Level 5

hi all,

 

im sure i done this in the past but can think for the life of me how i did this 

 

so i have 2 datasets where  A=robust name and adresses B= contains a field that would have the name in example - 

 

a=

 

Name LongLat
Midgar3464

 

B = 

 

possible name Details_1Detail_2
75 MidGAR streetneed thisAnd and this

 

i need to join the tables where B.possible_name has A.Name in any format and any space within the field 

 

i think i used wildcard fuzzy matching but unable to replicate this so far 

 

any help would be great 

 

thank you in advance 

1 REPLY 1
ed_sas_member
Meteorite | Level 14

Hi @DaveLarge 

 

I have tried something like this. Please test it on several cases so that you can see if it sensitive / specific enough.

Capture d’écran 2020-05-05 à 16.45.05.png

data a;
	infile datalines dlm="09"x;
	input Name:$20. Long Lat;
	datalines;
Midgar	34	64
	;
run;

data b;
	infile datalines dlm="09"x;
	input Possible_Name:$20. Details_1:$20. Details_2:$20.;
	datalines;
75 MidGAR street	need this	And and this
	;
run;

proc sql;
	select a.Name, b.Possible_Name, a.Long, a.Lat, b.Details_1, b.Details_2
	from a full join b /* select the proper type of join */
	on find(compress(b.Possible_Name," "), compress(a.Name," "), "i") > 0;
quit;

Hope this helps!

Best,

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 564 views
  • 0 likes
  • 2 in conversation