datalist command having odd behavior

Hi there,

I've noticed some odd behavior and I wanted to have an idea of why this is happening.

When I generate a .DAT file from a .CSV file using ATOG, I can use the datalist command to see some column names and observations.

However, when I use my own GAUSS code to generate a .DAT file from a .CSV file, the datalist command gives me nothing.

Here is the procedure I use to generate the .DAT from a .CSV in GAUSS (without ATOG):

// This procedure reads in a CSV file (with headers) from the disk, 
// generates a DAT file on the disk and returns 3 things:
// -A variable containing the dataset itself
// -A variable containing the headers of the dataset
// -A variable containing the name of the DAT file created. This is what should be used in the "indices" commands.
proc (3) = read_in_csv_with_headers(dataset_csv_filename);
   local dataset, vname_headers, dataset_dat_filename;

   // Read numeric data from CSV file
   dataset = loadd(dataset_csv_filename);

   // Read headers from CSV file
   vname_headers = csvReadSA(dataset_csv_filename, 1|1) ;

   // Write DAT file
   dataset_dat_filename = strsect(dataset_csv_filename,1,strlen(dataset_csv_filename)-3) $+ "dat";
   call saved(dataset, dataset_dat_filename, vname_headers); 

   // Return data, headers and DAT filename
   retp(dataset, vname_headers, dataset_dat_filename);

Do you have any idea why the datalist command gets me nothing when I use my own procedure to generate the .DAT file?

Thank you!

2 Answers


This is because the datalist function uses the old convention of uppercase variable names meaning numeric data and lower case variable names being for string data. I am guessing that your ATOG created variable names are all upper case and the variable names for the dataset created with your procedure all have lower case variable names. If so, using uppercase variable names will resolve the problem, i.e. change this line:

   // Read headers from CSV file
   vname_headers = csvReadSA(dataset_csv_filename, 1|1) ;

to this

   // Read headers from CSV file
   vname_headers = upper(csvReadSA(dataset_csv_filename, 1|1));


Worked like a charm =)


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