[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: FW: How to make 'contract' create a row of zerofrequencies?
One solution could be to use -tabcount- by Nick Cox, available from SSC.
You specify a list of values which define the categories of a variable that
are to be counted, and zero frequencies are then included. The -replace-
option makes it function much like -contract-, except zero frequencies are
retained for the specified values.
--On 22 May 2006 11:52 +0100 Pauline Rogers <Pauline.Rogers@cancer.org.uk>
I have a large dataset containing information on individuals attending for
screening at several centres.
I am writing a program to summarise monthly attendance, to be run
regularly by one of our administrators. So I first 'contract' my data to
create a new dataset of the number of attendances for each centre for
each month. I used the following statement:
contract centre3 mrec, freq(count) zero
(Centre3 = centre code, mrec = month code)
I have discovered that when there are no attendances in a month at any of
the centres, Stata completely excludes this month rather than create a
zero count for each centre.
This then completely throws out my summary statistics. Is there any way I
can force 'contract' to create a count of zero for each centre for any
month with zero attendance at all centres?
* For searches and help try: