Page 1 of 1
Creating a new yearly series
Posted: Mon Jan 05, 2015 1:10 pm
by msrahman
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.
Re: Creating a new yearly series
Posted: Mon Jan 05, 2015 1:41 pm
by TomDoan
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))
Re: Creating a new yearly series
Posted: Mon Jan 05, 2015 3:29 pm
by msrahman
Thanks for your help.
Sajjadur
Re: Creating a new yearly series
Posted: Mon Jan 05, 2015 4:24 pm
by msrahman
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.
Re: Creating a new yearly series
Posted: Tue Jan 06, 2015 10:19 am
by TomDoan
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.