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-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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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