Hi all,
Complete newbie here. I've been trying to figure out the following without success. My set of data contains a variable X with observations that repeat (i.e., the number of times the same person had different observations). I'm trying to figure out how to keep only the last observation in my data set.
It looks something like this:
X Y Z
6 Yes 10/31/1990
3 No 2/10/2010
3 No 2/28/2020
4 No 5/30/2016
6 No 12/10/2020
Observations 6 and 3 repeat for X. I only want to keep the last observations in X (while keeping everything else). My hope is that after keeping only the last observations of X, I will be left with something like this:
X Y Z
3 No 2/28/2020
4 No 5/30/2016
6 No 12/10/2020
Any help would be much appreciated!
Related Posts with Keeping Last Observation
Count distinct values of variable 'Year' for each different id in variable 'Id'Dear Statalist users, this is my first post in the forum and I am a Stata beginner, so please forgi…
dta files gets extremely large after appendingHi everyone! I have started learning Stata recently and I'm super excited to be here! I have been fo…
Margin plots after xtreg not workingI have researched a lot on internet on different forums and could not find any satisfactory answer. …
stata programming combining 2 variablesLet me explain, what I want to do here. I have four variables of household id (ssuid), year, month a…
r603 using eventstudy commandDear Statalist, I am trying to run an event study using stata "db eventstudy" (eventstudy commandà …
Subscribe to:
Post Comments (Atom)
0 Response to Keeping Last Observation
Post a Comment