I have a matrix A , what i want to do is if each factor is greater than 65, then matrix B= (factor65), else factor returns 0.
I tried to create a new matrix S full of 65(same dimension as matrix A) and using code
matrix new_A = (A>65)*(A65)+(A<=65)*0
However, it returns a matrix full of 0(@recode can't be used in matrix calculations).
Thank you!!!
Similar question to previous post, except it is a matrix.
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11875
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Similar question to previous post, except it is a matrix.
When you say "factor" do you mean element?
If so, you can use a couple of for loops to loop through the matrix element by element:
If so, you can use a couple of for loops to loop through the matrix element by element:
Code: Select all
matrix new_a = a65
for !i=1 to @rows(a)
for !j=1 to @columns(a)
if a(!i,!j)<=65 then
new_a(!i,!j) = 0
endif
next
next
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 15 guests