By Tony Brady
If you haven't already done so, you may find it useful to read the article on xtab because it discusses what we mean by longitudinal data.
xcount is a simple program, similar to count,
except it counts clusters instead of observations. The clusters
must be identified either by using the
or previously with the iis command.
To follow this example in Stata type:
in the Stata command window.
For instance, to count the number of patients in our example dataset (long.dta) we can use either:
. iis idnum . xcount
. xcount, i(idnum)
Either way, we get the following output:
So there are 15 patients in this dataset. Contrast this to the result from count:
To count the number of male patients:
To count the number of patients whose systolic blood pressure has exceeded 160mmHg at some point during the follow-up period we use:
To obtain xcount type the following into Stata:
net from http://www.sealedenvelope.com/
and follow the instructions on screen. This will ensure the files are installed in the right place and you can easily uninstall the command later if you wish.