By admin | July 27, 2009

SAS Certified Base Programmer 50 Questions (4)

A raw data file is listed below.

1---+----10---+----20---+----30---+----40---+----50
TWOSTORY 1040 2      1SANDERS ROAD      $55,850
CONDO    2150 4    2.5JEANS AVENUE     $127,150

The following program is submitted using this file as input:

data work.houses;
    infile 'file-specification';
    <insert INPUT statement here>
run;

Which one of the following INPUT statements reads the raw data file correctly?

a. 
input @1  style $8.
+1  sqfeet 4.
+1  bedrooms 1.
@20 baths 3.
    street 16.
@40 price dollar8;
b. 
input @1  style $8
+1  sqfeet 4.
+1  bedrooms 1.
@20 baths 3.
    street $16.
@40 price dollar8.;
c. 
input @1  style $8.
+1  sqfeet 4.
+1  bedrooms 1.
@20 baths 3.
    street $16.
@40 price dollar8.;
d. 
input @1  style $8.
+1  sqfeet 4.
+1  bedrooms 1.
@20 baths 3
    street 16.
@40 price dollar8.;

7 comments | Add One

  1. SAS Tutor - 07/27/2009 at 5:01 pm

    C

  2. Anno - 09/26/2009 at 5:27 pm

    Even C is not correct, needs $ after street

  3. admin - 09/26/2009 at 5:44 pm

    Thank you very much. It’s a typo.

  4. Ravitheja - 07/6/2011 at 7:18 am

    Hi Anno, $ is not require after the street, since we specified character informat after the street variable.
    I fell Option B and C both are same and correct answers.

  5. chayan - 12/27/2011 at 5:11 am

    option b is incorrect in the 1st line…

  6. Deblaiso - 05/24/2012 at 1:27 pm

    I believe with C

  7. Prabhakar - 03/12/2014 at 3:39 am

    Answer is C because A and D reading teh street as Numeric and B is reading style value without Dot($8.)

Leave a Comment

Leave a Reply

Your email address will not be published.