distinguish odd /even numbers

For questions regarding programming in the EViews programming language.

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

Katjes
Posts: 58
Joined: Thu Oct 02, 2008 5:46 am

distinguish odd /even numbers

Postby Katjes » Mon Nov 22, 2010 10:17 am

Using EViews 7, I would like to use different commands according to whether the sample size is odd or even;
is there a specific command that looks to this issue or you have already a nice solution ;o)

sample 2000q1 2010q1+!step
!length=@obssmpl
if !length=EVEN then ...
else (if ODD) ..
endif

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

Re: distinguish odd /even numbers

Postby EViews Gareth » Mon Nov 22, 2010 10:30 am

Code: Select all

if @mod(!length,2) = 0 then
will test for EVEN. Set it equal to 1 for ODD.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests