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

i want to combine two tables to one table by using merge..

DAta  report;

merge table1 table2;

run;

Table1 has 200000 records

TAble2. Has 5000 records

when I run the merge I get 13k from table 1 and table2 has 4k

somehow it brings in less record to new table".. Thanks for assistance

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

If you ran it without any changes I doubt its what you want.

Typically you want a BY statement in a merge, so you can join the two tables on some field.

data want;

merge table1 table2;

BY ID;

run;

View solution in original post

4 REPLIES 4
Haikuo
Onyx | Level 15

Please show your log. The code you showed will not have the result you claimed.

BETO
Fluorite | Level 6

Hi Hai kuo

i just reran the script an it merge the correct amount of 200k and 5 k records.... without any changes. To my script could you provide me an example of how it should look since you said mine looks incorrect ...I'm happy that is merging correctly  but don't understand why it didn't first couple times ...thank you again for your assistance

Haikuo
Onyx | Level 15

Glad it worked out for you as it should. What I meant is that your code will not produce the outcome you claimed (13k and 4k) , I didn't say it can't produce something that 'you wanted'.

Reeza
Super User

If you ran it without any changes I doubt its what you want.

Typically you want a BY statement in a merge, so you can join the two tables on some field.

data want;

merge table1 table2;

BY ID;

run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 1312 views
  • 0 likes
  • 3 in conversation