Import error CSV file (URGENT)

I have a CSV file that I need to convert to a dat file for the ExpEnd program. My CSV file is 14238 rows, and 60 columns (all numeric with NO missing values).  When I use the import wizard, there is no issue.    All of my columns are read in.  When I try to convert this file to a dat file with the column names, it seemingly becomes one, but when I try to read that dat file in, lots of my variables now are shaded yellow and listed as missing values and are designated as "strings", which is wrong.  I don't understand why this is the case.

Can someone PLEASE help me?  This is urgent.

Thank you.

1 Answer



0



The short answer

The data in your dataset is most likely correct. Make the variable names in your GAUSS dataset uppercase. For example, if the name of your dataset is mydata.dat, do this:

fname = "mydata.dat";

// Load data
X = loadd(fname);

// Load variable names and convert to uppercase
vnames = upper(getHeaders(fname));

// Resave dataset
saved(X, fname, vnames);

The longer answer

GAUSS allows you to put string data inside of a numeric matrix. This was very useful in the early days of GAUSS when computers were much slower and had less memory. Today is not generally not recommended but still works for backward compatibility (and it is handy on occasion).

Since size and space were at a premium, the case of the variable names was used to determine whether the column should be interpreted as a string or a numeric column. Uppercase indicates numeric.

As an illustration, if you do this:

// Create a matrix with strings in some colums
X = { "apple" 1200 "kg",
      "banana" 963 "bushels",
      "carrot" 1464 "bags" };

// Numeric column has uppercase name
vnames = "item" $| "COUNT" $| "units";

saved(X, "fruit.dat", vnames);

Then when you preview the data in the data import window, you will see:

GAUSS dataset with string and numeric columns in a matrix.

aptech

1,773

Your Answer

1 Answer

0

The short answer

The data in your dataset is most likely correct. Make the variable names in your GAUSS dataset uppercase. For example, if the name of your dataset is mydata.dat, do this:

fname = "mydata.dat";

// Load data
X = loadd(fname);

// Load variable names and convert to uppercase
vnames = upper(getHeaders(fname));

// Resave dataset
saved(X, fname, vnames);

The longer answer

GAUSS allows you to put string data inside of a numeric matrix. This was very useful in the early days of GAUSS when computers were much slower and had less memory. Today is not generally not recommended but still works for backward compatibility (and it is handy on occasion).

Since size and space were at a premium, the case of the variable names was used to determine whether the column should be interpreted as a string or a numeric column. Uppercase indicates numeric.

As an illustration, if you do this:

// Create a matrix with strings in some colums
X = { "apple" 1200 "kg",
      "banana" 963 "bushels",
      "carrot" 1464 "bags" };

// Numeric column has uppercase name
vnames = "item" $| "COUNT" $| "units";

saved(X, "fruit.dat", vnames);

Then when you preview the data in the data import window, you will see:

GAUSS dataset with string and numeric columns in a matrix.


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.