This can also be written as 1=1, and is essentially a static TRUE condition.
This is actually a neat little trick that gets around the problem of adding multiple where clauses (as macro variables). Each where condition must be separated by an operator (AND / OR, usually AND), but it is not always known if another condition precedes the one you are adding. For instance, you may want the flexibility to add the same &filter
to both of these where claueses:
where x=1 &filter;
where &filter;
of course the first example must resolve to x=1 AND some=filter;
and the second must not resolve to where AND some=filter;
Remember, any condition in a where clause ultimately resolves to true or false. By adding "1", we have a static "TRUE" condition that has no effect on the query but does give us flexibility (and readability) in the code (basically avoids more macro %if %else statements) if we always prepend the "AND" to &filter.
where 1 &filter
instead of
where %if %length(&filter)>4 and "%substr(%upcase(&filter))" ne AND %then %do;
where 1 and &filter
%end;
%else %do;
where &filter
%end;