SMPL Option |
SPREAD=SERIES/FRML/expression which takes value 0 for observations to be skipped
Many instructions that deal with series, including most estimation instructions, have a SMPL option, which allows you to selectively include and omit observations within the entry range used by the instruction. To use it, either:
•create a series with non-zero values (usually ones) in the entries you wish to be part of the sample, and zeros in the entries you wish to exclude, or,
•supply an expression as a function of T (this can be a FRML) that evaluates to true (1) for the entries you want to include, and false (0) for the entries you want to exclude.
Other ways of controlling the set of entries over which an instruction operates are described in "Entry Ranges".
Examples
set small = pop<2000 ;* Will be 1 only when POP<2000
linreg(smpl=small) ...
The LINREG skips entries where SMALL=0 (i.e. where POP>=2000).
sstat(smpl=yesvm==0) / 1>>nos testvm<.5>>nnnos $
lpmfitted<.5>>lpmnos prfitted<.5>>prbnos
sstat(smpl=yesvm==1) / 1>>yes testvm>.5>>nnyes $
lpmfitted>.5>>lpmyes prfitted>.5>>prbyes
The first SSTATS operates only on the entries where YESVM is 0 and the second operates only on the entries where YESVM is 1. NOS will be the count (sum of 1's) for the YESVM==0 branch, NNNOS will be the number of entries where YESVM is 0 and TESTVM<.5, etc.
linreg(smpl=age>=30.and.age<=64,robust) logahe
# yrseduc constant
The LINREG runs only over the entries where AGE is at least 30 and no more than 64.
Copyright © 2025 Thomas A. Doan