Page 1 of 1

How do I read in daily data with gaps and missing data?

Posted: Tue Sep 08, 2015 2:05 pm
by macro
I have an Excel spreadsheet (example.xlsx) that contains daily data for certain dates. My goal is to read the series into a daily time series, with only the dates that have data in the file filled in. All other values should be missing, since there isn't any data for those dates in the file. Using this code

Code: Select all

calendar(d) 1999:01:01
allocate 50 2020:01:01

open data example.xlsx
    data(format = xlsx, org = columns, nolabels, sheet = "ffr", top = 2) / s13 s14
close data

print / s13 s14
I get this output

Code: Select all

  ENTRY           S13             S14
 2010:12:20          1               3
 2010:12:21          1               3
 2010:12:22          1               3
 2010:12:23          1               3
 2010:12:24          1               3
 2010:12:27          1               3
 2010:12:28          1               3
 2010:12:29          1               3
 2010:12:30          1               3
 2010:12:31          1               3
 2011:01:03        NA              NA
 2011:01:04          2               4
 2011:01:05          2               4
 2011:01:06          2               4
 2011:01:07          2               4
 2011:01:10          2               4
 2011:01:11          2               4
 2011:01:12          2               4
 2011:01:13          2               4
 2011:01:14          2               4
 2011:01:17          2               4
which doesn't look right at all. The output should only have data for the two dates in the file, and no others. Is there an option I'm missing?

Re: How do I read in daily data with gaps and missing data?

Posted: Tue Sep 08, 2015 2:23 pm
by TomDoan
With just two (widely separated) data points, there is no way the DATA instruction can tell that you intend it to be daily---the best guess is that it's biweekly, so it expands out the biweekly numbers to the covered dates.

Re: How do I read in daily data with gaps and missing data?

Posted: Tue Sep 08, 2015 2:42 pm
by macro
That makes sense. I'm assuming there isn't a way to force RATS to read the data as daily, instead of having the DATA instruction infer it?