how to Change Data Frequencies (daily to monthly)

For questions and discussion related to reading in and working with data.
hardmann
Posts: 218
Joined: Sat Feb 26, 2011 9:49 pm

how to Change Data Frequencies (daily to monthly)

Unread post by hardmann »

Dear Tom:

we read daily oil price data from online FRED, we want montly average of these. I read 2.5 Change Data Frequencies, Introduction of RATS. I do not know how to specify the compact=average.
my codes as follows.

Code: Select all

cal(d) 2000:01:01
data(format=fred) /    DCOILBRENTEU
Best Regard
Hardmann
PeterF
Posts: 57
Joined: Thu Apr 12, 2012 2:03 pm

Re: how to Change Data Frequencies (daily to monthly)

Unread post by PeterF »

Dear Hardmann,

these two lines should provide you with the requested oil prices from the FRED database.

cal(m) 2000:01:01
data(format=fred,compact=average) / DCOILBRENTEU

Best regards
PeterF
hardmann
Posts: 218
Joined: Sat Feb 26, 2011 9:49 pm

Re: how to Change Data Frequencies (daily to monthly)

Unread post by hardmann »

Thanks.

It calculated the average of past months, but did not calculate the current month. I want to get the average daily data from the first day of the month to the current day, even though the month has not yet ended, such as January 20th. I need to do daily estimation and calculate the average within incompleltily month.

Best Regard
Hardmann
PeterF
Posts: 57
Joined: Thu Apr 12, 2012 2:03 pm

Re: how to Change Data Frequencies (daily to monthly)

Unread post by PeterF »

You just need to make a small modification of the code. For example, if you change the second line to

data(format=fred,compact=average) 2000:1 2025:1 DCOILBRENTEU

RATS calculates also the average for January of this year. I tested it after downloading the daily data into Excel. However, FRED data is updated with a lag. Today, the latest value available was for January 13.

Best regards
PeterF
hardmann
Posts: 218
Joined: Sat Feb 26, 2011 9:49 pm

Re: how to Change Data Frequencies (daily to monthly)

Unread post by hardmann »

Thanks again.

Best Regard
Hardmann
Post Reply