Ah I got it sorry. I forgot to put !n instead of 1 for the columns in the second loop:
matrix x=@ones(101, 77)
For !n=1 to @columns(x)
For !m=2 to @rows(x)
x(!m,!n)=x(!m-1,!n)*(1-deathprob_1yr(!m-1,!n))
next
next
Thanks again Gareth
Search found 5 matches
- Wed May 18, 2011 5:27 pm
- Forum: Programming
- Topic: loops to fill a matrix
- Replies: 3
- Views: 5102
- Wed May 18, 2011 5:21 pm
- Forum: Programming
- Topic: loops to fill a matrix
- Replies: 3
- Views: 5102
Re: loops to fill a matrix
Thanks Gareth that works very well. I just had to fill x with ones first, otherwise the vector fills with zeros. Regarding the greater loop, i turned x into a matrix and did as you said and every other column just filled with ones. The code is: matrix x=@ones(101, 77) For !n=1 to @columns(x) For !m=...
- Tue May 17, 2011 11:15 pm
- Forum: Programming
- Topic: loops to fill a matrix
- Replies: 3
- Views: 5102
loops to fill a matrix
Hi, I have another coding issue. I would like to fill a matrix using a for loop so that each cell in a column is equal to the value of the cell above it multiplied by (1 - the value of the cell above the corresponding cell in another matrix). Therefore, using microsoft excel to demonstrate, B2 = B1*...
- Tue May 17, 2011 4:03 pm
- Forum: Programming
- Topic: vector to series
- Replies: 2
- Views: 5137
Re: vector to series
Thankyou, worked a treat.
- Tue May 17, 2011 12:25 am
- Forum: Programming
- Topic: vector to series
- Replies: 2
- Views: 5137
vector to series
Hi, I'm new to programming in EViews and I'm having trouble generating a series from a vector. I have been trying along the lines of: "series kt_norm_series = kt_normalised" where kt_normalised is the vector. When I do that it says "Illegal lag or index specification for vector KT_NOR...
