I'm using stata 13 with OS windows 10. I have a data set with firms quarter earnings announcement.
What I need exactly is to guarantee that I have four fiscal quarters for each firm in each fiscal year. I have an idea how to solve this, but I don't know how to code this. Let me give you an example with my data.
permno: id
anndats: earnings announcement day - Annual
anndatsq: earnings annoucement day - quarter
I can identify end of fiscal year when anndats = anndatsq. Thus, what I really need is to have exactly three observations (three anndatsq) between equals anndats and anndatsq.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long permno float(anndats anndatsq) 10001 17408 17210 10001 17408 17288 10001 17408 17408 10001 17805 17484 10001 17805 17576 10001 17805 17667 10001 17805 17805 10001 18352 17853 10001 18352 17987 10001 18352 18032 10001 18352 18123 10001 18352 18213 10001 18352 18352 10001 18722 18399 10001 18722 18490 10001 18722 18581 end format %td anndats format %td anndatsq