Hello all,
I have attached a photo with a snippet from the dataset I am using. What I am trying to do is for the variables with the same "secid", same "datadate", same "exdate", same "strike_price", and same "cp_flag", find the variable (with the aforementioned conditions), which has the closest absolute value of "delta" to the number 0.5. I would then like to drop the other variables that are further away from 0.5. Those anyone have an idea regarding how this can be done?
Thanks!

I have attached a photo with a snippet from the dataset I am using. What I am trying to do is for the variables with the same "secid", same "datadate", same "exdate", same "strike_price", and same "cp_flag", find the variable (with the aforementioned conditions), which has the closest absolute value of "delta" to the number 0.5. I would then like to drop the other variables that are further away from 0.5. Those anyone have an idea regarding how this can be done?
Thanks!
Comment