Command IF inside the loop
Posted: Fri Nov 03, 2017 9:24 am
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.
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.