This is a frequently asked question. See for example
http://www.stata.com/statalist/archive/2009-03/msg01313.html
and the ensuing thread. In short, check out -fillin- and -tsfill-.
Nick
[email protected]
Martyn Kirk
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?
*
* 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/