Find in string: @wfind

For questions regarding programming in the EViews programming language.

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

dagfinnrime
Posts: 54
Joined: Sat Oct 11, 2008 9:37 am
Location: Oslo
Contact:

Find in string: @wfind

Postby dagfinnrime » Tue Mar 05, 2013 8:29 am

Hi,

I would like to search for a term in a string, and then do some actions. Example:

Code: Select all

%barclay_list = "AUD CAD" for %ccy AUD CAD CHF EUR if @wfind(%barclay_list,%ccy)>0 then fetch(d=Barclays) *_{%ccy} else fetch(d=wmreuters) *_{%ccy} endif next
This doesn't work. It never finds hit in the %barclay_list.

From an attempt with using @wkeep(%barclay_list,%ccy)=%ccy I learned that it doesn't really read the %barclay_list at all. Why?

When I do the following it works:

Code: Select all

@wfind("AUD CAD",%ccy)>0
Thanks in advance,
Dagfinn

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

Re: Find in string: @wfind

Postby EViews Gareth » Tue Mar 05, 2013 8:51 am

Looks like it works to me:

Code: Select all

create u 100 %barclay_list = "aud cad" table a !i=1 for %ccy aud cad chf eur if @wfind(%barclay_list, %ccy) > 0 then a(!i,1) = %ccy !i=!i+1 endif next

dagfinnrime
Posts: 54
Joined: Sat Oct 11, 2008 9:37 am
Location: Oslo
Contact:

Re: Find in string: @wfind

Postby dagfinnrime » Wed Mar 06, 2013 3:24 am

Thanks, and so sorry for sloppiness on my behalf ...

I turned out that my string list was called "%barclay_list_". I have probably changed the name and didn't spot that underscore.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests