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

I tried using merge node.But, one data set contained 38,000 records , other data set contained 40,000 records and resultant data set contains 40,000 records. However it should contain 38000 records or less when we do inner join. So can  somebody please let me know how to do inner join

1 ACCEPTED SOLUTION

Accepted Solutions
WendyCzika
SAS Employee

We came across this one during our "Jam session" today, and just wanted to offer a minor tweak to the solution given by KurtBremser above (thank you KurtBremser!)... in order to have that data set exported to a subsequent node after the SAS Code node, you can do the following:

 

proc sort data=A;

by x;

run;

 

proc sort data=B;

by x;

run;

 

data &em_export_train;

merge

  A (in=in_a)

  B (in=in_b)

;

by x;

if in_a and in_b;

run;

View solution in original post

5 REPLIES 5
YujunChiang
Calcite | Level 5

How about open the program editor  and use the SQL procedure?

捕获.JPG

Kurt_Bremser
Super User

Or, in a code node, use (x being your merge variable(s))

proc sort data=A;

by x;

run;

proc sort data=B;

by x;

run;

data C;

merge

  A (in=in_a)

  B (in=in_b)

;

by x;

if in_a and in_b;

run;

jakarman
Barite | Level 11

Eminer is for predictive analytics supporting that all in logical steps.

Data preparation should be done as a separate step before. With the Eminer license you get also Eguide and JMP to be able to that.

Of course you can use the eminer code node but why not use tools better suited for the question?       

---->-- ja karman --<-----
stat_sas
Ammonite | Level 13

Hi,

Why you are expecting 38000 records? What if you have multiple records in 40000 dataset for joining key.

WendyCzika
SAS Employee

We came across this one during our "Jam session" today, and just wanted to offer a minor tweak to the solution given by KurtBremser above (thank you KurtBremser!)... in order to have that data set exported to a subsequent node after the SAS Code node, you can do the following:

 

proc sort data=A;

by x;

run;

 

proc sort data=B;

by x;

run;

 

data &em_export_train;

merge

  A (in=in_a)

  B (in=in_b)

;

by x;

if in_a and in_b;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 2721 views
  • 1 like
  • 6 in conversation