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

Can anyone please clarify the following for me?  I have two different answers from certification practice exams and I really don't understand.  Example 2 makes sense to me...SUM ignores missing values.  But then there's Example 1 that uses SUM but in that one "missing" makes the total SUM missing.  Any clarification is greatly appreciated - thanks!

Example 1

ACredit = . ;
BCredit = 1;
TotalCredits = sum (ACredit + BCredit) + 2;
    What is the value of TotalCredits?  Answer = Missing numeric value
    Explanation: when the SUM function is called with a single argument, it returns the value of that argument. In this case, it is called    
    with a missing value, so it returns a missing value.


Example 2
ACredit = . ;
BCredit = 1;
TotalCredits = sum (ACredit, BCredit) + 2;
    What is the value of TotalCredits?  Answer = 3
    Explanation: The SUM statement ignores missing values.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
The ACredit+Bcredit is evaluated first inside the brackets and returns a missing value to SUM() which then returns a missing value again.

View solution in original post

2 REPLIES 2
Reeza
Super User
The ACredit+Bcredit is evaluated first inside the brackets and returns a missing value to SUM() which then returns a missing value again.
William_Anthem
Calcite | Level 5

Thank you Reeza, that explains it very well! 

 

I appreciate your help!

 

Bill

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 13630 views
  • 0 likes
  • 2 in conversation