Deleting NAs from a table
Posted: Tue Mar 29, 2011 11:32 am
Using Eviews 6 with the July 2010 build. I'm trying to run a loop to get rid of the NAs in a table, but the rows with the NAs aren't being deleted. The program runs, but nothing happens. The problem is in the second if loop where it doesn't recognize that the observations from 1975:1 to 1990:1 for {%a}ch and {%a}pch are all NAs. I tried doing it with {%chg_tab}(!i-1,2)=NA as well but that didn't work either.
%chg_tab=%a+"chg_tab"
table(@obssmpl,3) {%chg_tab}
smpl 1975:1 2017:4
!rowcounter=1
for !rowcounter=1 to @obssmpl
{%chg_tab}(!rowcounter,1) = @otod(!rowcounter)
{%chg_tab}(!rowcounter,2) = {%a}ch(!rowcounter)
{%chg_tab}(!rowcounter,3) = {%a}pch(!rowcounter)
!rowcounter = !rowcounter+1
next
for !i=2 to @obssmpl-1
if @isna({%chg_tab}(!i-1,2))=1 then
{%chg_tab}.deleterow(!i-1) 1
endif
!i = !i+1
next
{%spool}.append {%chg_tab}
Thanks
%chg_tab=%a+"chg_tab"
table(@obssmpl,3) {%chg_tab}
smpl 1975:1 2017:4
!rowcounter=1
for !rowcounter=1 to @obssmpl
{%chg_tab}(!rowcounter,1) = @otod(!rowcounter)
{%chg_tab}(!rowcounter,2) = {%a}ch(!rowcounter)
{%chg_tab}(!rowcounter,3) = {%a}pch(!rowcounter)
!rowcounter = !rowcounter+1
next
for !i=2 to @obssmpl-1
if @isna({%chg_tab}(!i-1,2))=1 then
{%chg_tab}.deleterow(!i-1) 1
endif
!i = !i+1
next
{%spool}.append {%chg_tab}
Thanks