Dear Statalist members,
I know that there is simple way to drop the duplicate variables using Stata. However, is there a way to do the opposite? I mean drop variables that are not duplicates.
For example, the data below with panelid and panel variable shows that if data is collected in 3 years, there will be 3 times the variable "pabelid" appearing. If there is only 1 year, there will be only 1 variable.
Is there a way I can drop all the variables with panel consisting of only 1 year?
Thank you in advance. Sorry if my explanation is somehow complicated.
panelid panel
101007 2006, 2010 and 2017
101007 2006, 2010 and 2017
101007 2006, 2010 and 2017
101018 2006, 2010 and 2017
101018 2006, 2010 and 2017
101018 2006, 2010 and 2017
101021 2006, 2010 and 2017
101021 2006, 2010 and 2017
101021 2006, 2010 and 2017
101025 2006, 2010 and 2017
101025 2006, 2010 and 2017
101025 2006, 2010 and 2017
101038 2006, 2010 and 2017
101038 2006, 2010 and 2017
101038 2006, 2010 and 2017
101041 2006, 2010 and 2017
101041 2006, 2010 and 2017
101041 2006, 2010 and 2017
101043 2006, 2010 and 2017
101043 2006, 2010 and 2017
101043 2006, 2010 and 2017
panelid panel
622654 2017 only
622655 2017 only
622656 2017 only
622657 2017 only
622658 2017 only
622659 2017 only
622660 2017 only
622661 2017 only
622662 2017 only
622663 2017 only
622664 2017 only
622665 2017 only
622666 2017 only
622667 2017 only
622668 2017 only
622669 2017 only
622670 2017 only
622671 2017 only
622672 2017 only
Related Posts with Drop variables
How to plot differences in means for diff-in-diff common trend (from Bleakeley & Chin (2004))Dear Stata community, This is my first post on the forum. I'm struggling to recreate figure 1 from …
aweight, pweight or fweight? What to use for WLS?Dear all, I would like to apply a weighted least squares model but I do not know which weight to us…
Save t-statistic output for all observations (function statsby)Hi all, I would like to save all the t-statistics as output for all of my regression observations u…
How to make a hbar which shows percentage of sum of one variable over groupsI have a dataset like this (part of it): Code: * Example generated by -dataex-. To install: ssc in…
Dummy Variables OmmittedIn a study looking at the effect of foreign ownership, we have run into the issue that our variables…
Subscribe to:
Post Comments (Atom)
0 Response to Drop variables
Post a Comment