This document discusses using the NOBS option on the SET statement in SAS. It notes that NOBS returns the number of observations before any WHERE clause is applied. If the number of observations after the WHERE clause is needed, an additional DATA step is required. It also notes that the NOBS variable will not appear in the output dataset and is independent of the OBS= option. Not all SAS engines, such as XML, properly support NOBS.