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
Uncertainty Indexi am trying to construct an uncertainty index using STATA and would like help with commands …
Transforming datatableHi! I have a question about transforming my data table. I have a table with 3 variables: postal co…
extract the year from an inconsistent string date variableHi everyone, I am having troubles extracting the year from my dateset. Some observations have the f…
How to insert control variables and the command 'by' in xtabond2 ?Hello all, I am doing a research on the Persistence of Profit in the banking sector in 14 emerging c…
Dummy variable omitted due to collinearityHello, I am doing a 3sls regression on int remittance and poverty among developing countries. So, fo…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping certain stock trades from a large dataset
Post a Comment