Transpose matrix & export to excel

For questions regarding programming in the EViews programming language.

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

dhityayl
Posts: 14
Joined: Sun Aug 26, 2018 10:29 pm

Transpose matrix & export to excel

Hi.
So i have 1300 csv data that i want to regress using rolling regression (with for loop). So I manage to do the loop programming, but the result comes in matrix (5,@nrolls). I want to transpose the matrix so it will be (@nrolls,5). After that, i want to change the matrix into series, so i can save as it all to excel.
Does anyone have the solution for this problem? Below is the eviews programming that i'm working at so far.
Thankyou!

cd "c:\Users\Dhitya\Desktop\Program\dataset"
%filenames = @wdir("c:\Users\Dhitya\Desktop\Program\dataset")
for !k=1 to @wcount(%filenames)
%file = @word(%filenames, !k)
wfopen %file
import c:\Users\Dhitya\Desktop\Program\dataset\index\Indeks_2002.csv
import c:\Users\Dhitya\Desktop\Program\dataset\index\FF3_2002.csv
!window = 60
!step = 1
!length = @obsrange
equation eq1
!nrolls = @round((!length-!window)/!step)
matrix(5,!nrolls) coefmat!k
!j=0
for !i = 1 to !length-!window+1-!step step !step
!j=!j+1
smpl @first+!i-1 @first+!i+!window-2
genr return=(((close-close(-1))/close(-1))*100)-rf
equation eq1.ls return c indeks mkt_rf smb hml
colplace(coefmat!k, eq1.@coefs,!j)
next
next

EViews Jason
EViews Developer
Posts: 717
Joined: Tue Sep 16, 2008 3:50 pm