help for dkobs

Drop or Keep A Range of Observations

dkobs is a command about dropping or keeping a range (irregular ranges are allowed) of observations.

Syntax

dkobs numlist [if] [in], [ by(varlist) keep last quietly ]

by(varlist) is optional, defines group variable(s) including individuals.

keep is optional, keeps a range of observations. The default is to drop a range of observations.

last is optional, specifies the last range of observations. The default is the first range of observations.

quietly is optional, suppresses the result of the command execution. The default is to display the result.

Examples

. dkobs 1

. dkobs 1/3 16 27

. dkobs 1/3 16 27, k quietly

. dkobs 1 `c(N)'

. dkobs 1(2)l

. dkobs 1(2)`c(N)', k

. dkobs 1, by(id) keep // keep the first duplicate observation

. dkobs 1, by(id) keep last // keep the last duplicate observation

. dkobs 1/3 16 27, by(id)

. dkobs 1/3 16 27, by(id) keep

. dkobs 1/3 16 27, by(id) keep last

. dkobs 1/3 16 27, by(id) keep last quietly

. quietly bysort id : count

. dkobs 1(2)`r(N)', by(id)

. dkobs 1(2)l, by(id)

Authors

Dejin Xie, School of Economics and Management, Nanchang University, China.

E-mail: xiedejin@ncu.edu.cn.

Also see

Help: drop, keep.