Help using Base SAS procedures

Merge dropping entries

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 114
Accepted Solution

Merge dropping entries

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

Accepted Solutions
Solution
‎10-18-2017 05:06 PM
Super User
Posts: 6,754

Re: Merge dropping entries

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


All Replies
Frequent Contributor
Posts: 114

Re: Merge dropping entries

 
Super User
Posts: 6,754

Re: Merge dropping entries

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?

Frequent Contributor
Posts: 114

Re: Merge dropping entries

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
Solution
‎10-18-2017 05:06 PM
Super User
Posts: 6,754

Re: Merge dropping entries

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.

Super User
Posts: 23,683

Re: Merge dropping entries

Posted in reply to Astounding

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 187 views
  • 0 likes
  • 3 in conversation