I have two variables, period and company. Period is the accumulative number of quarters starting from 2004. So, 1 is the first quarter of 2004, and 5 is the first quarter of 2005. I would like to know how to keep for each year only the last quarter, namely 4,8,12,16,20... is there a better code than do "keep if period == 4|period == 8|period == 12|period == 16|period == 20|period == 24"?
Thank you!!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(period company) 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 3 2 3 2 3 2 3 2 3 2 3 2 4 2 4 2 4 2 4 2 4 2 4 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 7 2 7 2 7 2 7 2 7 2 7 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 9 2 9 2 9 2 9 2 9 2 9 2 9 2 9 2 9 2 9 2 9 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 10 2 11 2 11 2 11 2 end
0 Response to keep observations between the same range
Post a Comment