ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 26

The following SAS program is submitted:
data work.new;
length word $7;
amount = 7;
if amount = 5 then word = 'CAT';
else if amount = 7 then word = 'DOG';
else word = 'NONE!!!';
amount = 5;
run;
Which one of the following represents the values of the AMOUNT and WORD variables?
A. amount word
5 DOG
B. amount word
5 CAT
C. amount word
7 DOG
D. amount word
7 ' ' (missing character value)
Click Comment link to get answer

16 comments:

  1. Anonymous10:38 PM

    Answer is A

    ReplyDelete
  2. A

    >>always "Dog" will be assigned to word as amount is hardcoded 7 in the begining of each iteration
    >>and a value of 5 is saved in amount as it is hardcoded before the end of each output.

    ReplyDelete
  3. I dint understand the answer, Can anybody explain it?

    ReplyDelete
  4. Anonymous1:41 PM

    This question checks your knowledge about how sas reads. When SAS reads in the iterations in sequence, it first writes 5 to the variable 'amount'in PDV. Then it reads through the condition and writes 'DOG' for variable 'word' in PDV. Then it again encounters the value 7 and writes to 'Amount' in PDV. As this is not a loop and run statement follows, SAS gives the output from PDV which would be 7 and 'Dog'. Hopw this helps.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  5. Anonymous1:43 PM

    Sorry for the above explanation, Please read in the values for 'amount' as 7 and 5 respectively. Hence the answer would be 'A'.

    ReplyDelete
  6. Anonymous3:39 PM

    I really like how you have explained various concepts here. Can anyone plz guide me regarding where to find short questions just like asked in SAS Base exam for practice? The kind of questions where we need to right the code and answer multiple questions based on it?

    ReplyDelete
  7. This blog gives very important info about SAS Thanks for sharing. Very well written information.
    SAS Certification
    SAS Certification course

    ReplyDelete