Hi Nick and Martin,
thanks for your prompt replies. The solutions you posted are great and much appreciated.
Regards
Martyn
-----Original Message-----
From: Martyn Kirk
Sent: Tue 31/03/2009 14:55
To: [email protected]
Cc:
Subject: Help with filling in dates in a dataset
Hi Statalisters,
I have a reasonably simple query and have searched the help and archives without identifying a solution.
I have count data recorded on different dates over a year. The dataset only contains records for dates where there were observations. I want to fill in the series, so I have a dataset that has 0 counts for days with no obersvations. An example of what I currently have and what I want to end up with are below.
Current Dataset:
Date Hospitalisations Deaths
1 Jan 08 1 0
3 Jan 08 3 0
5 Jan 08 0 1
7 Jan 08 0 1
8 Jan 08 1 0
11 Jan 08 2 1
12 Jan 08 3 0
14 Jan 08 1 0
Desired Dataset:
Date Hospitalisations Deaths
1 Jan 08 1 0
2 Jan 08 0 0
3 Jan 08 3 0
4 Jan 08 0 0
5 Jan 08 0 1
6 Jan 08 0 0
7 Jan 08 0 1
8 Jan 08 1 0
9 Jan 08 0 0
10 Jan 08 0 0
11 Jan 08 2 1
12 Jan 08 3 0
13 Jan 08 0 0
14 Jan 08 1 0
Is there a simple way of generating these extra records with zero counts? All help gratefully received.
Regards
Martyn Kirk
The Australian National University
Canberra, Australia
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/