SAS Base Certification Practice – Question 3

Question 3: The contents of the raw data file NAMENUM are listed below:
 

--------10-------20-------30
Joe xx

The following SAS program is submitted:

1
2
3
4
data test;
infile 'namenum';
input name $ number;
run;

Which one of the following is the value of the NUMBER variable?

Options:

A. xx
B. Joe
C. . (missing numeric value)
D. The value cannot be determined as the program fails to execute due to errors.

*This blog is not affiliated with SAS or the SAS Institute. 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

3 Comments

    Kam Sep 19, 2015

    In the input statement there is no range specified (ex: input name $ 1-3) for variable ‘name’. How is SAS able to read it? I thought that specifying a range for the input variable is a must.

    Reply
      Matthew Oct 13, 2015

      It’s list style input, so SAS reads each value until the first delimiter that it reaches, which in this case is the space between Joe and xx. Specifying the range is not necessary.

      Reply
        Toan Oct 05, 2016

        Since a DLM=’,’ or DSD is not specified, it counts the blank as a delimiter, correct?

        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.