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

How are numeric and character missing values represented internally?

0 Answers   Quintiles,


I have 2 data sets A & B. Both have a variable called Age in them, each of them specifying a different functionality. In my program I use bot these data sets. How do I specify which Age variable I want to use?

6 Answers  


how do i read multiple spaces in datasets? eg: vijaya raghava perumal.I tried with using & but it workss if its vijaya raghava but not for raghava perumal.how to do this?

8 Answers   Wipro, Xansa,


What are the different versions of sas that you have used until now? : sas-grid-administration

0 Answers  


Difference b/n proc means and proc summary procedures?

3 Answers   Accenture,






what is star schema? : Sas-di

0 Answers  


hi i am nipun can anybody tell me that if a clinical sas programmer write the code and after successfull execution where do they store it. how they submit tables to TL how work is assigned to programmers either both code, log, output to be submitted. can any one tell me the process

2 Answers   HSBC,


what r the job openings SAS for fresher graduates !

0 Answers   TetraSoft, Wipro,


what does the run statement do? : Sas programming

0 Answers  


Hi, Does anybody has lastest SAS certification(base, adv., clinical)dumps,if anybody has please email me at mailtorajani76@gmail.com. Thanks

0 Answers   Axis Bank,


How do you define proc in sas? : sas-grid-administration

0 Answers  


What is the length assigned to the target variable by the scan function?

0 Answers  


Categories