for loop windsorising

For questions regarding programming in the EViews programming language.

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

met
Posts: 14
Joined: Fri Sep 02, 2011 7:44 am

for loop windsorising

Postby met » Fri Sep 16, 2011 7:54 am

Hi there,

What is my error in the following for loop?

Code: Select all

for %y db_09 sg_09 hr_09 series w(%y) = @recode(%y>@quantile(%y,.995),@quantile(%y,.995),@recode(%y<@quantile(%y,.005),@quantile(%y,.005),%y)) next
I get the error message "Can not assign string expression to numeric variable". How do I assign the values of the series?

Code: Select all

series wdb_09 = @recode(db_09>@quantile(db_09,.995),@quantile(db_09,.995),@recode(db_09<@quantile(db_09,.005),@quantile(db_09,.005),db_09))
Thanks, so much!

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

Re: for loop windsorising

Postby EViews Gareth » Fri Sep 16, 2011 7:57 am

Where ever you have %y on the right hand side, replace it with {%y}.

met
Posts: 14
Joined: Fri Sep 02, 2011 7:44 am

Re: for loop windsorising

Postby met » Fri Sep 16, 2011 8:10 am

Code: Select all

for %y db_09 sg_09 hr_09 series w(%y) = @recode({%y}>@quantile({%y},.995),@quantile({%y},.995),@recode({%y}<@quantile({%y},.005),@quantile({%y},.005),{%y})) next
I get the same error message! Working in Eviews 6!

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

Re: for loop windsorising

Postby EViews Gareth » Fri Sep 16, 2011 8:17 am

Replace the (%y) you have on the left hand side with {%y}.

met
Posts: 14
Joined: Fri Sep 02, 2011 7:44 am

Re: for loop windsorising

Postby met » Fri Sep 16, 2011 8:36 am

Works fine now! thanks Gareth


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest