ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 66

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

12 comments:

  1. Anonymous6:32 AM

    Could you please expalinn why A

    ReplyDelete
  2. sweta2:50 PM

    value of amount=7 over lap for amount=4.
    put output statement before amount=7, we will get
    amount=4 and word=four
    then amount=7 overlapping amount=4.
    check with below statement:-
    data work.new;
    length word $7;
    amount = 4;
    if amount = 4 then word = 'FOUR';
    else if amount = 7 then word = 'SEVEN';
    else word = 'NONE!!!';
    output;
    amount = 7;
    output;
    run;

    ReplyDelete
    Replies
    1. Anonymous6:47 AM

      hi~ thank you!! so much~:-)

      Delete
  3. Anonymous2:37 PM

    Yes;Your are dm right this time.
    SAS reads the first amount 4 and we get the fist obs
    4 four
    as the sas reads amount = 7 then output, then it replaces the amount 4 to 7.
    we get a output like this.
    7 four

    ReplyDelete
  4. dellian12:23 AM

    I ran the code and I found the answer is
    word amount
    FOUR 7
    which is the reversed order of A.
    Because "length word $7;" first produces a variable word in PDV, then amount = 4;

    ReplyDelete
  5. Anonymous9:26 AM

    i am having an exam after 2 weeks...can you pls help me on questions? whether these type of Q's will be there in exam?

    ReplyDelete

  6. Your blog is very useful for me.I really like you post.Thanks for sharing.
    goldenslot

    ReplyDelete