SPSS Data Types

SPSS exposes numeric and string data types.

Certain specialized forms of data are handled by formats that impact visualization and export, not storage. The primary example of this is date and time data.


Numeric Data

Numeric data is stored as double-precision floating point.

Generally, numeric data uses either a numeric format (Fw.d where w is the field width and d is the number of visible decimal places) or a restricted numeric format (Nw) for displaying data. See here for further information. The default format, which will be applied to any implicitly declared variables, is F8.2.

Date and Time Data

Dates are stored as the number of seconds from midnight, October 14, 1582 to midnight on the specified date. Generally the DATE10 format is used for displaying data.

Datetimes are stored as the number of seconds to the specified time on the specified date. Generally the DATETIME20 format is used for displaying data.

Times are stored as the number of seconds. This can be imagined as the number of seconds from midnight to the specified time, but that is not a necessary construct. Generally the TIME8 format is used for displaying data.

Keep in mind that 1 day = 60 (seconds) * 60 (minutes) * 24 (hours) = 86400 seconds.

For more information about date and time formats, see here.

See here for the built-in library of date and time functions.


String Data

String data is stored at a fixed length.

A string variable can only be explicitly declared, as by the STRING command.

Generally, string data uses the string format (Aw where w is the field width) for displaying data. See here for further information.

See here for the built-in library of string functions.

String Literals

String literals are declared by wrapping a string value in quotes, either single (') or double (").

Quote marks within strings can be handled in one of two ways: either use the opposite quote mark to wrap the string, or escape the quote mark by doubling it.

variable label var1 "Say ""Hello!""".
variable label var2 'Don''t say "Goodbye!"'.


CategoryRicottone

SPSS/DataTypes (last edited 2023-06-13 05:00:25 by DominicRicottone)