store series into a matrix

For questions regarding programming in the EViews programming language.

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

davidphilipp
Posts: 4
Joined: Mon Sep 06, 2010 3:59 am

store series into a matrix

Postby davidphilipp » Wed Sep 29, 2010 4:43 am

Hi,

I have 19 time series of evolving lenght for each of my variables. Therefore I created strings for each one.

Now, for the first round, I need to store only the last observation of each time series into a vector/matrix. The time series grow by one quarter each.

matrix(19,1) f_pez_1
.....
%first="1970:1" 'FIRST OBSERVATION OF THE ESTIMATION SAMPLE
smpl @all
!base=138 ' number of observations in first vintage

for !j = 1 to 19 ' start loop to estimate model

if !j<10 then %th="0" ' add 0 to string for j<10
else %th=""
endif

%x1="a_pez_" +%th +@str(!j)+"_0_1" ' create vintage specific labels
%x2="a_pus_" +%th+@str(!j)+"_0_1"
%y1="a_yez_" +%th+ @str(!j)+"_0_1"
%y2="a_yus_" +%th+ @str(!j)+"_0_1"
%h1="a_hez_" +%th+ @str(!j)+"_0_1"
%h2="a_hus_" +%th+ @str(!j)+"_0_1"
'%poil = "poil"
%e = "a_exch_"+%th+ @str(!j)+"_0_1"

smpl @first+!base+!j @first+!base+!j+1
f_pez_1(!j,1) = {%x1} <------ THE PROBLEM COMES UP HERE


next


I always get "NON NUMERIC ARGUMENT A_PEZ_01_0_1 in 'F_PEZ_1(1,1) = A_PEZ_01_0_1
A_PEZ_01_0_1 is a time series.

Eviews6

Hope to get an answer.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: store series into a matrix

Postby EViews Gareth » Wed Sep 29, 2010 8:00 am

You can't store a series into a single cell of a matrix. You'll have to capture the scalar value you want from the series, then put that into the matrix. Something like:

Code: Select all

!temp = @max({%x1}) f_pez_1(!j,1) = !temp

davidphilipp
Posts: 4
Joined: Mon Sep 06, 2010 3:59 am

Re: store series into a matrix

Postby davidphilipp » Tue Oct 05, 2010 3:05 am

thanks a lot!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests