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
for what purpose would you use the retain statement? : Sas programming
How would you include common or reuse to be processed along with your statements?
Hi Friends, Am Priya,new to your forum. am looking for Interview questions on SAS Platform Administration. I searched everywhere but I couldn't find them,please can anyone help me with complete interview questions normally everyone will face in the interviews on SAS Administration. am really facing problems in the interviews,am not able to answer any of their questions. I would really appreciate all your help if you can email the complete Interview Questions to priyafeb84@gmail.com Kindly awaiting for your reply with eager
how does sas handle missing values in formats? : Sas programming
Describe crosslist option in tables statement?
how does sas handle missing values in assignment statements? : Sas programming
What is the difference between nodupkey and nodup options?
How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?
what is the basic structure sas administrator? : Sas-administrator
What is the difference between reading data from an external file and reading data from an existing data set?
what has been your most common programming mistake? : Sas programming
Give some examples where proc report’s defaults are same as proc print’s defaults?
What are the ways in which macro variables can be created in sas programming?
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming
Explain how you can debug and test your SAS program?