Resources

How to convert an SPSS File into GAUSS dataset

0

Hi,

I need to convert an SPSS data file into a GAUSS data file.

I have created a text file with my data (without the header) and have been trying to use the ATOG utility, but have been getting an error message saying "atog is not recognized as an internal or an external command" when I am trying to run the command file using the following command from the command prompt of my windows machine.

atog CommandFile.txt

My command file has the following lines into it.

input DataTobeConv.txt;
output Data;
invar CASEID uno sero consume1 consume2 consume3 hhsize;
outvar CASEID uno sero consume1 consume2 consume3 hhsize;
outtyp d;

I need to convert this file into the gauss data file on an urgent basis.

I would highly appreciate if someone could guide me in the process.

Thanks and Regards.

Annesha

 

 

Tags: asked May 12, 2014

4 Answers

0

You can read the text file into GAUSS directly with the 'load' command. It reads it in as a vector, though. So if your data is a matrix, you will have to reshape it.

load x[]=DataTobeConv.text;

If you need to reshape, then add something like this.

x = reshape(x, numrows, numcols);

BTW, atog is a separate program. It comes with GAUSS, but it is not a GAUSS command. It should be in your main GAUSS directory. But, I don't think you'll need it.

0

Hello,

Thank you very much for your prompt reply.

I know how to read a text file and that is what I have been doing so far.

But now I need to have my data in GAUSS data format.

I would appreciate if I could get some help on using atog utility or any other means of converting the data into gauss data format.

Thanks and Regards

Annesha

0

Hi Thanks, I have been able to figure out how to use atog.

Regards

Annesha

0

Once you have loaded the data from a text file into GAUSS, you can create a new GAUSS dataset with the saved command. For example, let's imagine we have a 1000x3 matrix in which the first column represents GDP, the second imports and the third exports. Let's also assume that we have loaded this 1000x3 matrix into GAUSS in a variable named country_data. You could then create a GAUSS dataset like this:

//Variable names to add to GAUSS dataset
string var_names = { "GDP", "Imports", "Exports" };

//Create new GAUSS dataset
ret = saved(country_data, "new_dataset.dat", var_names);
aptech
342