Sarah,
Try the fillin command, this may help.
jose
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sara
Valentini
Sent: Wednesday, February 14, 2007 3:02 PM
To: [email protected]
Subject: st: add rows in order to balance the panel
Dear Statlisters,
I'm working with an unbalanced panel database. I would like to solve a
simple problem, but I cannot figure out how to solve it. I try to
explain my problem describing my data, it's easier!
My unit of analysis is customers (i). I observe these customers for some
quarters (t). The database has the following structure (more or less):
i t Y
1 1 40
1 3 30
1 4 20
2 1 10
2 2 20
2 3 20
2 4 30
For simplicity, suppose I have only 4 quarters (t=1, 2, 3, 4) and two
customers. This panel is unbalanced. As you can see, customer n. 1
doesn't have information for quarter 2.
Y are the dollar spent but customers to buy some items.
I would like to add the following row to my database:
i t Y
1 2 0
That is, I would like to add the non purchase option. For example
customer 1 does't buy anything at time 2, so I would like to put a 0 in
Y.
Specifically, I would like to find the way to add rows in my database in
order to have the same number of rows for each customers (4 in this
example), rows with null values for some of the variables of the
database (such as Y).
I have a huge number of records so I cannot do that manually J, or using
excel or SPSS.
If you know a specific command to solve this problem, or have an idea I
appreciate any suggestion.
I sincerely thank everybody for reading my e-mail
Sara
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/