Page 1 of 1

Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:10 am
by miorinnovo
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!

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:14 am
by EViews Gareth
Series can only be fetched as series. You can reformat the series into any display format you want, of course.

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:17 am
by miorinnovo
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?

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:30 am
by EViews Gareth
I don't follow exactly what you're doing, but I'm pretty sure it could be programmed.

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:42 am
by miorinnovo
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

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 9:46 am
by EViews Gareth
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

Re: Fetching non time series data in a time series program

Posted: Fri Jun 26, 2015 10:04 am
by miorinnovo
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