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
extracting several string values from several different variablesHello, i am working with treatment data i have treatment1 treatment2 treatment3 treatmentn variables…
How to interpret predicted probabilities with continious variables in logistic regression?Hello everyone, I've got a question regarding how to interpret continious variables in logistic reg…
Calculating time between specific events in panel dataHello, I have panel data with 1 to 10 events per patid. The eventdate is the date of the stroke and…
How to identify all cases with missing observationDear All How can I identify and list all cases with missing observation(denoted by .a) from a data …
Can I match on a baseline dataset from 2018 (treatment) and 2020 (control)?Dear Statalisters, I am currently writing my thesis on the topic of Multidimensional Empowerment. F…
Subscribe to:
Post Comments (Atom)
0 Response to Mark latest observation with unbalanced paneldata
Post a Comment