By admin | August 5, 2009

SAS Certified Base Programmer 50 Questions (19)

A raw data file is listed below.

1---+----10---+----20---+---
1901 2
1905 1
1910 6
1925 1
1941 1

The following SAS program is submitted and references the raw data file above:

data money;
    infile 'file-specification';
    input year quantity;
    total=total+quantity;
run;

What is the value of total when the data step finishes executing

a. 0
b. 1
c. 11
d. . (missing numeric value)

6 comments | Add One

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

    D

  2. Ram - 02/19/2012 at 10:37 am

    Can you Explani how it is Missing value ??

  3. friend - 06/26/2012 at 8:56 am

    Please explain the result with proper justification.

    Thanks in advance.

  4. sachin - 07/29/2012 at 8:19 am

    how? I think its 11…

  5. hh - 02/22/2014 at 10:09 am

    I’m guessing that it’s because sum statement is not in the below format where value of zero is automatically assigned to variable.
    variable+expression

    but it is an assignment statement instead.
    variable = variable + expression
    So the value of variable has not been defined and is missing. In this assignment statement, SAS assigns a missing value.

  6. sarayu - 03/24/2014 at 1:59 am

    The variable total needs to be defined before any function is performed it. Missing Value+anything= missing value

Leave a Comment

Leave a Reply

Your email address will not be published.