[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: R: RE: add rows in order to balance the panel
-tsfill- is also worth noting.
> Thank you very much Jose!
Romero, Jose Manuel
> Try the fillin command, this may help.
> 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.
* For searches and help try: