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
Quantile regression, with specified quantilesDear all, I would like to run a quantile regression with factor variables and clustered standard er…
how can I highlight just one comment in Twoway Graph Dear members, I have a data information by country, from which I made a twoway Graph, however, usin…
how to graph bar of categorical variablesDear Stata users, Suppose there is a categorical variable which has values of 1, 2, 3 representing …
Troubles with rownumb() in codeHello stata users, I am having troubles with rownumb() in my code. Below is the code and data. Code…
Adding Dummy VariablesHi All, So I am new to using Stata. I have a preset excel file and wanted to create dummy variables…
Subscribe to:
Post Comments (Atom)
0 Response to Drop variables
Post a Comment