Statalist


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

st: Convert yearly to monthly data


From   "Nikolaos Kanellopoulos" <nkkanel@yahoo.gr>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Convert yearly to monthly data
Date   Fri, 31 Aug 2007 19:55:56 +0100

Dear all,

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/



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