Hi,
I'm trying to fetch a list of dates from a database. It automatically gets put into a time series format. Is it possible to program it so that I fetch a series from the database as maybe a text file, and then format the way the dates appear (e.g. yyyymmdd instead of yyyy-mm-dd)?
Thanks!
Fetching non time series data in a time series program
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
miorinnovo
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fetching non time series data in a time series program
Series can only be fetched as series. You can reformat the series into any display format you want, of course.
-
miorinnovo
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: Fetching non time series data in a time series program
What i want to do is take each observation in one series and append them, in the format yyyymmdd, to the end of the same number and fetch all of those. Is that something that can be programmed?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fetching non time series data in a time series program
I don't follow exactly what you're doing, but I'm pretty sure it could be programmed.
-
miorinnovo
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: Fetching non time series data in a time series program
Its pretty much this:
step 1- fetch series of dates
step 2 - add each of those dates to the same word xyz so i get xyz_date1 xyz_date 2, where the dates are in the format 'yyymmdd'
step 3 - fetch that new list
step 1- fetch series of dates
step 2 - add each of those dates to the same word xyz so i get xyz_date1 xyz_date 2, where the dates are in the format 'yyymmdd'
step 3 - fetch that new list
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fetching non time series data in a time series program
So fetch into a series, use the @datestr function to create an alpha series containing the text you want, then loop over the elements of that alpha series fetching each new one.
Code: Select all
fetch mydateseries
alpha names = "xyz_" + @datestr(mydateseries, "yyyymmdd")
for !i=1 to @obsrange
%name = names(!i)
fetch {%name}
next
-
miorinnovo
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: Fetching non time series data in a time series program
Thanks, this is almost working. The only issue is that it skips zeros in the month and day. So if the date is 2008-05-04 it will say 200854 instead of 20080504, and not eb able to find the series in the fetch. Any idea how to fix that?
Thanks again
Thanks again
Who is online
Users browsing this forum: No registered users and 2 guests
