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
npregress derivatives at different points instead of average of totalI am running a nonparametric regression using the following code: Code: npregress kernel log_totEx…
coefplot graph: how to drop _cons in mixed-model graph?I have a logistic regression graph which contains an unadjusted (univariate) model between age, gend…
Grouping Variables?Working to group multiple variables with same description under the same name in a table. Variables …
rangestathi all, I am trying to figure out how to use -rangestat- for the following dataset example using -d…
bar graph / blabel()I'm creating bar graphs with similar code: graph bar var1 var2 var3 var4, /// over(race, relabel (1…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping Variables Based on Condition and in a Loop
Post a Comment