Hey all,
I am using panel data and have a full population dataset. I can observe an individuel over time, their age and their retirement status (dummy variable). I would like to generate a variable over their retirement age by ID.
I tried the following code:
by ID_nr: gen retirement_age = age if retirement == 1
by ID_nr: replace retirement_age = min(retirement_age)
However, it does unfortunately not work.
Can anyone help?
Thank you in advance!
Related Posts with generate retirement age
Mark observations selected in sampleHi, I want to randomly select 40 observations from a dataset for INSURED (1=yes, 0=no) by each CITY…
'rdbwselect' invertability errorI am using Stata14 to run RDD. When computing the optimal bandwidth using 'rdbwselect' I get the fol…
Formatting a StringHi. This will likely be a banal and rudimentary question. Apologies in advance, but I am stuck never…
Mlogit - output to Excel horizontallyHello, I am running a number of mlogit models with several variations of the dependent and one of t…
How to code variable correctly using syntax. Please help meHello This is my first post, so please be kind to me. I have 12 dichotomous variables, that i want…
Subscribe to:
Post Comments (Atom)
0 Response to generate retirement age
Post a Comment