Hi there,
I'm working on a large dataset containing all stock trades from a large brokerage house. The variables are account number (hhnum), stock (cusip), date bought or sold (date), and quantity and price bought or sold. Below are the first couple of lines.
I have to omit some observations however for my analysis: Whenever an investor sells more of one stock over the period than he has bought over the period, all observations from that investor buying or selling that stock should be dropped (my analysis will include the average purchase price, and if more is sold than bought, I cannot calculate this).
Array
I'm fairly new to STATA and tried playing around with foreach, but so far haven't come up with anything that could do the job.
Could anyone point me in the right direction?
Philippe
Related Posts with Dropping certain stock trades from a large dataset
Generate variable with conditionsDear all, I am currently working on my masterthesis. For this thesis, I am preparing a dataset whic…
Different colors for the confidence intervals plotDear All, I want to plot confidence intervals with different colors of my preference. I am using the…
misum error: variable _mj not foundDear all, I had used Daniel Klein's misum command in the past and never had an issue until now. I a…
"Varlist required" error message in loop using local macroHi I'm trying to use a loop to generate a set of new variables representing the format of an existi…
no observations r(2000) error codeHello I have a dataset of daily stock return and cash dividends for all Danish listed firms. I am i…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping certain stock trades from a large dataset
Post a Comment