G0152: Variable not initialized

T am trying to replicate a regression using Gauss and I keep on getting "G0152: Variable not initialized". How can I fix this problem?

1 Answer



0



If you use a variable that has not yet been mentioned in your GAUSS program, or GAUSS session, for example:

a = b;

GAUSS will return the error "Undefined symbol : 'b'. This means that GAUSS has not seen a reference to the variable, 'b' in this case, before the code attempted to use it.

The error Variable not initialized occurs when the GAUSS program declares a variable--essentially promising that it will be assigned to by some other code, but the variable is never assigned to. Here is a simple example that will cause the error:

//Remove all variables
new;

//Declare that 'a' will be a sparse matrix
//to be filled in later
sparse matrix a;

//Attempt to use the value of 'a'
//before it was set
b = a * 4;

The error message should tell you the line on which the uninitialized variable is being used.

aptech

1,773

Your Answer

1 Answer

0

If you use a variable that has not yet been mentioned in your GAUSS program, or GAUSS session, for example:

a = b;

GAUSS will return the error "Undefined symbol : 'b'. This means that GAUSS has not seen a reference to the variable, 'b' in this case, before the code attempted to use it.

The error Variable not initialized occurs when the GAUSS program declares a variable--essentially promising that it will be assigned to by some other code, but the variable is never assigned to. Here is a simple example that will cause the error:

//Remove all variables
new;

//Declare that 'a' will be a sparse matrix
//to be filled in later
sparse matrix a;

//Attempt to use the value of 'a'
//before it was set
b = a * 4;

The error message should tell you the line on which the uninitialized variable is being used.


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.