By admin | July 27, 2009

SAS Certified Base Programmer 50 Questions (3)

The following program is submitted:

data numrecords;
    infile cards dlm=',';
    input agent1 $ agent2 $ agent3 $;
cards;
jones,,brownjones,spencer,brown
;
run;

What is the value for the variable named Agent2 in the second observation?

a. brown
b. spencer
c. ”(missing character value)
d. There is no value because only one observation is created

20 comments | Add One

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

    D

  2. Ravi - 07/6/2011 at 7:05 am

    None of the above options.
    answer is brownjon

  3. Deepak - 07/25/2011 at 5:27 am

    Ans: brownjon
    Since 8 character is default length and without dsd it will ignore two consecutive delimiter and consider as single.

  4. aaa - 08/30/2011 at 10:03 am

    The question asked for agent2 in the 2nd observation not in the 1st observation. D is correct.

  5. lil wayne - 08/31/2011 at 11:25 pm

    you guys are right about brownjon, but thats for the 1st obs, but its asking for the 2nd obs

  6. Ash - 10/7/2011 at 5:09 am

    D is the correct option. This dataset will create only one observation.

  7. Bill - 02/24/2012 at 10:45 am

    I run it on sas, it should be brownjon

  8. anj - 03/23/2012 at 2:30 pm

    true. Answer is brownjon

  9. DK - 04/19/2012 at 12:43 pm

    Yes, brownjon is the correct ans.

  10. Vaibhav Mainkar - 05/18/2012 at 8:23 am

    Question asks value for variable
    Agent2 in the SECOND OBS.
    D is right ans.

  11. Vinu - 05/23/2012 at 2:56 pm

    The answer is D.
    Please read the question carefully.
    What is the value for the variable named Agent2 in the SECOND observation?

    There will NOT be a SECOND observation because only ONE line of rawdata is read SAS will create only one observation.

  12. Deblaiso - 05/24/2012 at 1:20 pm

    I agree with Deepak. A sample of a sas program is the following.
    data wonderful ;
    infile datalines dsd dlm=’,’;
    input agent1 $ agent2 $ agent3 $ agent4 $;
    datalines;
    jones,,brownjones,spencer,brown
    ;
    run; proc print data=wonderful; run;
    and the output is:
    agent1 agent2 agent3 agent4
    jones brownjon spencer

  13. Crystal - 07/31/2012 at 12:52 pm

    Yes,both Ravi and deepak are right.

  14. Evan - 10/1/2012 at 2:07 pm

    guys, it’s asking about the 2nd observation, not the second variable. it’s a stupid trick you have to look out for.

  15. Renu - 10/23/2012 at 5:06 pm

    answer = ‘D’ try

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

    Actually I believe the answer is A. the first observation has jones missing brownjon then the second observation has spencer brown missing.

  17. Nik - 03/11/2013 at 12:13 pm

    @Ravi and Deepak: The question is about the value within the 2nd observation. There is only one observation and therefore answer D is correct

  18. Appu - 04/2/2013 at 3:14 am

    Yes this correct answer
    None of the above options.
    answer is brownjon

  19. PS - 09/2/2013 at 5:53 am

    data numrecords;
    infile cards dlm=’ ‘ dsd;
    input agent1 $ agent2 $ agent3 $ @@;
    cards;
    jones brownjones spencer brown
    ;
    run;

    the above program returns 18 observations WHY plz help

  20. Aloke - 12/6/2013 at 6:03 am

    —————————————
    Obs agent1 agent2 agent3
    1 jones brownjon spencer
    —————————————-
    This is the output. There is no SECOND obs. So answer is option D.

Leave a Comment

Leave a Reply

Your email address will not be published.