Page 1 of 1

String comparison (a question about @pagefreq)

Posted: Wed Oct 20, 2010 6:01 am
by Liu
Hi.
I am writing a subroutine to calculate percentage change rate. This calculation is workfile specific
so I used @pagefreq to return current workfile frequency and compare it to an existing
string. However, the program keeps giving error message such as %w=w is not specified etc.
(I actually changed the code to "string %w=w" or String %w="w", but neither one works.
Anyone can tell me what I did wrong in the coding? Thanks in advance.

Code: Select all

subroutine pcna(series x, scalar n) %f=@pagefreq %w=w if %f=%w then series pcn=(x-x(-n))/x(-n) series pcna=pcn*52/n endif endsub

Re: String comparison (a question about @pagefreq)

Posted: Wed Oct 20, 2010 6:15 am
by trubador

Code: Select all

subroutine pcna(series x, scalar n) %w="w" if @pagefreq=%w then series pcn=(x-x(-n))/x(-n) series pcna=pcn*52/n endif endsub

Re: String comparison (a question about @pagefreq)

Posted: Wed Oct 20, 2010 8:16 am
by Liu
Thanks Trubador for your reply and code.

However I tried it and it still doesn't work. I also used
if @eqna(@pagefreq, %w)=1 for the purpose of comparing two strings, but it's not working either.

I am not sure if Eviews 7 allows to compare two strings directly like %f=%w .

Re: String comparison (a question about @pagefreq)

Posted: Wed Oct 20, 2010 8:36 am
by EViews Gareth

Code: Select all

if @pagefreq="W" then
(In other words, case matters)

Re: String comparison (a question about @pagefreq)

Posted: Fri Oct 22, 2010 5:35 am
by Liu
Thank you so much. It totally works now.