Page 1 of 1

How do I delete a declared variable programmatically?

Posted: Fri Sep 18, 2015 2:56 pm
by macro
For example, in this pseudocode

Code: Select all

declare model fcast_model
* add some equations to fcast_model, compute a forecast, etc.
I'd like to reset the variable "fcast_model" to be an empty model, so I can reuse it (in my actual code, it's part of a complicated loop). Is there any way to do this, besides creating an additional variable, i.e.

Code: Select all

declare model fcast_model
* add some equations to fcast_model, compute a forecast, etc.

declare model empty_model
compute fcast_model = empty_model

* fcast_model is now empty and can be reused for another loop iteration
This is a more general question than just how to empty a model of its equations, although I looked for a function like %rlempty() that corresponded to the "model" data type.

Re: How do I delete a declared variable programmatically?

Posted: Fri Sep 18, 2015 4:42 pm
by TomDoan
You can't take a variable out of the symbol table (programmatically). However

group fcast_model

by itself will empty a model.