Page 1 of 1

cleaning a table

Posted: Thu May 12, 2011 9:39 am
by basil
How do I empty all entries of a table?

I would like to reset the table to be empty after each iteration. The following does not work in EViews 6:
table t=””

My solution is:
table t
delete t
table t
(I need the first line in order to avoid an error in the second line)

Any suggestion for better ideas?

Thanks,
Basile

Re: cleaning a table

Posted: Thu May 12, 2011 9:45 am
by EViews Gareth
Deleting the table is the only way to completely empty it.

Re: cleaning a table

Posted: Thu May 12, 2011 10:04 am
by basil
thanks for your quick response.
Just a quick follow up: is there a way to use "delete t" without creating an error in case where t does not exit?

Re: cleaning a table

Posted: Thu May 12, 2011 10:15 am
by EViews Gareth
In EViews 7 you can use:

Code: Select all

delete(noerr) t
In EViews 6, you're out of luck.

Re: cleaning a table

Posted: Thu May 12, 2011 10:16 am
by basil
excellent; thank you.

Re: cleaning a table

Posted: Thu May 12, 2011 10:40 am
by tchaithonov
Just do:

if @isobject("t")=1 then
delete t
endif

Re: cleaning a table

Posted: Thu May 12, 2011 1:28 pm
by basil
thank you.