Statalist The Stata Listserver


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

st: create a _n time variable panel data


From   "Ricardo Guimaraes" <ricardo.guimaraes@uni-bonn.de>
To   statalist@hsphsun2.harvard.edu
Subject   st: create a _n time variable panel data
Date   Wed, 07 Jun 2006 10:48:11 +0200

Dear Members,
I have the following panel data .

?????????????
how to calculate
| t idd i v1 v2 | vn ob |
|---------------------------------------------------|
1. | 1 560036 1 3 . | 1 4|
2. | 1 560036 2 2 . | 1 4|
3. | 1 560036 3 3 1 | 1 4|
4. | 1 560036 4 6 1 | 1 4|
5. | 1 560036 5 3 1 | 1 4|
|---------------------------------------------------|
6. | 2 560036 1 1 . | 2 4|
7. | 2 560036 2 2 6 | 2 4|
3. | 2 560036 3 3 1 | 2 4|
8. | 2 560036 4 3 7 | 2 4|
9. | 2 560036 5 2 1 | 2 4|
|---------------------------------------------------|
10.| 3 560036 1 . . | . .|
11.| 3 560036 2 . . | . .|
12.| 3 560036 3 . . | . .|
13.| 3 560036 4 . . | . .|
14.| 3 560036 5 . . | . .|
|---------------------------------------------------|
15.| 4 560036 1 1 . | 3 4|
16.| 4 560036 2 2 . | 3 4|
17.| 4 560036 3 7 1 | 3 4|
18.| 4 560036 4 3 1 | 3 4|
19.| 4 560036 5 5 1 | 3 4|
|---------------------------------------------------|
20.| 5 560036 1 1 . | 4 4|
21.| 5 560036 2 2 . | 4 4|
22.| 5 560036 3 8 1 | 4 4|
23.| 5 560036 4 3 1 | 4 4|
24.| 5 560036 5 3 1 | 4 4|
|---------------------------------------------------|


"t" is time (let's say, by month); "idd" identifies a family; "i" an individual in the family;
"V1", "v2" are variables about characteristics of individuals. The panel is formulated in
a rotating basis: families are observed no more than 4 times (months) in a year. In my table
they would be the variable "ob". However, the observation are not taken in a row. They "jump"
some months (like month 3 in my example), where the members of the family are not observed. I do not have the variables "Vn" and "ob".
Question:

How to create two variables, 1) "vn": 2) "ob" ) for each individual saying:

1) "vn" : a sequence (_n) of the months that the individuals are observed. For instance, in the
time "t" the individuals of the family were not observed.
2) "ob" : the total number (_N) of times that the individual were observed. Note that in some
variables the values are (.), but the individual was observed.


sincerely,

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