Page 1 of 1

Zero disappears with round

Posted: Tue Jun 26, 2018 4:21 am
by pelleenglund
Hi,

I wonder if there is a way that I can get the zero to show upp when using @round with one decimal? To illustrate what I mean, this code will prompt up 2, but I would like 2.0.

!i = 2.04
!j = @round(!i, 1)
@uiprompt(@str(!j))

Best regards,
Pelle

Re: Zero disappears with round

Posted: Tue Jun 26, 2018 8:58 am
by EViews Matt
Hello,

You can use the optional second argument to @str to specify a format for the resulting string, including how may digits should appear to the right of the decimal point. I believe what you're asking for is accomplished with @str(!j, "f.1").

Re: Zero disappears with round

Posted: Wed Jun 27, 2018 12:16 am
by pelleenglund
Oh missed that argument, thanks a lot!