Creating a new yearly series
Creating a new yearly series
Hello,
I have daily interest rate data for 35 years. I want to create a new series that simply takes numbers from 1 to 35 corresponding to the years in the original series. I can use "set year = %year(t)", but that gives me the original years such as1973,1974 etc. I want to replace the years with numbers 1, 2,.....
Any help would be appreciated.
Sajjadur.
I have daily interest rate data for 35 years. I want to create a new series that simply takes numbers from 1 to 35 corresponding to the years in the original series. I can use "set year = %year(t)", but that gives me the original years such as1973,1974 etc. I want to replace the years with numbers 1, 2,.....
Any help would be appreciated.
Sajjadur.
Re: Creating a new yearly series
In the specific case,
set year = %year(t)-1972
If you want to be more flexible:
set year = %year(t)-%year(1)+1
which will base the year number off the initial year (%year(1))
set year = %year(t)-1972
If you want to be more flexible:
set year = %year(t)-%year(1)+1
which will base the year number off the initial year (%year(1))
Re: Creating a new yearly series
Thanks for your help.
Sajjadur
Sajjadur
Re: Creating a new yearly series
Hello, Just a quick follow up regarding my earlier inquiry.
When I use
set year = %year(t)-%year(1)+1
I find a number of missing data points indicated as NA. How to avoid those missing data points?
I have attached the file here.
Thanks.
Sincerely,
Sajjadur.
When I use
set year = %year(t)-%year(1)+1
I find a number of missing data points indicated as NA. How to avoid those missing data points?
I have attached the file here.
Thanks.
Sincerely,
Sajjadur.
- Attachments
-
- Oil_price.xls
- (712 KiB) Downloaded 761 times
Re: Creating a new yearly series
You have daily data with gaps for holidays. If you read that as dated daily data, it will insert NA's to make the data a regular five-day-a-week series. See Section 2.6 in the Introduction for ways to handle this. Probably the simplest thing in your case is to add the YEAR variable to the original data set (which uses an Excel expression almost identical to the SET instruction) and read the data set as undated.