Given the SAS data sets ONE and TWO: The following SAS program is submitted: Data combine; Merge one two; By id; Run; Which SQL procedure program procedures the same results?
A.
proc sql; Create table combine as Select coalesce (one.id, two.id) as id, Name,salary from one, two where one.id=two.id; Quit;
B.
proc sql; Create table combine as Select one.id, Name, salary from one full join two where one.id=two.id; Quit
C.
proc sql; Create table combine as Select one.id,name,salary from one inner join two on one.id=two.id Quit
D.
proc sql; Create table combine as Select coalesce (one id, two id) as id, Name,salary from one full join two on one.id=two.id;
given answer is D correct, s. test code below
data ONE;
infile datalines;
input ID NAME $;
datalines;
112 Smith
243 Wei
457 Jones
;
data TWO;
infile datalines;
input ID SALARY;
datalines;
213 150000
355 45000
523 75000
;
data combine;
merge one two;
by id;
run;
/*
proc sql; Create table combine as Select coalesce (one.id, two.id) as id, Name,salary from one, two where one.id=two.id; Quit;
proc sql; Create table combine as Select one.id, Name, salary from one full join two where one.id=two.id; Quit;
proc sql; Create table combine as Select one.id,name,salary from one inner join two on one.id=two.id; Quit;
*/
proc sql; Create table combinesql as Select coalesce (one.id, two.id) as id, Name,salary from one full join two on one.id=two.id; Quit;
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
mhminkov
6 months, 3 weeks agoSugarlips
2 years, 3 months ago