Clearing global variables

Hi there,

I know we can use the command new to get rid of regular variables we create in our codes.

But what about global variables used in libraries like MAXLIK, such as _max_GradTol, _max_CovPar, etc?

Is there a way to set them back to their default values without having to close and reopen GAUSS?

Thank you!

2 Answers


PS: I also know that you can MANUALLY use the function clearg, but this has to be repeated for ALL global variables. My question then is: how can I reset ALL global variables to their default values without having to manually specify which one I want to clear?


For global variables that are part of a library such as Optmum and Maxlik, you have two options. First, these libraries come with a function which will reset their global control variables. For Maxlik, it is maxset.

// Clear all variables

// Make Maxlik library available
library maxlik;

// The default value for _max_Algorithm is 2
print _max_Algorithm;

// Set it to a new value
_max_Algorithm = 3;

// Reset all Maxlik global control variables

// Print _max_Algorithm after being reset
print _max_Algorithm;

The code snippet above will print out:


because the call to maxset will reset _max_Algorithm to be equal to its default value of 2.

Note that the new command can also be used. new will delete all global variables from your GAUSS workspace. When you reference them again after the new call, GAUSS will find their default value in the corresponding declaration file (maxlik.dec or optmum.dec).

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy