Fetching non time series data in a time series program

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Fetching non time series data in a time series program

Postby miorinnovo » Fri Jun 26, 2015 9:10 am

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!

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

Postby EViews Gareth » Fri Jun 26, 2015 9:14 am

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

Postby miorinnovo » Fri Jun 26, 2015 9:17 am

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

Postby EViews Gareth » Fri Jun 26, 2015 9:30 am

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

Postby miorinnovo » Fri Jun 26, 2015 9:42 am

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

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

Postby EViews Gareth » Fri Jun 26, 2015 9:46 am

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

Postby miorinnovo » Fri Jun 26, 2015 10:04 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest