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 / vijay

Dear Guest,
Merge won't accept NODUPKEY option. it is for PROC SORT.
the following code will get only matched observations in
both datasets

data three;merge one (in=a) two (in=b);by **;if a and b;run;

Is This Answer Correct ?    12 Yes 0 No

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

Answer / naveen

data qqq;
merge aaa(in=a) bbb(in=b);
if a and b;
run;

Is This Answer Correct ?    1 Yes 0 No

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

Answer / murray

Both answers #2 and #3 will work fine, however the '= 1'
part is superfluous, and will work fine without.

Is This Answer Correct ?    0 Yes 3 No

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

Answer / san

data c;
merge data a(in=a)
dat b(in=b);
if a=1 and b=1;
by<common column>;
run;

Is This Answer Correct ?    0 Yes 5 No

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

Answer / guest

nodupkey option in the merge statement

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More SAS Interview Questions

What statement do you code to write the record to the file?

5 Answers  


How to convert HTML file into SAS dataset?

0 Answers  


What is the good sas programming practices for processing large data sets?

0 Answers  


what are the softwares and applications that are used most frequently used by sas bi applications developers? : Sas-bi

0 Answers  


how do you read binary data in sas?

3 Answers   Satyam,






What is the difference between nodupkey and nodup options?

0 Answers  


How necessary is it to be creative in your work?

0 Answers   Oracle,


If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable?

16 Answers  


If a variable contains only numbers, can it be a character data type?

0 Answers  


Name statements that function at both compile and execution time.

7 Answers   Accenture,


data voter; input Age Party : $1. (Ques1-Ques4)($1. + 1); datalines; 23 D 1 1 2 2 45 R 5 5 4 1 67 D 2 4 3 3 39 R 4 4 4 4 19 D 2 1 2 1 75 D 3 3 2 3 57 R 4 3 4 4 ; Idont understand what the (Ques1-Ques4)($1. + 1) means. I have seen (Ques1-Ques4)(4*$1.), but what is (Ques1-Ques4)($1. + 1)? Appreciate all help Thanks

3 Answers  


What does the RUN statement do?

0 Answers   Quintiles,


Categories