BookmarkSubscribeRSS Feed
Sheeba
Lapis Lazuli | Level 10

Hi,

I am planning to use a join transformation in SAS DI Studio to join two tables A and B. The relationship between A and B is one to Many. For each row in A , I would like to take only one record from B. Is there any function which allows to perform this?

Thanks in advance,

Regards,

Sheeba Swaminathan

4 REPLIES 4
Patrick
Opal | Level 21

How would you select this record from "B"? Could you use a DISTINCT or Group By in a sub-select prior to joining with A so that the relationship becomes 1:1?

Sheeba
Lapis Lazuli | Level 10

tnx a lot Patrick.

Distinct keyword helped me out.

LinusH
Tourmaline | Level 20

You could also use the Look-up transformation right off, that will pick only one record from the look-up table.

Is there any logic you wish to apply when choosing the B record?

Data never sleeps
Sheeba
Lapis Lazuli | Level 10

tnx a lot Linush.

Any record from Table B would be a fit for join....

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1011 views
  • 0 likes
  • 3 in conversation