By admin | August 9, 2009

SAS Certified Base Programmer 50 Questions (33)

The following SAS program is submitted:

data test;
    input animal1 $ animal2 $
        mlgrams1 mlgrams2;
cards;
hummingbird ostrich 54000.39 90800000.87
;
run;

Which one of the following represents the values of each variable in the output data set?
a.

animal1 animal2 mlgrams1 mlgrams2
hummingb  ostrich  54000.39  90800000

b.

animal1 animal2 mlgrams1 mlgrams2
hummingb  ostrich  54000.39  90800000.87

c.

animal1 animal2 mlgrams1 mlgrams2
hummingbird  ostrich  54000.39  90800000

d.

animal1 animal2 mlgrams1 mlgrams2
hummingbird  ostrich  54000.39  90800000.87

10 comments | Add One

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

    B

  2. GUEST - 12/25/2010 at 12:47 pm

    WHY B? NOT hummingbird?

  3. anjani - 02/3/2012 at 12:35 am

    character and numeric variable by default take 8 length

  4. Raji - 05/21/2012 at 5:51 am

    I guess it is taking only 8 as the width by default for Char variables, as we have not specified the formatted length in the input stt.

  5. Himanshu - 06/21/2012 at 2:33 pm

    because length is not specified then it will by default as 8…correct me if i am wrong!

  6. Yogesh - 10/18/2012 at 6:47 am

    to guest – Because character variable truncated after 8 character (default length)

  7. Joel - 12/13/2012 at 6:16 pm

    Not hummingbird because the length of animal1 was not specified so it is automatically set to 8. Anything beyond the first 8 characters is cut off.

  8. Nik - 03/12/2013 at 5:28 am

    The default length without an informat is 8 bytes – makes it 8 characters

  9. Yonggang - 01/3/2014 at 4:28 pm

    Why not is “a”?

  10. hello - 01/5/2014 at 11:00 pm

    isn’t the default length for numeric variable is 8 bytes as well?

    why 90800000.87? i thought the answer would be 90800000 cuz in this way there r 8 digits of numbers

Leave a Comment

Leave a Reply

Your email address will not be published.