Hi Everyone,
I am stuck on the below mentioned question, can someone please explain:
Given the following data set WORK.CLASS: Name Gender Age Anna F 23 Ben M 25 Bob M 21 Brian M 27 Edward M 26 Emma F 32 Joe M 34 Sam F 32 Tom M 24 The following program is submitted:
data WORK.MALES_OVER25; set WORK.CLASS; where Gender="M"; where age>25; run; How many observations are in the data set WORK.MALES_OVER25?
A) 3 B) 5 C) 6 D) 9
Thank you!!
Only one where statement will have effect: the last one that the data step compiler encounters. So the restriction for gender does not work.
Instead you get all 5 persons older than 25.
Maxim 4: try it.
If you don't have SAS available: only one of the where statements will have effect.
Thank you @Kurt_Bremser. I am just confused that when the raw data has 6 males then why the answer is B i.e. 5. Can you please explain.
Only one where statement will have effect: the last one that the data step compiler encounters. So the restriction for gender does not work.
Instead you get all 5 persons older than 25.
Thank you !! Got it now.
5
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.