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
Using coefficeints from regress command to generate a new variablegood evening everyone, I am using Stata 16.1. I have to run a pooled OLS on a panel data and the us…
Xtologit application to consumers labels rankingHello everyone ! I am currently working on a study of French consumers' preferences towards differe…
Loop to change MDE and N in pcpanel commandHi. I'm using the pc_simulate command to find a sample size that will give me a power of 80%. I want…
automatically detect if using GUI or batch modeI am using Stata both in the GUI and running scripts in batch mode using a slurm cluster. The filepa…
Weighted VS Unweighted Advice + HelpGood evening everyone; I have a quick question / in need of some advice. I am doing weighted and u…
Subscribe to:
Post Comments (Atom)
0 Response to How to delete observations in panel data
Post a Comment