I am new to Stata programming and currently conducting an event study on ad hoc disclosures for my master thesis.
For the analysis I need to differenciate between positive and negative cumulative abnormal returns before and after the event. That's why I created six columns that contain the information on "CAR_before_positive", "CAR_before_negative", "CAR_after_positive" and "CAR_after_negative", "CAR_Event_Day_positive" and "CAR_Event_Day_negative. Also there is information on the DisclosureID and the days of the event window (-5,5). Everything is organized in long format. Due to the way the calculation works, values might appear more than once in every column (for an example see the table below).
Disclosure_ID | Day | CAR_before_pos | CAR_before_neg | CAR_after_pos | CAR_after_neg | CAR_Event_Day_pos | CAR_Event_Day_neg |
1 | -5 | -4% | |||||
1 | -4 | -4% | |||||
1 | -3 | 2% | |||||
1 | -2 | 2% | |||||
1 | -1 | -4% | |||||
1 | 0 | 7% | |||||
1 | 1 | 3% | |||||
1 | 2 | 3% | |||||
1 | 3 | 3% | |||||
1 | 4 | -2% | |||||
1 | 5 | -2% | |||||
2 | -5 | 3% | |||||
2 | -4 | -1% | |||||
2 | -3 | 3% | |||||
2 | -2 | -1% | |||||
2 | -1 | 3% | |||||
2 | 0 | -3% | |||||
2 | 1 | -2% | |||||
2 | 2 | -2% | |||||
2 | 3 | 1% | |||||
2 | 4 | 1% | |||||
2 | 5 | 1% |
So what I actually need is a command that is able to delete all values that appear more than once in a column for each Disclosure_ID the way that all other data is kept. It doesn't matter which day the value belongs to at the end because I only need the average across all disclosures. I already thought to maybe create a variable that is equal to one for the first value that appears in the respective column for each disclosure id and then drop all the other rows. Regretablly it's the same problem that you have when you use the duplicates command. So it must be something that only works with one column at a time...
I would be so really grateful if anyone could help me with my problem!
Thanks a lot in advance!
Cecilia
0 Response to Drop values in columns without using the drop duplicates command
Post a Comment