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 / arun & g.n.rao
data one;
input ID$ NAME$;
datalines;
A01 SUE
A02 TOM
A05 KAY
A10 JIM
;
RUN;
DATA TWO;
INPUT ID$ AGE SEX$;
DATALINES;
A01 58 F
A02 20 M
A04 47 F
A10 11 M
;
RUN;
DATA N1 N2 N3;
MERGE ONE (IN=X) TWO (IN=Y);
BY ID;
IF X=1 AND Y=1 THEN OUTPUT N1;
IF X=1 AND Y=0 THEN OUTPUT N2;
IF X=0 AND Y=1 THEN OUTPUT N3;
RUN;
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.
explain what is factor analysis? : Sas-administrator
is data integration and etl programming is same? : Sas-di
for report generation which one you used proc report or data_null_?
If money were no object, what would you like to do?
How do you test for missing values?
explain the use of % includes a statement in sas? : Sas-administrator
how do you debug and test your sas programs? : Sas programming
explain the difference between proc means and proc summary?
describe how to adjust the performance of data integrator? : Sas-di
Explain input and put function?
describe about metadata object? : Sas-di
Name some categories in sas 9? : sas-grid-administration
How to read an input file in sas?
Mention the category in which sas informats are placed?