jg_joy16 发表于 2020-9-7 22:35 
碰到一样的问题,这时候系统会输出 "." 你怎么处理的?
help egen 往下拉 添加option就行
mode(varname) [, minmode maxmode nummode(integer) missing] (allows by varlist:)
produces the mode (within varlist) for varname, which may be numeric or string. The mode is the value occurring most frequently. If two or more modes exist or if varname
contains all missing values, the mode produced will be a missing value. To avoid this, the minmode, maxmode, or nummode() option may be used to specify choices for selecting
among the multiple modes, and the missing option will treat missing values as categories. minmode returns the lowest value, and maxmode returns the highest value. nummode(#)
will return the #th mode, counting from the lowest up. nummode() may not be combined with by. Missing values are excluded from determination of the mode unless missing is
specified. Even so, the value of the mode is recorded for observations for which the values of varname are missing unless they are explicitly excluded, that is, by
if varname < . or if varname != "".