Page 1 of 1

Copy lag problem

Posted: Mon Mar 21, 2011 9:00 pm
by jim.savage
Hi there,

I have a small problem with the pagecopy command. I am opening a sequence of .wk1 files using the wfopen command, then copying their contents to a workfile called comparison_1. However, all series are jumping forward one period once I apply the copy command. I have checked the series in each of the wk1 files after they had been wfopen-ed, and the lag problem does not exist at that stage--it is entirely induced when I apply the copy command.

I am using Eviews 7.1 Entrerprise, with the latest patch installed.

All the best,
Jim

Code: Select all

wfcreate comparison_1 q 1959:3 2010:4 for %for 5206A10D 5206B10D 5206C10D 5206hist 5302A10D 5302B10D 5302hist 6354A10D 562510D cap_curr cap_hst1 cap_hst2 chain MDB1210 MONEY10D nfc WCID10D %forwk1 = %for + ".wk1" wfopen %forwk1 copy * "comparison_1":: %forwf1 = %for + ".wf1" close %forwf1 next

Pagecopy lag problem

Posted: Mon Mar 21, 2011 9:05 pm
by EViews Gareth
Could you provide an example workfile that exhibits the problem?

Re: Pagecopy lag problem

Posted: Mon Mar 21, 2011 9:42 pm
by jim.savage
Hi Gareth,

I have attached a small programme and wk1 file to demonstrate the problem.

Best,
Jim

Re: Pagecopy lag problem

Posted: Mon Mar 21, 2011 9:46 pm
by jim.savage
Also-- sorry, I named the post wrong. It should be "copy lag problem"

Re: Copy lag problem

Posted: Tue Mar 22, 2011 9:18 am
by EViews Gareth
The problem is that the dates in your original file are funny. EViews is reading the original file as Quarterly, but the first date is March 01 1948. Thus EViews assumes that quarters run:
  • March 01 - May 31
  • June 01 - August 31
  • September 01 - November 30
  • December 01 - February 28/29
Then you ask it to copy into a standard quarterly. EViews takes a best guess at this and says that data in the period Sep-Nov mostly covers a standard Quarter 4 (October-December), so puts it in there.

Possibly the easiest way to correct this (if you believe it should be corrected) is to change your wfopen command to force the frequency to be standard quarterly:

Code: Select all

wfopen 5206a10d.wk1 @freq q 1948:1

Re: Copy lag problem

Posted: Tue Mar 22, 2011 2:55 pm
by jim.savage
Many thanks!

Re: Copy lag problem

Posted: Tue Apr 12, 2011 4:31 pm
by jim.savage
I thought I'd post my solution to the problem. I'm sure there are likely more parsimonious ways to do it, but this works nicely:

Code: Select all

for %for 5206A10D 5206B10D 5206C10D 5206hist 5302A10D 5302B10D 5302hist 6354A10D 562510D cap_curr cap_hst1 cap_hst2 chain MDB1210 MONEY10D nfc WCID10D %forwk1 = %for + ".wk1" ' Creates a string containing the names of the WK1 files to open wfopen %forwk1 ' Opens each as a workfile, whose structure is taken from the tarket wk1 file %firstdate = @otod(1) ' Creates a date in string form of the first date in the opened wk1 file !date = @dateval(%firstdate) ' Turns the first date into a date number !year = @datepart(!date, "YYYY") ' Creates a 4-digit number containing the year !month = @datepart(!date, "MM") ' Creates a 2-digi number containing the month !quarter = @ceiling(!month/3) ' Creates a 2-digit number containing the quarter, by rounding up the month/3 (it will extract the wrong quarter because of the dating problem) %forwf1 = %for + ".wf1" ' Creates a new string close %forwf1 ' Closes the open workfile wfopen %forwk1 @freq q !year:!quarter ' Opens the same workfile, but providing structure about how to interpret the dates; vary the !year:!quarter bit if you're using different freq copy * "comparison_1":: ' Copies all series across to comparison_1.wf1 %forwf1 = %for + ".wf1" ' Closes the wk1 file that has been opened as a wf1 file. close %forwf1 next