How would you code a merge that will write the matches of
both to one data set, the non-matches from the left-most
data set to a second data set, and the non-matches of the
right-most data set to a third data set?

Answers were Sorted based on User's Feedback



How would you code a merge that will write the matches of both to one data set, the non-matches fro..

Answer / sas job searcher

data x1y1
x1y0
x0y1;
/* x1y1, x1y0, x0y1 are output data set names */
merge left_most(in=x) right_most(in=y);
by id;
/* write all matches to x1y1: */
if x=1 and y=1 then output x1y1;
/* non-matches from the left-most data set: */
if x=1 and y=0 then output x1y0;
/* non-matches from the right-most data set: */
if x=0 and y=1 then output x0y1;
run;

Is This Answer Correct ?    11 Yes 1 No

How would you code a merge that will write the matches of both to one data set, the non-matches fro..

Answer / reddy

data both left_only right_only;
merge dataset1(in=a) dataset2(in=b);
by variable;
if a and b then output both;
if a and not b then output left_only;
if b and not a then output right_only;
run;

i think these is the easy way of writing the code,if any
one nows other please specify.thanks!

Is This Answer Correct ?    11 Yes 4 No

Post New Answer

More SAS Interview Questions

How we can create SAS USER DEFINED CODE?

0 Answers  


define table lookup and how may ways it can be done...explian

3 Answers  


what is in stream data in SAS?

1 Answers  


What are the prime responsibilities of data integration administrator? : Sas-di

0 Answers  


What is the pound sign used for the DATA _NULL_?

14 Answers  


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

0 Answers  


What procedure you used to calculate p-value?

2 Answers   Accenture, Quintiles,


Which is the best training Institute for SAS Business Intelligence course?

6 Answers  


Explain proc sort?

0 Answers  


what is SAS/Graph?

1 Answers   CitiGroup, NTPC,


Which command is used to perform sorting in sas program?

0 Answers  


what are the considerations when picking a SAS/STAT procedure?

0 Answers   Accenture, Quintiles,


Categories