etotal
Data exploration and transformation
Flexible counts and totals.
Description
An extension of total
, etotal
produces either totals or counts, depending on what the user has specified.
If weights are specified, or if data are svyset
and the svy
option is specified, standard errors and confidence intervals are included.
Syntax
Count of observations
if] [weight] [, options] etotal [
Total of existing variable
if] [weight] [, options] etotal varname [
Total of expression
exp [if] [weight] [, options] etotal
Option | Description |
---|---|
over(varname) |
Group over subpopulations defined by varname. |
svy |
Adjust the results for survey settings identified by svyset . |
level(#) |
Set confidence level; default is level(95) . |
cformat(%fmt) |
Specifies how to format estimates, standard errors, and confidence limits; default is cformat(%14.0fc) . |
matrix(matname) |
Save results in matrix matname. |
fweight
s, iweight
s, and pweight
s are allowed.
Examples
Weighted count of observations
etotal [iw=wgtp]
Total of existing variable
if relp == 0 [iw=wgtp] etotal hincp
Total of existing variable, data is svyset
svy etotal hincp,
Total of expression, saving results in matrix
matrix(tot_hh_inc_thous) etotal hincp / 1000 [iw=wgtp],