The WHERE statement can be regarded as "compile time" because WHERE (unlike IF) outsources the filtering to the data engine. That engine might be a sas dataset engine, or (say) a foreign engine, but the logic of the filter is entirely outside of the DATA step statements.
Among other consequences, this means
In the data step, the observations that fail the filter are never assigned an _N_ value. I.e. they are not counted as observations processed. The same filtering logic in an IF statement does count those obs. Just try processing SASHELP.CLASS, once with WHERE SEX='F', and once with IF SEX='F';
The WHERE statement can be used with any other PROC. The IF statement can't. Great if you want to run, say, a regression on a particular subset of data - no need for a DATA step prior to the PROC REG.
So while KEEP and DROP can be thought of as compile time because they clearly don't impact the programming logic, the WHERE is a bit more active, but is still not part of the DATA step logic. It is not "compiled" into the underlying DATA step code.
... View more