summing available daily observations to monthly
summing available daily observations to monthly
Following other work in a literature, I would like to read in data that are daily at a limited number of dates (these come from an event study approach to constructing monetary policy shocks) to create monthly series that sum the available observations within a month and contains zeros for months with no higher frequency source observations. Consistent with what the reference manual describes, using a monthly calendar with compact=sum does not deliver this outcome (among other issues, it repeats observations across months). Is there some other way to do it? I have attached the source data in question along with a compact=sum approach that does not work as desired. Thanks much.
- Attachments
-
- MPshocks.xlsx
- (17.53 KiB) Downloaded 70 times
-
- test.prg
- (227 Bytes) Downloaded 72 times
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Economic Research Dept.
Federal Reserve Bank of Cleveland
Re: summing available daily observations to monthly
RATS tries to guess the date scheme in the input data and (here) doesn't do a very good job of it. However, it will work if you force it to recognize the input data as daily:
Note that you'll get NA's for any month with no data, but that will be easy to patch over.
Code: Select all
cal(d,save=forcedaily) 1990:1:1
cal(m) 1990:1
comp stsmpl=1990:1, endsmpl=2019:12
all endsmpl
smpl stsmpl endsmpl
open data MPshocks.xlsx
data(format=xlsx,org=col,compact=sum,calendar=forcedaily) / FFRfactor FGfactor LSAPfactor
close data
Re: summing available daily observations to monthly
Fantastic -- thanks very much!
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Economic Research Dept.
Federal Reserve Bank of Cleveland