Page 1 of 1

Creating New Series using conditional

Posted: Wed Jun 21, 2017 11:09 am
by Ricardo98
Hi there,

I would like to create a new series from an existing one called "airtemp". Im trying to get a (airtemp-24)^2 result when the value in "airtemp" exceeds 24; a (16-airtemp)^2 result when the value in "airtemp" is below 16 and "0" otherwise. But the following command is giving me back "Sytax error". Is there anyone that could spot the mistake?

smpl @all
alpha decision=0

smpl if airtemp>24
decision = (airtemp-24)^2

smpl if airtemp<16
decision = (16-airtemp)^2

smpl @all

Thanks so much in advance!

Re: Creating New Series using conditional

Posted: Wed Jun 21, 2017 11:11 am
by EViews Gareth
You're declaring it as an alpha (which contains strings) and setting it equal to a number.

Either use series instead of alpha, or change the values to be strings (with the @str function).

Re: Creating New Series using conditional

Posted: Wed Jun 21, 2017 1:41 pm
by Ricardo98
EViews Gareth wrote:You're declaring it as an alpha (which contains strings) and setting it equal to a number.

Either use series instead of alpha, or change the values to be strings (with the @str function).


Hi Gareth,

All done thanks!