BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gil_
Quartz | Level 8
Im doing a merge table1 has 50. Entries and table 2 has 4. I do a proc sort on both tables by name
My merge table looks like this

Data report;
Merge table1 table2;
By name;
Run;

Output is 50 i expect 54
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

For that, change the word MERGE to the word SET.

 

MERGE is actually a more complex process.

 

Expect that you will have more than one observation with the exact same NAME when you are done.

View solution in original post

5 REPLIES 5
Gil_
Quartz | Level 8
 
Astounding
PROC Star

In theory, the number of observations in the output could be anywhere from 50 to 54. 

 

Why do you expect 54?  What do you expect MERGE to do when the same NAME appears in both data incoming data sets?

Gil_
Quartz | Level 8
I wanted to combine table1 and tab table2. To create table 3. I have 4 in table 2 and 50 from table1. 54 in new table 3
Astounding
PROC Star

For that, change the word MERGE to the word SET.

 

MERGE is actually a more complex process.

 

Expect that you will have more than one observation with the exact same NAME when you are done.

Reeza
Super User

If you’re tryimg to add rows it’s an APPEND. 

If you’re trying to add columns it’s a MERGE. 

 

READ the SAS chapter on Combining Data. 

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p15jvywi5avt3cn1bee8r6c33ux1.htm&docsetVer...

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