Hello everyone,
I have a dataset with 167 variables and 351 observations. About 50 variables are such that they record the same information for different time periods. For example, I have
Rainfall_1995
Rainfall_1998
Rainfall_2002
Rainfall_2006
Aridity_1995
Aridity_1998
Aridity_2002
Aridity_2004
Aridity_2006
and so on.
From this, I essentially want to keep only the variables that end in 2006 and drop the rest leaving me with only 50 variables (one each for year 2006).
I know I could just specify the range of variables under each category use -drop- but I'm not sure if this is the quickest way to do this. Wondering if there's a way to just keep variables that end in _2006.
Thank you in advance for any suggestions!
Best,
Mansha
I have a dataset with 167 variables and 351 observations. About 50 variables are such that they record the same information for different time periods. For example, I have
Rainfall_1995
Rainfall_1998
Rainfall_2002
Rainfall_2006
Aridity_1995
Aridity_1998
Aridity_2002
Aridity_2004
Aridity_2006
and so on.
From this, I essentially want to keep only the variables that end in 2006 and drop the rest leaving me with only 50 variables (one each for year 2006).
I know I could just specify the range of variables under each category use -drop- but I'm not sure if this is the quickest way to do this. Wondering if there's a way to just keep variables that end in _2006.
Thank you in advance for any suggestions!
Best,
Mansha
Comment