IBM Support

How can I import a fixed width text file using syntax in IBM SPSS Statistics?

Question & Answer


Question

I would like to import a large text file. This particular file has been created with the values separated, not by delimiters, but by specific width for each variable, ie. Fixed-Width. How can I import a fixed width text file using syntax in IBM SPSS Statistics?

Answer

You can use the following syntax to import a text file with fixed width.
The length of each variable must be defined in the syntax.

GET DATA /TYPE = TXT
/FILE = '<path and filename>'
/FIXCASE = 1
/ARRANGEMENT = FIXED
/FIRSTCASE = 1
/IMPORTCASE = ALL
/VARIABLES =
/1 POSTE 0-0 F1.0
INTER 1-4 F4.2
Q2 5-10 F6.2
Q30 11-15 F5.2
Q179 16-17 F2.1
.
CACHE.
EXECUTE.

For more information, please see the online Help system

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

40706

Document Information

More support for:
IBM SPSS Statistics

Software version:
Not Applicable

Document number:
420763

Modified date:
16 April 2020

UID

swg21480266

Manage My Notification Subscriptions