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.
Tips Talk:Creating a flag avoiding the If ... Then Structure
I'm not sure what this tip is trying to say .. it isn't clear from the writing and definitely doesn't appear to show how if then statements are avoided. Conversely, I think that reminding users that they can construct fields that represent whether certain conditions are met would be useful, but I'd be interested in seeing what the author was actually trying to convey.--Art T 13:02, 11 August 2011 (UTC)
The point is that one can replace
IF MIN(x , y) GT 4 THEN flag = 1 ; ELSE flag = 0 ;
flag = MIN(x , y) GT 4 ;
I actually prefer
flag = IFN(MIN(x , y) GT 4 , 1 , 0) ;
The bit about a character variable is trouble waiting to happen because there will be leading blanks if the variable has length >1.
In SQL the expression
CASE WHEN MIN(x , y) GT 4 THEN 1 ELSE 0 END
is equivalent to
MIN(x , y) GT 4
IFN(MIN(x , y) GT 4 , 1 , 0)
--Howles 02:17, 12 August 2011 (UTC)
Howard, I agree that it would be a useful tip if re-written to convey the points that you made, namely that one can reduce keystrokes by ... And, if character variables are included, mentioning including the strip function in order to eliminate leading or trailing blanks. --Art T 13:32, 13 August 2011 (UTC)
I agree that a statement comparing the IF vs the other constructs would clarify this tip. As far as the other contstructs suggested here (e.g., IFN) I think that is better left to a more detailed article that is the read more link for this tip. I also added the <source lang="sas"> tag to the code to fix the formating. --Don Henderson 15:28, 15 August 2011 (UTC)
Handling very old TIPs
- I think that most of the objections have been satisfied and that the tip should be reconsidered. --Art Carpenter (talk) 21:58, 26 May 2014 (CDT)