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
a Regression with missing ValuesHallo Statalist, i am trying to find out the effect of the macro variables on the credit Rating in …
Whether we need to show all coefficients of all variables after testing DiD?I am curious about whether it is a need to show all coefficients of all variables after testing DiD.…
sfpanelI have a quick query regarding the stochastic frontier models. I am running a stochastic frontier mo…
Can we construct the survival curve after stteffects commands?Hello, I'm working on the survival analysis, using stteffects command (both LAC-IPWRA and WAC-IPWRA…
Creating a new variable for 'second to max' value of a series.Hi Statalist colleagues, I have a question regarding max(). So I am trying to extract max and seco…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping certain stock trades from a large dataset
Post a Comment