Hello,
I would like to create start and end variables according to the data collection wave in which each participant's marital status changed.
I currently have ID, wave (1 to 5) and marstat (single, married, divorced) and I would like the data to look as follows:
ID Marstat Start End
1 Single 1 2
1 Married 2 4
1 Divorced 4 5
2 Married 1 5
3 Single 1 3
3 Married 3 5
I can't work out how to do this even though I am sure it is quite simple! Any advice would be most appreciated.
Many thanks,
Philippa
Related Posts with Creating start and end variables
Testing and addressing potential attrition bias in panel dataDear all, I am using household panel data across three waves (2011, 2013, and 2015). Although the v…
How to dissect multiple variables in one column to separate columnsHello good Sir/Madam, I am currently working with a list of corporations and their CashFlowTypes, a…
Calculate median collecting observations from different variables in wide formatDear all, my data structure looks like this. good 1 price 1 good 2 price 2 etc. milk 43 egg 4…
Problem with generating and replacing variableHi, I have written the following code but I am facing a lot of problems. Code: gen tetns_inj=. …
Limit replace observations for n yearsDear All, I have the following data: Code: * Example generated by -dataex-. To install: ssc inst…
Subscribe to:
Post Comments (Atom)
0 Response to Creating start and end variables
Post a Comment