Here is a snippet of the data I am working with:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double secid long(datadate exdate) str2 cp_flag double strike_price 101062 13535 13595 "C" 40000 101535 13535 13595 "P" 30000 101121 13535 13595 "P" 35000 101508 13535 13595 "P" 55000 101375 13535 13595 "P" 60000 102113 13535 13595 "C" 10000 102349 13535 13595 "P" 120000 102349 13535 13595 "C" 125000 103879 13535 13595 "P" 70000 104229 13535 13595 "P" 35000 104059 13535 13595 "P" 25000 108065 13535 13595 "P" 20000 105700 13535 13595 "P" 55000 105971 13535 13595 "P" 35000 106638 13535 13595 "P" 70000 106595 13535 13595 "C" 45000 110357 13535 13595 "P" 22500 108965 13535 13595 "P" 120000 108965 13535 13595 "C" 120000 107747 13535 13595 "C" 70000 end format %td datadate format %td exdate label var secid "Security ID" label var datadate "The Date of this Price" label var exdate "Expiration Date of the Option" label var cp_flag "C=Call, P=Put" label var strike_price "Strike Price of the Option Times 1000"
I would like to be able to create pairs based on having the same "datadate", same "exdate", same "strike_price", but a different "cp_flag" (one observation in the pair has a cp_flag equal to "C" and the other to "P"). If I am unable to create this pair, I would like to drop these observations. Those anyone know how I can do that?
Thanks
0 Response to Dropping observations based on certain criteria
Post a Comment