Hi everyone,
I'm looking to create a new dummy variable that takes the value of 1 if an individual exits unemployment (i.e. goes from being unemployed to being employed), and takes the value of 0 if an individual stays unemployed. I'm working with panel data that has a variable "Whether unemployed in month x" that indicates whether an individual was unemployed in January, February, March, etc. of a certain year, and this covers the whole of the time period of 2007-2015 (8 years) -- this means that there is one variable for each month of each year to indicate whether the individual was unemployed in said month. The "whether unemployed in month x" variable takes the value of 1 if the individual was unemployed in the month in question, and 0 if the individual was employed.
What I have done so far is to isolate the variables that I am interested in, which are all of the "whether unemployed in month x" variables for the time period 2007-2015, as well as the family ID variables. I then reshaped the data to "long", and generated two variables to indicate the change of an individual's employment status:
1. a variable, "exitue" which takes the value of 1 if an individual goes from unemployed in month t to employed in month t+1
2. a variable, "stayue" which takes the value of 1 if an individual is unemployed in month t and stays unemployed in month t+1
What I'm struggling to figure out now is how to generate the new dummy variable that I need, which takes the value of 1 if an individual exits unemployment and 0 if an individual stays unemployed.
Here are the commands that I have used so far:
Any advice would be much appreciated!
I'm looking to create a new dummy variable that takes the value of 1 if an individual exits unemployment (i.e. goes from being unemployed to being employed), and takes the value of 0 if an individual stays unemployed. I'm working with panel data that has a variable "Whether unemployed in month x" that indicates whether an individual was unemployed in January, February, March, etc. of a certain year, and this covers the whole of the time period of 2007-2015 (8 years) -- this means that there is one variable for each month of each year to indicate whether the individual was unemployed in said month. The "whether unemployed in month x" variable takes the value of 1 if the individual was unemployed in the month in question, and 0 if the individual was employed.
What I have done so far is to isolate the variables that I am interested in, which are all of the "whether unemployed in month x" variables for the time period 2007-2015, as well as the family ID variables. I then reshaped the data to "long", and generated two variables to indicate the change of an individual's employment status:
1. a variable, "exitue" which takes the value of 1 if an individual goes from unemployed in month t to employed in month t+1
2. a variable, "stayue" which takes the value of 1 if an individual is unemployed in month t and stays unemployed in month t+1
What I'm struggling to figure out now is how to generate the new dummy variable that I need, which takes the value of 1 if an individual exits unemployment and 0 if an individual stays unemployed.
Here are the commands that I have used so far:
reshape long wtrue, i(familyid) j(time)
bys familyid: gen exitue=1 if(wtrue[_n]==1 & wtrue[_n+1]==0)
bys familyid: gen stayunemp=1 if(wtrue[_n]==1 & wtrue[_n+1]==1)
bys familyid: gen exitue=1 if(wtrue[_n]==1 & wtrue[_n+1]==0)
bys familyid: gen stayunemp=1 if(wtrue[_n]==1 & wtrue[_n+1]==1)
Comment