As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Difference between revisions of "Tip of the Day:March 1"

From sasCommunity
Jump to: navigation, search
m (Protected "Tip of the Day:March 1": per tip of the day process [edit=sysop:move=sysop])
(Scheduled Order of SAS Operator Evaluation)
Line 1: Line 1:
 
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 
<tr>
 
<tr>
<td style="background-color: #E1F7E5;border-color: #18AF1F;border-width: 1px;border-style: solid;" width="48%" valign="top" align="center">
+
<td style="background-color: #E1F7E5;border-color: #18AF1F;border-width: 1px;border-style: solid;" width="48%" valign="top">
 
<h1 style="background-color: #18AF1F;color: #FFFFFF; padding:10px">
 
<h1 style="background-color: #18AF1F;color: #FFFFFF; padding:10px">
 
sasCommunity Tip of the Day
 
sasCommunity Tip of the Day
 
</h1><div style="padding:10px;">
 
</h1><div style="padding:10px;">
{{Tips:Editor Abbreviations}}
+
{{Tips:Order of SAS Operator Evaluation}}
 
<div style="width:100%"><hr></div>
 
<div style="width:100%"><hr></div>
Feel free to [[Tips Talk:Editor Abbreviations|comment]] on this tip.
+
Feel free to [[Tips Talk:Order of SAS Operator Evaluation|comment]] on this tip.
 
</div>
 
</div>
 
</td></tr>
 
</td></tr>

Revision as of 20:51, 27 February 2010

sasCommunity Tip of the Day

x = 5+2*4; (is ambiguous.)
Do you mean: (5+2)*4;
Or do you mean: 5+(2*4);
 
What about: A or B and C;

A SAS expression with no more than one operator is called a simple expression. When an expression includes several operators, it is called a compound expression. When SAS encounters a compound expression, it follows certain rules to determine the order in which to evaluate each part of the expression. Knowing about this operator order, and how to use parentheses to alter it, can be crucial when writing compound expressions.

In the code to the right operator order determines whether X takes on the value of 13 or 28. These two assignment statements are not equivalent and operator order and evaluation dictates the application of the logic. You are well advised to use parentheses when you are unsure of the logic.

Submitted by Art Carpenter. Contact me at my Discussion Page.



Feel free to comment on this tip.


Prior tip - Next tip - Random Tip

Submit a Tip