Hi,
The dataset is as follows:
GVKEY FYEARQ FQTR DATACQTR SALE_DEC SALEDEC SALEINC
001004 2011 1 2011Q3 1 4.0787026566 . 001004 2011 2 2011Q4 1 . . 001004 2011 3 2012Q1 0 . -0.017301069 001004 2011 4 2012Q2 0 . 0.2664100989 001004 2012 1 2012Q3 1 1.8067205327 . 001004 2012 2 2012Q4 1 . . 001004 2012 3 2013Q1 0 . 1.9264163544 001004 2012 4 2013Q2 0 . -0.188650692
With the above dataset, I would like to find the most recent quarter's sales decrease and most recent quarter's sales increase.
For example, the most recent quarter with a sales decrease for year 2011 and 2012 would be 4.01787...as this is the only sales decrease over the last 8 quarters.
The most recent sales increase for year 2011 would be 0.2664100989 as this is the latest value for sales increase over the last 8 quarters for year 2011. The value for the latest sales increase for 2012 would be -0.18865.
The most recent "sales decrease" event not neccessarily happen in the quarter 4 as the firm might experience the last "sales decrease" event during quarter 1 of previous year.
I wish the output as follows:
GVKEY FYEARQ SALEDEC SALEINC
001004 2011 4.0787026566 0.2664100989
001004 2012 4.0787026566 -0.188650692
I hope that this make it clearer.
Thank you for any suggestions.
Regards,
MSPAK
... View more