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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.