This was the exchange Sergiy refers to.
I don't think that users can produce beasts like e(sample). My guess is
that StataCorp are using unpublicised hooks to do that.
Nick

What other functions are there beside e(sample)? I always got the
impression that e(sample) was really more like a hidden variable than
a function, i.e. the variable is coded 1 if the case was in the
estimation sample and 0 otherwise.