Hello,
I have already working for several hours to run if statement on Eviews 6.
My program is as follow, however, vector cc don't have any signal. Pls someone kindly tell me which line should be corrected. Many many thanks.
vector aa = @columnextract(mvmatrix1,1)
vector bb = @columnextract(mvmatrix1,2)
vector(@obs(aa)) cc
if aa>bb then
vector cc = "Buy"
elseif aa<bb then
vector bb = "Sell"
endif
endif
How to compare two vectors?
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
How to compare two vectors?
You'll have to write a loop to go through the elements one at a time.
-
nick3000kimo
- Posts: 2
- Joined: Tue Aug 21, 2012 8:38 pm
Re: How to compare two vectors?
Hello:
Could you please kindly provide a example? Sorry, I don't get it.
Many thanks.
Could you please kindly provide a example? Sorry, I don't get it.
Many thanks.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to compare two vectors?
Code: Select all
vector aa = @columnextract(mvmatrix1,1)
vector bb = @columnextract(mvmatrix1,2)
vector(@obs(aa)) cc
for !i=1 to @rows(cc)
if aa(!i)>bb(!) then
cc(!i) = 1
endif
if aa(!i)<bb(!i) then
cc(!i) = 0
endif
next
Who is online
Users browsing this forum: No registered users and 2 guests
