help for xtab                                             (author:  Tony Brady)

Tabulate longitudinal data

xtab varname [, i(varname) t(varname) missing occasion(ever | never | first | last | _N | # ) ]

by ... : may be used with the above command; see help by.


If you have not read help for xt, please do so now.

xtab, a generalization of tabulate, performs one-way tabulations of cross-sectional time-series (xt) data. It is more flexible than xttab, allowing several choices of the occasion within cluster to tabulate.


i(varname) specifies the variable name corresponding to i; see help xt.

t(varname) specifies the variable name corresponding to t; see help xt.

missing requests that missing values be treated like other values in calculations of counts and percentages.

occasion(occ) determines which observations within cluster i are to be used in the tabulation. occ must be one of:

ever means clusters are characterised by values appearing in any valid observation within the cluster; the default. never tabulates the number of clusters that do not contain the value in any valid observation. (*) first or 1 uses the first valid observation to characterise clusters. (*) last or _N uses the last valid observation to characterise clusters. (*) # requests the observation on occasion # within each cluster to be used in the tabulation.

Unstarred occasions do not require the time variable t to be defined whereas starred occasions do.


. xtab beta, i(idnum) . xtab beta, i(idnum) t(date) occ(last) miss

. iis idnum . tis date . xtab beta, occ(2)

. bysort region: xtab aspirin, occ(never)


Tony Brady, Sealed Envelope Ltd, U.K. tony@sealedenvelope.com

Also see

Manual: [R] xt On-line: help for xt, xttab, xtdes, xtsum