Hi
I used this command to report the coefficient and its pvalue of all equations in one table in column 1 and 2 and it works.
!row=1
!col=1
!col1=!col+0
!tabrow=24
for %i au
for %j au hk jp sg uk us
for %c c7
equation eq_{%i}_{%j}.arch(1,1, archm=sd, egarch, ged) {%i} c {%j}(-1)
freeze(table) eq_{%i}_{%j}
result_{%c}(!row,!col1) = @val(table(!tabrow,2))
result_{%c}(!row, !col1+1)=@val(table(!tabrow,5))
!row=!row+1
d table
d eq_{%i}_{%j}
next
Then I would like to set the !tabrow that would be automatically changed when I change the value in the variable %c.
So I add the command IF to this loop:
!row=1
!col=1
!col1=!col+0
for %i au
for %j au hk jp sg uk us
for %c c7
equation eq_{%i}_{%j}.arch(1,1, archm=sd, egarch, ged) {%i} c {%j}(-1)
freeze(table) eq_{%i}_{%j}
if %c = "c7" then !tabrow=24
!tabrow=1
endif
result_{%c}(!row,!col1) = @val(table(!tabrow,2))
result_{%c}(!row, !col1+1)=@val(table(!tabrow,5))
!row=!row+1
d table
d eq_{%i}_{%j}
next
Then I got N/A in my table.
Any comment/suggestion is greatly appreciated.
Command IF inside the loop
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Command IF inside the loop
This code has a few issues.
This line creates a for loop with only one value. The loop is meaningless.
This if condition is meaningless, since %c is always equal to "c7" (given your above for loop).
Plus the if condition changes the same thing twice.
Code: Select all
for %c c7
This line creates a for loop with only one value. The loop is meaningless.
Code: Select all
if %c = "c7" then
!tabrow=24
!tabrow=1
endif
This if condition is meaningless, since %c is always equal to "c7" (given your above for loop).
Plus the if condition changes the same thing twice.
Follow us on Twitter @IHSEViews
Re: Command IF inside the loop
Thanks Gareth for your reply.
How about this command IF
The message is" NA found in matrix in IF{%i} = AU THEN"
!col=1
for %i au ger
if {%i} = au then !n = 0
else
!n = 1
endif
!col1=!col+2*!n
next
Your help is really appreciated.
How about this command IF
The message is" NA found in matrix in IF{%i} = AU THEN"
!col=1
for %i au ger
if {%i} = au then !n = 0
else
!n = 1
endif
!col1=!col+2*!n
next
Your help is really appreciated.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Command IF inside the loop
Code: Select all
if %i = "au" then
!n=0
else
!n=1
endif
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 40 guests