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
B
ReplyDeleteB
ReplyDeleteAnswer is C....
ReplyDeleteAs they want both 60000 and 100000 prices
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.
Deletesorry typo:meet
Deleteyou retarded?
Deleteit cant b "c" as and test for both conditions and u ll get zero results
ReplyDeletedata shoes;
ReplyDeleteinput 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
Sakar Sham:
ReplyDeleteIt 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.
b
ReplyDeletewhts the final ans guys?
ReplyDeletei think its C
The ans is 'B'.
ReplyDeleteIf anyone having confusion please go through the concept of and & or.
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:::
ReplyDeletewhere 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
Answer is B , 'OR' gives either of one condition whereas we need both condition results , so answer is B
ReplyDeleteB;
ReplyDeletewhen you test for multiple values for the SAME variable specifity variable name in each expression.
where price lt 60000 OR price gt 100000
thanks madhuri !
ReplyDeleteAnswer 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.
ReplyDeleteyes and also the variable price is mentioned in both conditions so you get output when both the conditions are true
DeleteAnswer 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.
ReplyDeleteThanks Meenal! That really cleared things up
DeleteAns is B for sure using OR condition which will select all houses ether less than 60 K or GT 100K
ReplyDeleteSo is there only one output or two separated?
ReplyDeleteB
ReplyDeleteOne can be Idiot OR Smart but
ReplyDeleteOne cannot be Idiot AND Smart
if you understand this you'll get the answer.
B should be the answer
ReplyDeleteDid anybody try the output for C?
The answer is B
ReplyDeleteIf 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.
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.
ReplyDeleteBase SAS Training in Chennai
MSBI Training in Chennai
B
ReplyDeleteThis blog very easily understandable. Thanks for sharing such an informative post with us. This is a nice post in an interesting line of content.
ReplyDeleteSAS Training in Bangalore