DATA Step, Macro, Functions and more

Need some help with merge

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Need some help with merge

Hey,

I try to merge DATA1 (Main table) with an extern table (DATA2) by an ID to delete some irrelevant observations.

Normally in DATA3 there are all observations togehter. But i need only the observations of the extern table (DATA2). In this case I need n=439.

NOTE: There were 512 observations read from the data set DATA1.

NOTE: There were 439 observations read from the data set DATA2.

NOTE: The data set WORK.DATA3 has 515 observations and 12 variables.

i hope that someone can help me please.


Accepted Solutions
Solution
‎06-26-2012 11:32 AM
Respected Advisor
Posts: 3,900

Re: Need some help with merge

It would have helped to see the code which created the log.

Something like below might give you what you're looking for:


data data3;
  merge data1 (in=d1) data2 (in=d2);
  by id;
  if d2;
  /* more statements */
run;

View solution in original post


All Replies
Solution
‎06-26-2012 11:32 AM
Respected Advisor
Posts: 3,900

Re: Need some help with merge

It would have helped to see the code which created the log.

Something like below might give you what you're looking for:


data data3;
  merge data1 (in=d1) data2 (in=d2);
  by id;
  if d2;
  /* more statements */
run;

New Contributor
Posts: 4

Re: Need some help with merge

thank you. Worked perfectly

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 203 views
  • 3 likes
  • 2 in conversation