With do it yourself approaches keep in mind that
the sample used in the estimation command may be
different than the full sample (e.g. because of
missing data or because you only analyze a subset
of the data). You may therefore need to add an if qualifier of some sort, e.g.