help count dialog: count
-------------------------------------------------------------------------------
Title
[D] count -- Count observations satisfying specified conditions
Syntax
count [if] [in]
by is allowed; see [D] by.
Menu
Data > Data utilities > Count observations satisfying condition
Description
count counts the number of observations that satisfy the specified
conditions. If no conditions are specified, count displays the number of
observations in the data.
Examples
Setup
. sysuse auto
Count the number of observations having rep78>4
. count if rep78>4
By categories of foreign, count the number of observations having rep78>4
. by foreign: count if rep78>4
Saved results
count saves the following in r():
Scalars
r(N) number of observations
Also see
Manual: [D] count
Help: [R] tabulate oneway, [R] tabulate twoway, [R] tabulate,
summarize()