ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 30

A realtor has two customers. One customer wants to view a list of homes selling for less than $60,000. The other customer wants
to view a list of homes selling for greater than $100,000.
Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?
A. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;
B. proc print data = sasuser.houses;
where price lt 60000 or price gt 100000;
run;
C. proc print data = sasuser.houses;
where price lt 60000 and price gt 100000;
run;
D. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
Click Comment link to get answer

29 comments:

  1. Anonymous8:54 AM

    Answer is C....
    As they want both 60000 and 100000 prices

    ReplyDelete
    Replies
    1. no,"where price lt 60000 and price gt 100000;" means the value of the price must meat the condition of both"less than 60,000" and "greater than 100,000", which has the results of missing value.

      Delete
    2. sorry typo:meet

      Delete
    3. Anonymous4:33 PM

      you retarded?

      Delete
  2. Anonymous7:32 PM

    it cant b "c" as and test for both conditions and u ll get zero results

    ReplyDelete
  3. madhuri6:34 AM

    data shoes;
    input price;
    datalines;
    50000
    70000
    100000
    110000
    40000
    ;
    run;


    proc print data = shoes;
    where price lt 60000 or price gt 100000;
    run;

    try this code u will get right answer

    ReplyDelete
  4. Anonymous2:19 PM

    Sakar Sham:
    It has been asking two condition to fulfill so "and" is the best options to meets that condition.

    I have a question?
    Does or can be combined with where? or Not? If where and or condition can not put together then B is out automatically. Can any body elaborate on it and give the facts.

    ReplyDelete
  5. Anonymous12:17 AM

    whts the final ans guys?

    i think its C

    ReplyDelete
  6. Anonymous11:28 AM

    The ans is 'B'.
    If anyone having confusion please go through the concept of and & or.

    ReplyDelete
  7. I dnt know for some reason that if I give the code where price lt 60000 or price gt 100000 : its reading values less than 60000 but not greater than 100000. but if I give:::
    where price > 60000 or price < 100000-- its reading all the values-- but according it to me,, it should have no difference. and the answer is B

    ReplyDelete
  8. Anonymous1:55 PM

    Answer is B , 'OR' gives either of one condition whereas we need both condition results , so answer is B

    ReplyDelete
  9. B;
    when you test for multiple values for the SAME variable specifity variable name in each expression.
    where price lt 60000 OR price gt 100000

    ReplyDelete
  10. Anonymous11:00 PM

    thanks madhuri !

    ReplyDelete
  11. Meenal4:25 PM

    Answer is B. 'OR' means either one of d conditions shd b true. In this case both the conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the observations in which both the conditions are true at d same time. ie. the obs where the price is ln 60000 and also the preice is gt100000. Hence answer is not correct.

    ReplyDelete
    Replies
    1. Anonymous8:44 AM

      yes and also the variable price is mentioned in both conditions so you get output when both the conditions are true

      Delete
  12. Meenal4:33 PM

    Answer is B. 'OR' means either one of d conditions shd b true. In this case both the conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the observations in which both the conditions are true at d same time. ie. the obs where the price is lt 60000 and also the price is gt 100000. Hence answer C is not correct.

    ReplyDelete
    Replies
    1. Thanks Meenal! That really cleared things up

      Delete
  13. Ans is B for sure using OR condition which will select all houses ether less than 60 K or GT 100K

    ReplyDelete
  14. Anonymous3:51 PM

    So is there only one output or two separated?

    ReplyDelete
  15. Anonymous5:49 PM

    One can be Idiot OR Smart but
    One cannot be Idiot AND Smart

    if you understand this you'll get the answer.

    ReplyDelete
  16. B should be the answer

    Did anybody try the output for C?

    ReplyDelete
  17. Anonymous9:46 PM

    The answer is B
    If you learn about the Statistics, you will know the difference between 'AND' and 'OR'. According to the Statistics, a mean of AND is part of a common place among things. However OR is part of the whole places among things.

    ReplyDelete
  18. wow really nice. It will be helpful for the people those who are ready to crack the interview and please also for remind what they have learned throughout concept.

    Base SAS Training in Chennai

    MSBI Training in Chennai

    ReplyDelete
  19. This blog very easily understandable. Thanks for sharing such an informative post with us. This is a nice post in an interesting line of content.
    SAS Training in Bangalore

    ReplyDelete