📄 _nobs.hlp
字号:
{smcl}
{* 10mar2005}{...}
{cmd:help _nobs}{right:also see: {help undocumented}}
{hline}
{title:Title}
{p 4 15 2}
{cmd:_nobs} {hline 2} Programmer's utility for counting the number of
observations
{title:Syntax}
{p 8 14 2}{cmd:_nobs} {it:varname} [{it:weight}] [{cmd:if} {it:exp}]
[{cmd:in} {it:range}] [{cmd:,} {cmd:min(}{it:#}{cmd:)}
{cmdab:zero:weight} ]
{p 4 4 2}
{cmd:fweight}s, {cmd:aweight}s, {cmd:iweight}s, and {cmd:pweight}s are
allowed; see {help weights}.
{title:Description}
{pstd}
{cmd:_nobs} counts the number of observations based on a 0/1 variable giving
the sample. (Strictly speaking, the variable is evaluated as 0/not 0.)
{pstd}
It is an {hi:rclass} command, and the number of observations are returned
in {hi:r(N)}.
{pstd}
If frequency weights ({cmd:fweight}s) are specified, then the sum of the
weights is used for the number of observations. If the weights are any other
type, they are marked out, but otherwise ignored.
{pstd}
If the number of observations are less than those specified by the
{cmd:min()} option, an appropriate error message is issued.
{title:Options}
{phang}
{cmd:min(}{it:#}{cmd:)} specifies the minimum allowed number of
observations. That is, if the number of observations is less than #, an error
message is displayed. The default is 1.
{phang}
{cmd:zeroweight} specifies that weights of zero are not to be marked
out.
{title:Example}
{pstd}
{cmd:_nobs} is intended for use by programmers. Its typical use is the
following:
{cmd:program define myprog}
{cmd:version} {it:...}
{cmd:syntax [varlist] [fweight iweight] [if] [in]}
{cmd:marksample touse}
{cmd:_nobs `touse' [`weight'`exp'], min(2)}
{cmd:local N = r(N)}
{it:...}
{cmd:end}
{title:Also see}
{psee}
Online: {helpb count}, {helpb summarize}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -