Dear Stata community,
I have stock returns file from CRSP where the date format follows business calendar (for e.g. 12Apr2019). For each stock (id), I want to compute the number of trading days, over non-missing observations, in last three years. Since number of trading days might differ over years, and also for different stocks, when new firms enter and/or some existing firms drop, the computations will differ for each id over the same period. Thus, I want to specify a 3-year range for each id over the trading days during the last three years (13Apr2016 to 12Apr2019).
I am not sure how to specify the rolling window for each id’s non-missing obs in the interval part of rangestat syntax:
rangestat (count) price, interval(date -xx 0) by(id)
I have been trying to find some guidance available online but I have not been able to find clear guidance since most intervals are illustrated within a few trading days, such as 3, 5, and 90) window.
Any guidance will be sincerely appreciated!
Thanks for reading.
Kind regards,
Manish
Related Posts with Seeking guidance for the interval specification of rangestat command
combining datasets with different formats of a variable and ts valuesI have a dataset that includes information on naic codes, years, the quarter of those years in the f…
Vuong test for hedonic price model - RegressionHi all, I am trying to estimate a hedonic price model. The first step used is estimating the Box Cox…
Drop if ALL specified variables fulfill a certain conditionDear statalist, is there a way to write the following command Code: drop if intention1==9 & i…
Calculation of mean for each industry quarter using egen, any quicker way!!Dear Statalist members, My dataset is something like this Code: * Example generated by -dataex-.…
regression with time trendHi everyone, I have pooled cross-sectional dataset for 2009,2011,2012,2014 and 2017. I am trying to…
Subscribe to:
Post Comments (Atom)
0 Response to Seeking guidance for the interval specification of rangestat command
Post a Comment