Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: R: RE: add rows in order to balance the panel


From   "Sara Valentini" <s.valentini@unibo.it>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: R: RE: add rows in order to balance the panel
Date   Wed, 14 Feb 2007 21:52:37 +0100

Thank you very much Jose!

________________________________

Da: owner-statalist@hsphsun2.harvard.edu per conto di Romero, Jose Manuel
Inviato: mer 14/02/2007 21.15
A: statalist@hsphsun2.harvard.edu
Oggetto: st: RE: add rows in order to balance the panel



Sarah,

Try the fillin command, this may help.

jose
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sara
Valentini
Sent: Wednesday, February 14, 2007 3:02 PM
To: statalist@hsphsun2.harvard.edu
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/



*
*   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/



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