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
Answer / nishant
Using "IN" variable option. Look at the following example.
data three;
merge one(in=x) two(in=y);
by id;
if x=1 and y=1;
run;
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / pallavi
data three;
merge one(in=x) two(in=y);
by id;
if x and y;
run;
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / madhavi
proc sort data=one;
by id;
run;
proc sort data=two;
by id;
run;
data comm_rec;
merge one(in=a) two(in=b);
by id;
if a and b;
run;
proc print data=comm_rec;
run;
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / sheetal
Using joins in proc sql statement, see following example
proc sql;
select *
from a, b
where a.case_id = b.case_id;
quit;
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / kamudu
here we used simple answer ia
data merge;
merge(tables------);
by (same colum);
if e1 and e2 then
output;
keep-----;
run;
| Is This Answer Correct ? | 0 Yes | 5 No |
State the difference between INFORMAT and FORMAT ?
What versions of SAS have you used (on which platforms)?
What are the default statistics for means procedure?
what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming
describe about physical data integration? : Sas-di
How can you limit the variables written to output dataset in data step?
In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single variable)
8 Answers GSK GlaxoSmithKline,
How could you generate test data with no input data?
I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming
how does sas handle missing values in functions? : Sas programming
How would you invoke a macro? : sas-macro