Hello I need help learning how to drop a variable if one or more observations are greater than a number x. I tried googling this but what i found didn't help or was for one specific variable or if all variables were to be looked at. I only want to look at 100 of the 150 variables I have in my dataset.
Ex. I have variables dist_stop1, dist_stop2 and so on till 100. I want to be able to write a loop that will drop variable "dist_stopP" (with P being a number 1-100) if that variable has an observation bigger than say 33.315.
So if dist_stop4 has observations smaller than 30 and has one observation that is 40.56 then the loop will drop dist_stop4 then move on to dist-stop5.
All of the dist_stop variables are float types.
I have been googling and reading for an hour but nothing is helping. Please help me. Thank you for reading and helping.
Related Posts with Dropping Variables Based on Condition and in a Loop
Keeping variables in panelHi all, I have an unbalanced panel. The complete panel spans 11 periods from 2004 to 2015. I would …
Advice regarding panel data and collapseHello Everyone, I have a situation with respect to my data. I have weekly data from the top 200 son…
Create variable of group frequenciesI have a data set that includes variables on individual's district (where a person lives) and occupa…
How to separate an observation entered within an observation and use some of the contentHello, I have a dataset that is collected at village (group) level with randomly selected household…
How to collapse observations and overwrite variablesHi everyone, I have a data set where there are 4 diseases, but the presence of each is entered as a …
Subscribe to:
Post Comments (Atom)
0 Response to Dropping Variables Based on Condition and in a Loop
Post a Comment