I want to mark the latest observation in an unbalanced dataset with panel data
Timevaribel: t (varies som 0 to 17)
person id: id
The program code I use now:
bysort id t: generate last_obs = sum(t==17)==1 & sum(t[n-1]==2)==0
But the problem is that it only marks the persons with a time variable = 17 year and it does not mark the persons with less observations that 17
So how do I generate a variable that marks the latest observation no matter how long the time variabel is?
Related Posts with Mark latest observation with unbalanced paneldata
Panel ordered logit modelDear Scholars, Please someone should assist me on how install xtologit on stata 11 …
R Square in Panel DataHi everyone, I tried zapping through the search a bit but could no find a correct answer. My proble…
Help with problem in creating variable that describes one event occurring at least onceHello. I'm new to this forum, and quite new to Stata in general, as I just started using it for the …
Drop variables if total sum is the largestDear all, I’m working with a dataset of 396 observations and 148 variables. I’m trying to drop a var…
Interpreting Oaxaca Decomposition with categorical variablesHello all, I am writing an undergraduate dissertation on UK gender pay gap using LFS data. I am hav…
Subscribe to:
Post Comments (Atom)
0 Response to Mark latest observation with unbalanced paneldata
Post a Comment