How do I delete a declared variable programmatically?

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

How do I delete a declared variable programmatically?

Unread post 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.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: How do I delete a declared variable programmatically?

Unread post by TomDoan »

You can't take a variable out of the symbol table (programmatically). However

group fcast_model

by itself will empty a model.
Post Reply