Creating New Series using conditional

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Jason, EViews Moderator, EViews Pamela

Ricardo98
Posts: 14
Joined: Tue Jun 20, 2017 12:49 pm

Creating New Series using conditional

Postby Ricardo98 » Wed Jun 21, 2017 11:09 am

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!

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

Re: Creating New Series using conditional

Postby EViews Gareth » Wed Jun 21, 2017 11:11 am

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).
Follow us on Twitter @IHSEViews

Ricardo98
Posts: 14
Joined: Tue Jun 20, 2017 12:49 pm

Re: Creating New Series using conditional

Postby Ricardo98 » Wed Jun 21, 2017 1:41 pm

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!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests