Page 1 of 1

Exporting dates to xlsx?

Posted: Fri Apr 05, 2013 6:13 am
by paues
Is it possible in EViews 8 to export dates to xlsx files alongside data? And is it possible to export dates only? And is it possible to stop the series names from being exported with the data? Now, I can get the command to export data only with the command below.

Code: Select all

wfsave(t=excelxml, mode=update, noid) MyFile.xlsx nonames range="Sheet1!B5" byrow @keep segdp dkgdp nogdp figdp isgdp @smpl 2000 2012
However, I would like to pick and choose. That is, I would like to be able to whether or not data, dates and series names should be included in the export.

Re: Exporting dates to xlsx?

Posted: Fri Apr 05, 2013 10:24 am
by EViews Chris
Could you be a bit more specific?

The 'noid' and 'nonames' options in your command will suppress the extra header row/col containing the ids (dates) and series names at the edges of the table you are writing. You can use any combination of the options to switch off one, both or neither of these.

We don't currently allow you to switch the headers on and off on a series by series basis. You could do something like this by splitting the operation into multiple commands, where each command wrote out part of the data (using the @keep statement). You could then choose to have or not have headers on each section that you write.

To write only a column of observation dates, you could use '@keep @date' or '@keep @enddate' to specify a series containing the start or end dates of each observation in the workfile (using the 'noids' option to suppress an additional column of dates).

Some of this is a bit fussy, which largely comes from the fact that many of the other formats we write to are much more heavily structured and require column names attached to every column we write (relational databases, formats of all other statistics packages, etc.). We should probably loosen things up a bit for cases like excel and text files where an empty column name is feasible.

There's a totally different issue that I wondered whether you might be refering to, which is that when we update an existing Excel file, the dates will show up as numbers unless the cells in the Excel file have already been set to have a date format. What's going on here is that although we are passing dates across to the Excel application (which performs the actual update on the file) it simply treats it as a number - I assume because it doesn't want to change the formatting of the cell just because the value being assigned to it is a date. We could possibly add an option here that would say 'always override existing formats when writing dates' which would then let us force our own date format onto these cells so that they would always display as dates within Excel, but at the moment we don't adjust any formatting information during an update operation.

Re: Exporting dates to xlsx?

Posted: Fri Apr 05, 2013 1:28 pm
by paues
Thank you for your extensive answer! And please excuse my vague question. (I was planning to ask a different question originally, but changed my mind mid-writing, leaving traces of the initial questions in the text.)

Your '@keep @date' pointer solved my problem (together with the arguments 'noid' and 'nonames' which I already knew).

However, I have been able to pinpoint the problem I was originally planning to write about: I would expect these two chunks to generate two identical exports to the sheets Sheet1 and Sheet2. However, Sheet1 gets dates and data while Sheet2 gets only data. The problem seems to stem from the pagecontract command, but I cannot figure out why and how to solve it.

Code: Select all

close @all wfcreate q 1980 2013 smpl 1980 2010 series segdp=1 smpl @all wfsave(t=excelxml) k:\Stab\testQ.xlsx range="Sheet1!B5" byrow @keep segdp group alla * pagecontract if @robs(alla)>0 smpl @all wfsave(t=excelxml,mode=update) k:\Stab\testQ.xlsx range="Sheet2!B5" byrow @keep segdp

Re: Exporting dates to xlsx?

Posted: Fri Apr 05, 2013 3:58 pm
by EViews Chris
OK. I see what is going on. We'll fix this in the next patch that goes out. (Not the patch that that just went out today though).

There's some code in EViews that tries to prevent multiple copies of the series containing observation dates building up in your page if you import and export the same file a few times in a row. (Caused by writing both a series containing the observation dates *and* the column of observation dates in a separate header).

It wasn't correctly handling the case where you're selecting a limited set of columns to write using an @keep statement.

For what it's worth, deleting the series 'obsid' that is popping up in the workfile after the pagecontract command will make the problem 'go away' in your example.

Re: Exporting dates to xlsx?

Posted: Tue Apr 09, 2013 12:28 am
by paues
Thank you for the tip about deleting the series obsid! Two related issues: is it possible to export only

(1) ...series names?
(2) ...series labels?

Re: Exporting dates to xlsx?

Posted: Mon Apr 15, 2013 6:07 am
by johansamuelsson
How about this question, i.e. exporting names or/and labels?

Regards Johan

Re: Exporting dates to xlsx?

Posted: Mon Apr 15, 2013 8:03 am
by EViews Gareth
Not currently.

Re: Exporting dates to xlsx?

Posted: Thu Dec 19, 2013 5:05 am
by shm83
and is it possible to export a series (alphaseries) to a text file without quotes and without the alphaseries names??


Being SeriesAlpha1 my alpha series

Code: Select all

save(type=text) "D:\Exit1.txt" @keep SeriesAlpha1 write(t=txt, nonames) d:\Exit2.txt SeriesAlpha1
I get
"Pre('1') = 1"
"Pre('2') = 7"
"Pre('3') = 6"
"Pre('4') = 5"
"Pre('5') = 4"
or
SeriesAlpha1
Pre('1') = 1
Pre('2') = 7
Pre('3') = 6
Pre('4') = 5
Pre('5') = 4
respectively. What I would like is a file containing the content of the series without quotes (as the second one) but withot the name of the alphaseries.

Thank you in advance

Re: Exporting dates to xlsx?

Posted: Thu Dec 19, 2013 8:46 am
by EViews Gareth

Code: Select all

wfsave(type=text) myfile.txt nonames @keep seriesalpha1