By admin | August 5, 2009

SAS Certified Base Programmer 50 Questions (18)

A raw data file is listed below.

1---+----10---+----20---+---
10
23
20
15

The following program is submitted:

data all_sales;
    infile 'file-specification';
    input receipts;
    <insert statement(s) here>
run;

Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable?

a.

total+receipts;

b.

total 0;
sum total;

c.

total=total+receipts;

d.

total=sum(total,receipts);

6 comments | Add One

  1. admin - 08/9/2009 at 8:35 pm

    A

  2. ravi - 07/6/2011 at 7:06 am

    Why not C or D?

  3. Ash - 10/7/2011 at 8:03 am

    A and D both are correct. I tried it. Try yourself.

  4. Joel - 12/13/2012 at 6:38 pm

    You’ll get missing for c or d. Not sure why exactly. I learned that in the next question.

  5. moulik - 12/27/2012 at 2:04 am

    ANSWER CANT BE C BEC TOTAL HASNT BEEN INITILIZED SO OUTPUT WILL BE MISSING NUMERIC VALUE SIMILAR IS THE CASE OF D

  6. mac - 01/16/2013 at 10:57 am

    @c: total initalised with missing value. Missing Value + any value is always a missing value.

    @d: in every step of the data procedure, total is reinitialised as a missing value. That#s why total coincides with receipts for every observation.

Leave a Comment

Leave a Reply

Your email address will not be published.