I'm lost. The query you showed will only return records that match exactly for DOB, MobileNum, and DocVisa, because of your ON clause:
ON COMPGED (A. CUST_NAME, B. CUST_NAME) <= 1000
AND A. CUST DOB = B. CUST DOB
AND A. MOBILE NUM = B. MOBILE NUM
AND A. DOC VISA = B. DOC VISA
AND A. CUST_ NAME IS NOT NULL
When you say "after a bunch of combinations they all get merged" it's not clear what you mean, because you only show one query, I assume one "combination".
It's also hard to follow because the variable names in your code have spaces in them, and don't match to the variable names you show in the output.
I think to make this more clear, it would help if you could show a full small example. You could show a DATA step with the CARDS statement to make work.ALL_ENT_CUST_IND_BASE with 5-10 records, and another step to make work.ALI_ENT_CUST_INDV_BASE with 5-10 records.
Then show queries to make two of your "combination" datasets. And show the combination datasets (and explain if you like them). Then show code to merge the combination datasets, and the show the results. And then describe why you don't like the results, and show the results you want.
The key point is for you to post working code to create the input data, and working code for your queries to create the combinations, and merge the combinations, so that people who want to help can replicate your scenario.
... View more