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?
Answer Posted / 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 |
Post New Answer View All Answers
I have a dataset concat having variable a b & c. How to rename a b to e & f?
what is the use of sas management console? : Sas-di
what is the Population you used in your project, is it ITT or PP?
What is the use of %include statement?
how many types prompting framework can be broken down to? : Sas-bi
What are the difficulties u faced while doing vital signs table or dataset?
How to include or exclude specific variables in a data set?
what is the difference between unique key and primary key? : Sas-di
What is the good sas programming practices for processing large data sets?
What are the differences between proc means and proc summary?
What is program data vector (pdv)?
explain the difference between proc means and proc summary?
what is sas and what are the functions? : Sas-administrator
Explain substr function?
How to create an external dataset with sas code?