Rounding a scalar to the nearest whole number (eviews 7)

For questions regarding programming in the EViews programming language.

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

mike_d
Posts: 17
Joined: Thu Feb 09, 2012 7:52 am

Rounding a scalar to the nearest whole number (eviews 7)

Postby mike_d » Thu Feb 23, 2012 8:58 am

Hi,

I have a loop that fills a vector with scalar values from a pre-estimated table (5 values in total). Then what I would like to do is to take an average of these 5 values to use in a formula later on. However the formula requires that the inputted value be a whole number. Therefore I would like the scalar to be rounded to the nearest whole number. I will post what I have below, but I have not been able to find a method rounding. Any suggestions are greatly appreciated.

for !g = 9 to 14
scalar c!g
vector(5) cc!g
for !h = 1 to 5
cc!g(!h) = @val(coint_test!g(13,!h+1))
next !h
scalar c!g = @mean(cc!g)
next !g

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

Re: Rounding a scalar to the nearest whole number (eviews 7)

Postby EViews Gareth » Thu Feb 23, 2012 9:00 am

Code: Select all

c!g = @round(c!g)

mike_d
Posts: 17
Joined: Thu Feb 09, 2012 7:52 am

Re: Rounding a scalar to the nearest whole number (eviews 7)

Postby mike_d » Thu Feb 23, 2012 9:03 am

Thank you Gareth!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests