Page 1 of 1

how to Change Data Frequencies (daily to monthly)

Posted: Sat Jan 18, 2025 10:28 am
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

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

Posted: Sat Jan 18, 2025 1:44 pm
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

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

Posted: Mon Jan 20, 2025 2:07 am
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

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

Posted: Mon Jan 20, 2025 2:00 pm
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

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

Posted: Tue Jan 21, 2025 2:26 am
by hardmann
Thanks again.

Best Regard
Hardmann