Save result matrix after Loop as .txt

For questions regarding programming in the EViews programming language.

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

Paula1983
Posts: 2
Joined: Wed Apr 02, 2014 1:35 am

Save result matrix after Loop as .txt

Postby Paula1983 » Wed Apr 02, 2014 1:43 am

Hi everyone!
I have a question concerning my program:
I have data on 4 time series covering half a year. For every day, I load the data into EViews and perform an error correction analysis extracting the error correction parameters, the var-cov matrix and the cointegration matrix (I have 3 cointegration relations).
I loop over every day and within each day, I have to take into consideration the different ordering possibilities of the time series. With 4 time series, I have 24 permutations. So I loop over every permutation possibility within each day.

So basically, this looks as follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for !year_i =2007 to 2007
for !month_i = 7 to 12
for !day_i = 2 to 31

for !permut = 1 to perm_numb ' where perm_numb is the total number of permutations (=24)

'''''''''''''''' within this loop I calculate a matrix A (1 x 4) that describes the speed of adjustment of every time series
'''''''''''''''' in order to have a matrix that gathers all the adjustment parameters for one day each for every permutation B (24 x 4) I do the following:
matrix(perm_numb,4) B

B(!permut,first) = A(1)
B(!permut,second) = A(2)
B(!permut,third) = A(3)
B(!permut,fourth) = A(4)


next 'relates to the next permutation


next 'next day
next ' next month
next ' next year

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This works all very well and I get the matrix I want with plausible results so it's not about the program itself. My problem is that after performing the analysis, I want to save the matrix B for each day separately as a .txt file so that I can use it for next steps in Matlab. However, after saving the workfile for each day (where B is included), my attempts to save the matrix B as a .txt file failed.

Does anyone of you have an idea for the solution of this problem? I cannot proceed without saving the matrix this way...
Thanks in advance!!

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Save result matrix after Loop as .txt

Postby EViews Glenn » Wed Apr 02, 2014 7:13 am

You don't say how you tried to save the matrix. Try matrix_name.write (look in the docs under the write proc for matrices).

Paula1983
Posts: 2
Joined: Wed Apr 02, 2014 1:35 am

Re: Save result matrix after Loop as .txt

Postby Paula1983 » Wed Apr 02, 2014 11:51 pm

matrix.write worked! thanks a lot!!!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests