Hi,

I am working with paneldata and want to create a dummy variable that shows me if there is a change in the variable -occ-(occupation) in one individual during the three months that my data contain. I have the variable occupation (occ) in form of codes for different occupations. The new variable I want to create should be 1 if the occupation code changes between sept/oct/nov. in one indiidual (i.e. if the individual changed occupations in the timeframe)..

I am happy for any tips,
thanks in advance!
Sophie


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double cpsidp int occ byte month
20190800062501 5710  9
20190800062501 5710 10
20190800062501 5710 11
20190800062502 2825  9
20190800062502 2825 10
20190800062502 2825 11
20190800093601 5240  9
20190800093601 5240 10
20190800093601 5240 11
20190800093602 5000  9
20190800093602 5000 10
20190800093602 5000 11
20190800129701  440  9
20190800129701  440 10
20190800129701  440 11
20190800129702 6355  9
20190800129702 6355 10
20190800129702  440 11
20190800134101 8990  9
20190800134101 8990 10
20190800134101 8990 11
20190800134102 5410  9
20190800134102 5410 10
20190800134102 5410 11
20190800139101 4220  9
20190800139101 4220 10
20190800139101 4220 11
20190800139102 4920  9
20190800139102 4920 10
20190800139102 4920 11
20190800208401 4710  9
20190800208401 4710 10
20190800208401 4710 11
20190800208402 2014  9
20190800208402 2014 10
20190800208402 2014 11
20190800278201  910  9
20190800278201  910 10
20190800278201  910 11
20190800278202 8740  9
20190800278202 8740 10
20190800278202 8740 11
20190800295701 2310  9
20190800295701 2310 10
20190800295701 2310 11
20190800295702 3870  9
20190800295702 3870 10
20190800295702 3870 11
20190800351201 5110  9
20190800351201 5110 10
20190800351201 5110 11
20190800351202 9130  9
20190800351202 9130 10
20190800351202 9130 11
20190800363601 7330  9
20190800363601 7330 10
20190800363601 7330 11
20190800363602 7700  9
20190800363602 7700 10
20190800363602  440 11
20190800364001 3160  9
20190800364001 3160 10
20190800364001 3160 11
20190800364002  440  9
20190800364002  440 10
20190800364002  440 11
20190800368201 3230  9
20190800368201 3230 10
20190800368201 3230 11
20190800368202 2100  9
20190800368202 2100 10
20190800368202 2100 11
20190800412801   20  9
20190800412801   20 10
20190800412801   20 11
20190800412802  800  9
20190800412802  800 10
20190800412802  800 11
20190800448901 3160  9
20190800448901 3160 10
20190800448901 3160 11
20190800448902 5000  9
20190800448902 5000 10
20190800448902 5000 11
20190800449801 5240  9
20190800449801 5240 10
20190800449801 5240 11
20190800449802 5530  9
20190800449802 5530 10
20190800449802 5530 11
20190800453101 1821  9
20190800453101 1821 10
20190800453101 1821 11
20190800453102 3710  9
20190800453102 3710 10
20190800453102 3710 11
20190800465101  440  9
20190800465101  440 10
20190800465101  440 11
20190800465102 6520  9
end
label values month MONTH
label def MONTH 9 "september", modify
label def MONTH 10 "october", modify
label def MONTH 11 "november", modify