Hello, new GAUSS fun here. I want to do some time series related testing for which I need to load 2 columns from a .xls file. I am not sure what the problem is. The .xls file has only one sheet called VariableName and columns A and B contain the data (A2:A105;B2:B105). This is my line of code for it:
x = spreadSheetReadM("domaci6.xls","A2:A105","VariableName");
GAUSS returns a single value for x. (And I want it to be a 2 column matrix with the data from .xls.
Many Thanks
2 Answers
0
The problem is that the third input needs to be an integer index, instead of a string with the literal name of the sheet. If you are using GAUSS 16 or newer, you do not need to specify the sheet. The default value of sheet is 1. So this should work for you:
x = spreadSheetReadM("domaci6.xls","A2:B105");
If you have GAUSS 17 or newer, and your Excel file has header names as the first row and data below, you can use the 'loadd' function to load the data in terms of the variable names in your file. For example, assume your variables are 'GDP' and 'Inflation':
//Load data from all variables in file
x = loadd("domaci6.xls");
//Load data from all variables in file
//dot '.' means 'all'
x = loadd("domaci6.xls", ".");
//Load data from only 'Inflation' variable
x = loadd("domaci6.xls" "Inflation");
//Load data from only 'Inflation' variable
x = loadd("domaci6.xls" ". -GDP");
0
Thank you guys for responding. So the thing is that my University uses this GAUSS 6.0 for this class. It is generally good, like it does quite complicated things, but this, what I consider a minor thing remains a mystery. It just doesn't work. I even removed Var names in my table so I only have numerical data, I made them integer (to lose the comma sign) and still, all I get is a single value in the output window. I need to put sheet name or integer there,otherwise it returns an error, saying: Wrong number of parameters.
Thanks for giving suggestions.
Your Answer
2 Answers
The problem is that the third input needs to be an integer index, instead of a string with the literal name of the sheet. If you are using GAUSS 16 or newer, you do not need to specify the sheet. The default value of sheet is 1. So this should work for you:
x = spreadSheetReadM("domaci6.xls","A2:B105");
If you have GAUSS 17 or newer, and your Excel file has header names as the first row and data below, you can use the 'loadd' function to load the data in terms of the variable names in your file. For example, assume your variables are 'GDP' and 'Inflation':
//Load data from all variables in file
x = loadd("domaci6.xls");
//Load data from all variables in file
//dot '.' means 'all'
x = loadd("domaci6.xls", ".");
//Load data from only 'Inflation' variable
x = loadd("domaci6.xls" "Inflation");
//Load data from only 'Inflation' variable
x = loadd("domaci6.xls" ". -GDP");
Thank you guys for responding. So the thing is that my University uses this GAUSS 6.0 for this class. It is generally good, like it does quite complicated things, but this, what I consider a minor thing remains a mystery. It just doesn't work. I even removed Var names in my table so I only have numerical data, I made them integer (to lose the comma sign) and still, all I get is a single value in the output window. I need to put sheet name or integer there,otherwise it returns an error, saying: Wrong number of parameters.
Thanks for giving suggestions.