By admin | October 7, 2009

SAS Certified Base Programmer 123 Questions (110)

The contents of the raw data file EMPLOYEE are listed below:

----|----10---|----20---|----30
Ruth  39 11
Jose  32 22
Sue   30 33
John  40 44

The following SAS program is submitted:

data test;
    in file' employee';
    input employee_ name $ 1-4;
    if employee_ name = 'Ruth' then input idnum 10-11;
    else input age 7-8;
run;

Which one of the following values does the variable IDNUM contain when the name of the employee is “Ruth”?

A. 11
B. 22
C. 32
D. . (missing numeric value)

8 comments | Add One

  1. admin - 10/7/2009 at 3:30 pm

    B

  2. ferrat - 10/14/2009 at 5:50 am

    please add a semicolon after run 😉
    cheers

  3. admin - 10/14/2009 at 9:23 am

    Thanks. I added it just now.

  4. Madhu - 11/12/2010 at 12:55 pm

    pls explain….

  5. Bakul - 12/16/2010 at 6:02 pm

    The correct way to read program as

    Input employee_name $ 1-4 @;
    If employee_name = ‘Ruth’ then
    input idnum 10-11;
    else input age 7-8;
    This way you will have 4 observation.

    In the Original program there are two input statement which read two lines instead of one line. Here you will have only two observation.

  6. Arthur - 01/1/2013 at 5:31 pm

    Please explain the answer.
    The answer is correct.
    But I don´t understand why.

    Please help meee!!!

  7. Xiu - 03/13/2014 at 5:47 am

    I think we need an @ behind the statement:
    Input employee_name $ 1-4
    to hold the name while read the age and idnum in the same line, or SAS will read ‘Ruth’, then input idnum 10-11 of next line, which is 22, the idnum of Jose by default.
    I don’t know if I am correct.

  8. Xiu - 03/13/2014 at 5:48 am

    I think we need an @ behind the statement:
    Input employee_name $ 1-4
    to hold the name while read the age and idnum in the same line, or SAS will read ‘Ruth’, then input idnum 10-11 of next line, which is 22, the idnum of Jose by default.
    I don’t know if I am correct. Hope it helps.

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *