Stata 15 help for count

[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

Stored results

count stores the following in r():

Scalars r(N) number of observations


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index