Page 1 of 1
Manipulating data in series
Posted: Sat Jun 11, 2011 11:14 am
by rogierhanselaar
Hi there,
My question is two-fold: I have different series with large amounts of data, and (1) I want to put these through a formula. However, this formula has a certain domain; (2) only the values in its domain are to be entered in the formula, while the values lower than the domain are to be set to 0 and the values higher than the domain are to be set to 11. Can someone provide me with some guidance on how to achieve this? I'd much appreciate it.
Best,
Rogier
Re: Manipulating data in series
Posted: Sat Jun 11, 2011 11:17 am
by startz
Take a look at the smpl if command. It controls which observations are operated on.
Re: Manipulating data in series
Posted: Sat Jun 11, 2011 11:57 am
by rogierhanselaar
I think I've found the button you mentioned. How can i proceed from here?
I want to have each value from the series transformed according to the formula "newvalue = -119 +21*oldvalue^2 -34*oldvalue" if it lies within the interval [3,11]. For the values smaller than 3 I'd like them to become 0 and for the values larger than 11 I'd like them to become 11.
Re: Manipulating data in series
Posted: Sat Jun 11, 2011 12:06 pm
by startz
By "it" do you mean "newvalue" or "oldvalue?"
Re: Manipulating data in series
Posted: Sat Jun 11, 2011 1:24 pm
by rogierhanselaar
By "it" I mean oldvalue
Re: Manipulating data in series
Posted: Sat Jun 11, 2011 2:54 pm
by startz
Something like
Code: Select all
series newvalue = 0
smpl if oldvalue >=3 and oldvalue<=11
newvalue = whatever
smpl if oldvalue > 11
newvalue = 11
smpl @all
Re: Manipulating data in series
Posted: Mon Jun 13, 2011 5:42 am
by rogierhanselaar
Thanks for your reply, where can I insert that code? I'm sorry, but I'm quite new with programs like eviews in general.
Re: Manipulating data in series
Posted: Mon Jun 13, 2011 7:01 am
by startz
Just type the commands in the command pane.
You might want to read the initial chapters of EViews Illustrated, which are available for free at the EViews web site.
Re: Manipulating data in series
Posted: Mon Jun 13, 2011 9:37 am
by rogierhanselaar
I've been able to figure it out with your advice. Thanks a million!