
I have a panel data set in which respondents (persnr) did state their annual income. I was interested in the highest income they ever obtained shown in the observations. For this purpose I used the max function (egen max_inc= max(inc)). But of course now I am interested at which age they actually earned the most.
here is my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 A str10 B str3 C str7 D "persnr" "survey_age" "inc" "max_inc" "2402" "46" "256" "665" "2402" "47" "488" "" "2402" "48" "665" "" "2403" "20" "716" "716" "2403" "21" "716" "" end
Do you have any idea which code would suit best?
Thanks a lot
Jessica
0 Response to Combining the "max" function of one column with a value of another column
Post a Comment