Page 1 of 1

naming samples in a program

Posted: Tue Feb 27, 2018 8:49 am
by miorinnovo
This is only a a minor annoyance but when I re-run a program that contains a sample I created, the program stops saying that sample already exists. Is there a way around that other than commenting out the sample creation line?

Thanks

Re: naming samples in a program

Posted: Tue Feb 27, 2018 10:31 am
by EViews Matt
Hello,

You can condition the sample creation statement with an @isobject check, that way the sample object will only be created if it doesn't already exist:

Code: Select all

if not @isobject("foo") then sample foo ... endif
If the sample is dynamic (possibly changing each time you run the script), you could do something similar to reset or delete and recreate the sample object instead.

Re: naming samples in a program

Posted: Tue Feb 27, 2018 6:31 pm
by EViews Gareth
I always just throw a

Code: Select all

D(noerr) objectname
At the top of the program