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
HETTREATREG: module to compute diagnostics for linear regression when treatment effects are heterogeneousDear All: I would like to announce that hettreatreg, a Stata module to compute diagnostics for line…
Looping simple linear regression and storing beta coefficientHello everyone, i have a dataset in long format, it contains information of 3,167 school's perfomanc…
margins and interpretation of the interaction between two variables one of which in log transformedHi all, I have two questions I was hoping to get some help: 1) I have a panel(longitudinal) model …
using tempnumber in commandHello, I am trying to run this code below and having trouble with "tempnumber" in the command. This…
Long data format: How to count individuals and not observations?Dear all I have a problem with my data set that I hope you can help me solve. My dataset is in lon…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping Variables Based on Condition and in a Loop
Post a Comment