Dear Stata users,
I am currently working with panel and spell data. I have found a way to convert spell data into panel data format (long). The spell data distinguishes calendar and year data. I can convert it using the year data using the following command:
gen duration = endy - beginy + 1
expand duration
by persnr, sort: gen year = beginy +_n -1
bysort persnr (begin) : gen period = _n
But in order to be precise as possible, I want to use the calendar data. See the following data example :
id |spellnr |begin |end |spelltype
1| 1 | [12] 1992 Mar| [14] 1992 Apr |[1] working full time
2| 6 | [13] 1998 Apr | [16] 1998 Sep | [2] time out
2| 7 | [17] 2002 Nov | [19] 2004 Jan | [1] working full time
2| 8 | [21] 2004 Feb | [23] 2007 Jan | [2] time out
The main issue here is the fact that the variables "begin" and "end" appears to be blue. Currently, I cannot address the date or something like that. If I try to calculate something with the data, the number in the brackets is used.
Furthermore, I would like to have the data available in panel data format (long) with an variable idicating the the total time of "time out" up to each year for each individual.
I am using Stata 11.
Thanks to all for the help.
I am currently working with panel and spell data. I have found a way to convert spell data into panel data format (long). The spell data distinguishes calendar and year data. I can convert it using the year data using the following command:
gen duration = endy - beginy + 1
expand duration
by persnr, sort: gen year = beginy +_n -1
bysort persnr (begin) : gen period = _n
But in order to be precise as possible, I want to use the calendar data. See the following data example :
id |spellnr |begin |end |spelltype
1| 1 | [12] 1992 Mar| [14] 1992 Apr |[1] working full time
2| 6 | [13] 1998 Apr | [16] 1998 Sep | [2] time out
2| 7 | [17] 2002 Nov | [19] 2004 Jan | [1] working full time
2| 8 | [21] 2004 Feb | [23] 2007 Jan | [2] time out
The main issue here is the fact that the variables "begin" and "end" appears to be blue. Currently, I cannot address the date or something like that. If I try to calculate something with the data, the number in the brackets is used.
Furthermore, I would like to have the data available in panel data format (long) with an variable idicating the the total time of "time out" up to each year for each individual.
I am using Stata 11.
Thanks to all for the help.
Comment