Here is one little piece of SAS programming that I always have to work out: When using multiple "by variables" in a SAS data step, when does the grouping flip? An example:
data stuff;
set otherStuff;
by var1 var2 var3;
if first.var1 then ...;
if first.var3 then ...;
run;
For some reason, I always have to sit and think through how multiple by variables effect each other. So here, once and for all, is the rule for me to remember:
If the group (value) changes in the variable to the left, it changes the group of all the variables on the right regardlessof their values.
It makes sense if you think it through, but sometimes it's just easier to write the rule down and refer to it (here!).
From my days as a COBOL programmer, I use the rule "Check from left to right. Process from right to left". Since SAS does the checking, I would expect your code to be ..
ReplyDeleteif var3 then var3_block;
if var2 then var2_block;
if var1 then var1_block;
Am I missing something?
Andy at awasas@cox.net