DELETE

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

DELETE

Previous pageReturn to chapter overviewNext page

DELETE is used to remove variables from databanks.

 

When deleting timeseries, remember that default DELETE only deletes series of the currently active frequency from the first-position databank. You may use : and ! to broaden this, for instance delete b1:*!*; deletes all timeseries of all frequencies in the b1 databank (this will only work if the databank is editable, cf. UNLOCK).

 

Syntax

 

 

delete variables;

delete < NONMODEL > ;

 

NONMODEL

Removes superfluous timeseries in the first-position and Ref (reference) databanks (provided a model has been defined with MODEL). The removal is only done for series of the same frequency as the global frequency setting. For instance, you might have a databank and model variable y for income. Now, imagine that the definition and contents of the variable is changed to y2 in both the databank and model. If the old variable y still resides in the databank, this may create confusion, and the NONMODEL option removes such non-model variables. Cf. also the Gekko menu Utilities --> Compare model/databank/varlist....

 

variables

Besides normal variables, the variables may also be array-series elements like x[a,b] or x[a,*], or more complex wildcards like x[a,b*c?d].

 

If a variable is stated without databank, the databank is assumed to be the first-position databank.

Note that 'naked' wildcards are allowed in this statement, so you may for instance use a*b?c as wildcard instead of the more cumbersome {'a*b?c'}.

Looping: with a list like for instance #= a, b;, you may use delete x{#m}; to delete xa and xb.

 


 

Examples

 

Delete a series x, a string %x, and a list #x:

 

= 100;
%= 'a';
#= a, b;
delete x, %x, #x;

 

If, instead, you want to delete the series corresponding to the contents of %x and #x, use {}-curlies:

 

= 100;
= 200;
= 300;
%= 'a';
#= b, c;  //or: #x = ('b', 'c')
delete {%x}, {#x};  //deletes the series a, b, c
delete %x, #x;  //deletes the string %x and the list #x

 

You may use wildcards like in COPY, INDEX, RENAME, etc.:

 

delete **;

 

This will delete all variables from the first-position databank. Alternatively (and better):

 

clear first;    //or clear work, if Work is the first-position databank

 

Another example:

 

delete x*!q;

 

This will delete all quarterly series starting with x. You may also delete a variable from a particular databank (provided that bank is opened with OPEN<edit> or unlocked with UNLOCK), for instance:

 

delete bank2:x1!q;

 

Remove non-model variables with this special option:

 

delete <nonmodel>;

 

 


 

Note

 

To clear the entire workspace, including databanks, list, scalars, models, etc., see RESTART or RESET. To delete the contents of databanks, see CLEAR.

 


 

Related statements

 

CLEAR, CLOSEALL, INDEX, RESET, RESTART, UNLOCK