Hi

I want to create a variable that is 1 if the monthly salary is twice as big or more than the previous month and employment degree stays the same.

I have made an example dataset, which contains and ID, time, salary, and employment (employment = 1 signals that an employees has what is equal a regular work week).

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(id time salary employment)
1 1 20000 1
1 2 20000 1
1 3 20000 1
1 4 20000 1
1 5 50000 1
1 6 20000 1
1 7 20000 1
2 1 20000 1
2 2 20000 1
2 3 60000 1
2 4 20000 1
2 5 20000 1
2 6 20000 1
2 7 20000 1
end

Gustav