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 / m.sivakumar
proc sql;
create table sqln1 as select one.id,name,age,sex from one
inner join two on one.id=two.id;
create table sqln2 as select one.id,name,age,sex from one
left join two on one.id=two.id where two.id is null;
create table sqln3 as select coalesce(one.id,two.id)as
id,name,age,sex from one right join two on one.id=two.id
where one.id is null;
quit;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What can be the size of largest dataset in SAS?
what can you learn from the sas log when debugging? : Sas programming
explain the use of % includes a statement in sas? : Sas-administrator
Explain the special input delimiters used in sas programming.
what are _numeric_ and _character_ and what do they do? : Sas programming
what are the benefits of data integration? : Sas-di
Are you involved in writing the inferential analysis plan? Tables specfications?
How do you test for missing values?
how the sas basic syntax style described? : Sas-administrator
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.
what is data governance? : Sas-di
What do the PUT and INPUT functions do?
what is slowly changing dimension? : Sas-di
What is the basic structure of the SAS base program?
What will calendar procedure do?