How would you code a merge that will keep only the
observations that have matches from both sets.

Answers were Sorted based on User's Feedback



How would you code a merge that will keep only the observations that have matches from both sets...

Answer / nishant

Using "IN" variable option. Look at the following example.

data three;
merge one(in=x) two(in=y);
by id;
if x=1 and y=1;
run;

Is This Answer Correct ?    13 Yes 1 No

How would you code a merge that will keep only the observations that have matches from both sets...

Answer / pallavi

data three;
merge one(in=x) two(in=y);
by id;
if x and y;
run;

Is This Answer Correct ?    13 Yes 1 No

How would you code a merge that will keep only the observations that have matches from both sets...

Answer / madhavi

proc sort data=one;
by id;
run;
proc sort data=two;
by id;
run;
data comm_rec;
merge one(in=a) two(in=b);
by id;
if a and b;
run;
proc print data=comm_rec;
run;

Is This Answer Correct ?    11 Yes 0 No

How would you code a merge that will keep only the observations that have matches from both sets...

Answer / sheetal

Using joins in proc sql statement, see following example

proc sql;
select *
from a, b
where a.case_id = b.case_id;
quit;

Is This Answer Correct ?    6 Yes 1 No

How would you code a merge that will keep only the observations that have matches from both sets...

Answer / kamudu

here we used simple answer ia
data merge;
merge(tables------);
by (same colum);
if e1 and e2 then
output;
keep-----;
run;

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More SAS Interview Questions

what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';

3 Answers   HSBC,


There is a river notoriously known for it?s large crocodile population. With ease, how do you safely cross it?

1 Answers   Oracle,


What do the PUT and INPUT functions do?

1 Answers  


How would you keep from overlaying the a SAS set with its sorted version?

4 Answers  


explain what is factor analysis? : Sas-administrator

1 Answers  


What would you change about your job?

1 Answers   Oracle,


Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

1 Answers  


what does the run statement do? : Sas programming

1 Answers  


DATA ABC; INPUT TDATE DATE9. AVG; CARDS; 18APR2008 150.00 19APR2008 167.00 20APR2008 123.00 21APR2008 145.00 ; RUN HOW CAN I FIND THE DIFFERENCE BETWEEN AVG OF 18APR2008 ANF 21APR2008?? IF ANY ONE GETS IT PLS TRY TO POST IT.

8 Answers   Verinon Technology Solutions,


How would you determine the number of missing or nonmissing values in computations?

1 Answers  


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

1 Answers   Pfizer,


Explain the use of proc gplot? : sas-grid-administration

1 Answers  


Categories