By admin | September 22, 2009

SAS Certified Base Programmer 123 Questions (72)

The following SAS program is submitted:

data work.test;
    First = 'Ipswich, England';
    City = substr(First,1,7);
    City_Country= City!!'; '!!'England';
run;

Which one of the following is the value of the variable CITY_COUNTRY in the output data set?

A. Ipswich!!
B. Ipswich, England
C. Ipswich, ‘England’
D. Ipswich , England

6 comments | Add One

  1. admin - 09/22/2009 at 11:07 am

    D

  2. nurba - 11/1/2010 at 9:00 am

    none of the above

    by default the length is determined by the length of the first argument. so the answer would be:

    Ipswich_________; England
    (had to replace the blanks with unerscores because of the auto formatting, please delete the first comment)

  3. akived - 02/24/2012 at 12:45 pm

    @nurba is right

  4. ritter james - 09/3/2012 at 2:33 am

    The answer would be Ipswich ; England

    Please change the option D as above.

    Also there would be a semicolon instead of comma.

  5. Renu - 10/23/2012 at 1:02 pm

    The answer choices are wrong. the correct answer is Ipswich ; England.

  6. Fleevi - 07/9/2014 at 10:20 pm

    try inserting put statement in DATA step
    put city_country=;
    you will find what nurba describes in log (I repeat, log)

    use PROC print instead,
    you will get the semicolon option D

    This is weird

Leave a Comment

Leave a Reply

Your email address will not be published.