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
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 |
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 |
what is slowly changing dimension? : Sas-di
When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc?
Difference between informat and format?
If a variable contains letters or special characters, can it be numeric data type?
What does proc print, and proc contents are used for?
List down the reasons for choosing sas over other data analytics tools.
/* To determine the maximum and minimum of V1 */ data before3; input v1 v2 v3; cards; 3 2 1 4 6 5 2 1 3 6 5 4 1 3 2 5 4 6 ; run;
Explain by-group processing?
How to Rename Library?
how sas deals with business intelligence? : Sas-bi
explain what is data set in sas? : Sas-administrator
I am preparing SAS Certified Advanced Programmer for SAS 9 in 2014. If anybody has the latest dumps for this exam, please mail me at dhiman.mukherjee@gmail.com