BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Piyu
Fluorite | Level 6

I am trying to Merge two datasets using SAS Enterprise Miner Merge node using a common ID-Student_ID.

I want all records from dataset 1 merged with only the records that has a matching ID entry to data set 1 from the second data set .

Can someone help me to do this?. Right now I get all records from dataset 2 merged to dataset 1

1 ACCEPTED SOLUTION

Accepted Solutions
MelodieRush
SAS Employee

You can use the filter node either before or after the merge. In my example I merged on some predictions values, so the records that did not have a value for phat (my prediction variable) I filtered out. This gave me a dataset with only the rows I wanted.

 

Just be sure to set the properties for Class and interval variables to NONE and click on the ellipse (indicated below) to specify the filter you want.

 

2017-03-08_9-25-12.png

 

Here's what my filter looks like for phat

2017-03-08_9-27-22.png

 

You can also use the SAS code node to filter. Here's a simple example of how that would work.

 

2017-03-08_9-42-18.png

 

 

 

 

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



View solution in original post

4 REPLIES 4
MelodieRush
SAS Employee

I don't believe you can do this in the merge. You may try filtering either after or before to get your result.

 

I'm not clear if you are looking for an inner join, left or right join based on your post.  If you can clarify I may be able to give a more specific answer.

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



Piyu
Fluorite | Level 6

Thank you for the reply.

 

I'm interested in left join as well as inner join in this case.

If I can do both or either one that would be great.

Right now I'm getting a full join.

Is there any way to atleast filter out the records related to the ID in first set?

MelodieRush
SAS Employee

You can use the filter node either before or after the merge. In my example I merged on some predictions values, so the records that did not have a value for phat (my prediction variable) I filtered out. This gave me a dataset with only the rows I wanted.

 

Just be sure to set the properties for Class and interval variables to NONE and click on the ellipse (indicated below) to specify the filter you want.

 

2017-03-08_9-25-12.png

 

Here's what my filter looks like for phat

2017-03-08_9-27-22.png

 

You can also use the SAS code node to filter. Here's a simple example of how that would work.

 

2017-03-08_9-42-18.png

 

 

 

 

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



Piyu
Fluorite | Level 6

Thank you  🙂

This did it! 

I was about to spend a lot of time to do it manually with Python. This saved a lot of my time

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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 3003 views
  • 2 likes
  • 2 in conversation