Hi!

For my thesis, I'm interested in the effect of a change in working hours on mental health outcomes. Hence, my X variable is working hours and my Y variable are certain mental health indicators. My first question is how to create variables for changes in working hours while using panel data. So for example;

ID. Wave. Actualhours increase_of_15_hours
1. 1. 32 0
1. 2. 47 1
1. 3. 47 0

What I want here is that I have a dummy variable called for example; increase_of_15 hours which equals one if a person works X hours in period t and X+15 hours in period t+1. Which is the case in the example I gave above. (note that at wave 3, increase_of_15_hours should be 0). I want to create the same variable for a decrease_of_15_hours too, but I assume the code for this the same.

I hope the question is clear, if not, please let me know