Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Help with filling in dates in a dataset


From   Martyn Kirk <[email protected]>
To   [email protected]
Subject   st: Help with filling in dates in a dataset
Date   Tue, 31 Mar 2009 14:55:59 +1100

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index