Nick,
Thank you very much
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Friday, August 31, 2007 6:05 PM
To: [email protected]
Subject: st: RE: Convert yearly to monthly data
-reshape- is your friend.
In fact, to -reshape- your data are wide, not long.
Nick
[email protected]
Nikolaos Kanellopoulos
> I have a typical longitudinal data set, which gives me information
> about the status of individuals for each month within a year. The data
> are in a long format, thus every row represents a year. Variable pid
> distinguishes the individuals and variable year shows the time
> dimension. Every month is represented by a variable (v1-v12). This is
> a binary variable but it can also contain missing values.
>
> My question is how I can convert my data from yearly panel to monthly
> panel based on v1-v12.
>
> To show what I mean, let's say that my original data look like that:
>
> pid year v1 v2 v3 v4 v5 v6
> v7 v8
> v9 v10 v11 v12 x
> 1 1 1 1 1 1 1 1
> 1 1
> 1 1 1 1 .1369841
> 1 2 1 1 1 1 1 1
> 1 1
> 1 1 1 1 .6432207
> 1 3 1 1 1 1 0 0
> 0 1
> 1 1 1 1 .5578017
> 2 3 1 1 1 1 1
> 1 .0610638
> 2 4 1 1 0 0 0 0
> 1 1
> 1 1 1 1 .5552388
>
> I want to convert them so they will look like:
>
> pid v year x
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 1 .1369841
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 2 .6432207
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 0 3 .5578017
> 1 0 3 .5578017
> 1 0 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 1 1 3 .5578017
> 2 1 3 .0610638
> 2 1 3 .0610638
> 2 1 3 .0610638
> 2 1 3 .0610638
> 2 1 3 .0610638
> 2 3 .0610638
> 2 3 .0610638
> 2 3 .0610638
> 2 3 .0610638
> 2 3 .0610638
> 2 3 .0610638
> 2 1 3 .0610638
> 2 1 4 .5552388
> 2 1 4 .5552388
> 2 0 4 .5552388
> 2 0 4 .5552388
> 2 0 4 .5552388
> 2 0 4 .5552388
> 2 1 4 .5552388
> 2 1 4 .5552388
> 2 1 4 .5552388
> 2 1 4 .5552388
> 2 1 4 .5552388
> 2 1 4 .5552388
>
*
* 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/