Hello,
I would like to make use of "duplicates drop" command to drop out certain rows,
For example, my original dataset as follows
Disno statea namea stateb nameb strtyr
173 365 RUS 2 USA 1958
173 710 CHN 2 USA 1958
608 365 RUS 2 USA 1958
608 365 RUS 2 USA 1958
1124 90 GUA 2 USA 1958
2187 731 PRK 2 USA 1958
2187 731 PRK 2 USA 1958
2187 731 PRK 2 USA 1958
2187 731 PRK 2 USA 1958
2215 365 RUS 2 USA 1958
2216 365 RUS 2 USA 1958
2857 339 ALB 2 USA 1958
I would like to remain the rows as below
Disno statea namea stateb nameb strtyr
173 365 RUS 2 USA 1958
173 710 CHN 2 USA 1958
608 365 RUS 2 USA 1958
1124 90 GUA 2 USA 1958
2187 731 PRK 2 USA 1958
2857 339 ALB 2 USA 1958
Although Disno 173 has a duplicate, since it has a different combination like statea 365 and state 710, I would like to remain these two rows.
My purpose is to remain Disno depending on a specific statea and stateb combination.
If I use "duplicates drop Disno, force", one of 173 would be dropped out.
Instead, I tried to make a distinct row identifier like "gen dyad_year=statea*1000000000+stateb*10000+ strtyr" and used
"duplicates drop dyad_year, force", but it dropped out many unwanted rows.
Are there any tips to make use duplicates more efficiently?
Thank you
Related Posts with advice on using duplicates drop command
Adjusting bar sizeHi, I hope everyone here is safe working from home. I am working with bar charts from my real-time …
where does -simulate- save the returned results each time?Dear Statalist, I have questions regarding the way that the command -simulation- runs the pre-defin…
Flexible Parametric Survival (stpm2) - command str2d not workingDear Forum Members, I'm using the user-written - stpm2 - written by Royston and Lambert. The comman…
Modelling market share of brands using panel data with cross-sectional variablesHi everyone, I'm trying to model the choices among different products from 2000 to 2018 in differen…
Problem with xi - syntaxI just realized the solution. Sorry. When you are making only dummies with xi and not running a com…
Subscribe to:
Post Comments (Atom)
0 Response to advice on using duplicates drop command
Post a Comment