You can read a csv file with the GET DATA command. File > Import Data > csv can help you generate the syntax for a single file.
In order to read and convert an entire batch of files, use the SPSSINC PROCESS FILES extension command, which can be installed from the Extensions > Extension Hub menu. This command applies a file of syntax to a batch of files. Here is an example
SPSSINC PROCESS FILES
DIRECTORY="c:/mydata/*.csv"
SYNTAX="c:/myjobs/mysyntax.sps" LOGFILE="c:/myjobs/log.txt".
The syntax file would contain a GET DATA command that refers to a file handle named
JOB_INPUTFILE
that PROCESS FILES command defines for each file. To save the file, you would put a SAVE command in the file, but to construct the output name with a sav extension, you would need to construct it using a macro definition. PROCESS FILES sets a macro named
- !JOB_DATAFILEROOT: The name of the input data file without its extension and excluding the path information
You use to to construct the desired output name. See the syntax help for this command for an example. The syntax help can be displayed by putting the cursor on an instance of the command in the Syntax Editor and pressing F1 or by running
SPSSINC PROCESS FILES /HELP.
for each
#SPSSStatistics#Support#SupportMigration