@cumobs |

Cumulative observations of a series.

Increasing samples calculation of the number of non-missing observations in .

Syntax: @cumobs(x[, s])

x: series

s: (optional) sample string or object

Return: series

Compute the number of non-missing values in x from the start of the workfile or sample s, up to the current observation.

This function is panel aware.

Examples

series x = @recode(@rnd > 0.5, @nrnd, na)

show x @cumobs(x)

produces a spreadsheet with two columns correspond to x and @cumobs(x). The second series (which corresponds to @cumobs(x)) starts at 0 (if the first observation in x is NA) or 1 (if the first observation in x is non-NA) and increments in those observations where x is non-NA.

Cross-references

See also
@cumnas.

For the backward variant of this function, see
@cumbobs.