SAS Base Certification – Question 4

Question 4: Given the SAS data set WORK.INPUT:

Var1     Var2
------   -------
A        one
A        two
B        three
C        four
A        five

The following SAS program is submitted:

1
2
3
4
5
data WORK.ONE WORK.TWO;
  set WORK.INPUT;
  if Var1='A' then output WORK.ONE;
  output;
run;

How many observations will be in data set WORK.ONE?

Options:

A. 1
B. 2
C. 4
D. 8

*The SAS certification sample problem and answer above are sourced from the official SAS sample questions page. All answer logs, data sets, output, and commentary are provided by this blog.

Correct Answer

Incorrect Answer

Click to see Answer Explanation below

thanks for your support

5 Comments

    Rachel Aug 02, 2015

    Why is the order of work.one not AAA followed by AABCA? In other words if the second output duplicated work.one, why is it not in the same order as work.one in the data step?

    Reply
      Sophia Aug 19, 2015

      Probably because there was no sort and the original data was in this order.

      Reply
    steve Nov 16, 2016

    does not seem like a real world problem

    Reply
    shovland Dec 30, 2016

    On this one it helps to read the SAS documentation on the INPUT function.

    Reply
    kai Apr 28, 2017

    because two statements (if..output..) and (output) are independent. For every observation in work.input, it will be outputted to both work.one and work.two no matter the result of the first statement. (5+3=8) so totally there are 8 observations in work.one.

    Reply

Leave a Comment

Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let us have a personal and meaningful conversation instead.