IF statement with series' elements

For questions regarding programming in the EViews programming language.

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

recoba20
Posts: 3
Joined: Tue May 08, 2012 12:56 am

IF statement with series' elements

Postby recoba20 » Tue May 08, 2012 1:09 am

Hello,
I have a question about "if statement". When I write the following program (see below), Eviews compare the series and not each element of the series. Do you know how should I modify the program to achieve what I want? Thanks a lot!


series test1
test1= variable1 + variable1bis

series test2
test2 = variable2

series test3
if test1 > test2 then
test3 = test1
else test3 = test2
endif

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

Re: IF statement with series' elements

Postby EViews Gareth » Tue May 08, 2012 6:26 am


recoba20
Posts: 3
Joined: Tue May 08, 2012 12:56 am

Re: IF statement with series' elements

Postby recoba20 » Tue May 08, 2012 6:39 am

I have checked the link but what I want to do is different

actually I want to generate a serie C which is composed with the maximum of either serie A or serie B as shown below

serie A is
1
65

serie B is
200
2

I would like to automatically generate serie C
200
65

my series A and B have 7000 lines, that is why I want to make it automatically.

Hope you can help me, thanks a lot!

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

Re: IF statement with series' elements

Postby EViews Gareth » Tue May 08, 2012 7:45 am

You can use the information in that link to do that. Either with a smpl statement, or with a recode.

recoba20
Posts: 3
Joined: Tue May 08, 2012 12:56 am

Re: IF statement with series' elements

Postby recoba20 » Wed May 09, 2012 11:47 pm

@recode works pretty well, thanks a lot!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests