Loading panel data from an Excel file into GAUSS

I am trying to load a numeric panel data from an Excel file into GAUSS. The data is on four variables and is located in the cell range from A2:D821. It contains information on 41 countries for a period of 20 years (from 1996-2015). By the time I write line 9 of the following code, I get the error message that says error G0058 : Index out of range.

» fname="dataset.xls";                 Line 1

» range="a2:d821";                         Line 2

» sheet=1;                                          Line 3

» myvars=spreadSheetReadM(fname,range,sheet);                      Line 4

» t = 20;                                                Line 5

» nt = rows(myvars);                      Line 6

» n = nt/t;                                            Line 7

» i = myvars[.,1];                              Line 8

» q = myvars[.,2];                             Line 9

5 Answers



0



What version of GAUSS are you using? Does the data in myvars look like what you expect, if you print it out?

print myvars;

aptech

1,773


0



I am using GAUSS Light. Yes, the data in myvars look like what I expect when printed out.



0



Which version of GAUSS Light 14, 15, 18?

What happens when you enter these commands?

fname = "dataset.xls";

range = "a2:d821";

sheet = 1;

myvars = spreadSheetReadM(fname,range,sheet);

print "rows(myvars) = " rows(myvars);
print "cols(myvars) = " cols(myvars);

aptech

1,773


0



GAUSS Light 9.0.

The first command produces the number of rows in the data, while the second one produces the number of columns.

Thanks.



0



I suspected you might be using an older version. GAUSS Light is free for students, so if you are a student there is no good reason to use such an old version. There are many tremendous improvements since GAUSS 9. You can request the current version from our student licensing center link..

Usually, the problem you are describing occurs because the old version would return an error code when there was a problem loading the file. The error code is 1x1 so indexing errors would occur instead of getting an error immediately telling you about the problem loading the data. If that is the case, I would expect to see the problem show up in this code

fname = "dataset.xls";

range = "a2:d821";

sheet = 1;

myvars = spreadSheetReadM(fname,range,sheet);

print "rows(myvars) = " rows(myvars);
print "cols(myvars) = " cols(myvars);

print "myvars = " myvars;

aptech

1,773

Your Answer

5 Answers

0

What version of GAUSS are you using? Does the data in myvars look like what you expect, if you print it out?

print myvars;

0

I am using GAUSS Light. Yes, the data in myvars look like what I expect when printed out.

0

Which version of GAUSS Light 14, 15, 18?

What happens when you enter these commands?

fname = "dataset.xls";

range = "a2:d821";

sheet = 1;

myvars = spreadSheetReadM(fname,range,sheet);

print "rows(myvars) = " rows(myvars);
print "cols(myvars) = " cols(myvars);

0

GAUSS Light 9.0.

The first command produces the number of rows in the data, while the second one produces the number of columns.

Thanks.

0

I suspected you might be using an older version. GAUSS Light is free for students, so if you are a student there is no good reason to use such an old version. There are many tremendous improvements since GAUSS 9. You can request the current version from our student licensing center link..

Usually, the problem you are describing occurs because the old version would return an error code when there was a problem loading the file. The error code is 1x1 so indexing errors would occur instead of getting an error immediately telling you about the problem loading the data. If that is the case, I would expect to see the problem show up in this code

fname = "dataset.xls";

range = "a2:d821";

sheet = 1;

myvars = spreadSheetReadM(fname,range,sheet);

print "rows(myvars) = " rows(myvars);
print "cols(myvars) = " cols(myvars);

print "myvars = " myvars;


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