String comparison (a question about @pagefreq)

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

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

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

String comparison (a question about @pagefreq)

Postby Liu » Wed Oct 20, 2010 6:01 am

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

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: String comparison (a question about @pagefreq)

Postby trubador » Wed Oct 20, 2010 6:15 am

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

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

Re: String comparison (a question about @pagefreq)

Postby Liu » Wed Oct 20, 2010 8:16 am

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 .

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

Re: String comparison (a question about @pagefreq)

Postby EViews Gareth » Wed Oct 20, 2010 8:36 am

Code: Select all

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

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

Re: String comparison (a question about @pagefreq)

Postby Liu » Fri Oct 22, 2010 5:35 am

Thank you so much. It totally works now.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests