By admin | August 11, 2009

SAS Certified Adv Programmer 50 Questions (8)

Given the following SAS data sets One and Two:

One

Num Char1
1 A
2 B
4 D

Two

Num Char2
2 X
3 Y
5 V

The following SAS program is submitted creating the output table Three:

data three;
    merge one (in=in1) two (in=in2);
    by num;
    if in2;
run;

Three

Num Char1 Char2
2 B X
3 Y
5 V

Which of the following SQL programs creates an equivalent SAS data set Three?

a.

proc sql;
    create table three as
        select two.num, char1, char2
            from one left join two
            on one.num=two.num;
quit;

b.

proc sql;
    create table three as
        select two.num, char1, char2
            from one right join two
            on one.num=two.num;
quit;

c.

proc sql;
    create table three as
        select two.num, char1, char2
            from one full join two
            on one.num=two.num;
quit;

d.

proc sql;
    create table three as
        select two.num, char1, char2
            from one, two
            where one.num=two.num;
quit;

2 comments | Add One

  1. admin - 08/11/2009 at 3:17 pm

    B

  2. Consty - 02/12/2013 at 6:04 pm

    B: matching row + non matching row from the right

Leave a Comment

Leave a Reply

Your email address will not be published.