BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ShwetaMalhotra
Calcite | Level 5

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!!

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

5 REPLIES 5
ShwetaMalhotra
Calcite | Level 5

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.

Kurt_Bremser
Super User

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.

ShwetaMalhotra
Calcite | Level 5

Thank you !! Got it now.

mapulenggift
Calcite | Level 5

5

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 5 replies
  • 1559 views
  • 0 likes
  • 3 in conversation