Hi all,
I have a panel data set where I want to conditionally delete observations. In my case, I am studying funds. I want to delete all funds that have even one observation of Total Net Assets (TNA) under 5 million. This means I want to delete all the observations of the fund at once and not just the observations of the fund that have a "TNA" under 5. Below I've written down an example to clarify what I mean.
What is currently happening is that when I try to delete fund 1 with the commands below, only observations 1 and 2 will be deleted of fund 1. However, I aim to delete the whole of fund 1 at once.
Commands used:
xtset fund date
by fund (date), sort: drop if tna < 5
Example:
Fund: Date: TNA:
1 01/01 4
1 01/02 4
1 01/03 6
1 01/04 6
2 01/01 20
2 etc. 20
2 20
2 20
Thank you in advance.
Related Posts with How to delete observations in panel data
how can we draw a nomogram in 10 multiple imputated dataset?Hello Members, I am a new Stata user and now trying to write a paper about prediction model. But we…
cgmreg - error messageHi, I'm relatively new to stata, and cant seem to get around this error message. I am trying to car…
Dichotomous Independent variableHi I am working on the following data set and in order to determine my model, I have TOTALINVESTMEN…
Averaging with a condition while generating a new variableHi there! I have household-level data with unique household_id. For each household, I have data for…
Multiple lines (>100) on a tsline plot?Hello, I have some panel data that spans 5 years (2000-2005) and 150 countries with LN GDP Per Capi…
Subscribe to:
Post Comments (Atom)
0 Response to How to delete observations in panel data
Post a Comment