Size: 1567
Comment:
|
← Revision 18 as of 2023-06-13 05:00:25 ⇥
Size: 2443
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
SPSS supports numeric and [[SPSSStrings|string]] data. There are several formats on top of numeric data that impact visualization, not storage. These include [[SPSSDatetimes|dates and times]]. | 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. |
Line 10: | Line 12: |
Line 12: | Line 15: |
Numeric data is stored as double-precision floating point. Data formats adjust the printed/ exported representation of a data point, often only truncating the value. Adjusting these data formats does not destroy precision. | Numeric data is stored as double-precision floating point. |
Line 14: | Line 17: |
Given 123.45... ||'''General Format''' ||'''Format''' ||'''Representation''' || ||Fw ||F8 ||123 || ||Fw.d ||F8.1 ||123.4 || ||Nw ||N8 ||00000123 || ||Nw.d ||N8.1 ||000123.4 || |
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 [[SPSS/DataFormats#Print_Formats|here]] for further information. The default format, which will be applied to any implicitly declared variables, is `F8.2`. |
Line 24: | Line 21: |
=== Date and Time Formats === | |
Line 26: | Line 22: |
See [[SPSSDatetimes|here]] for more details on date, time, and datetime data. | === Date and Time Data === |
Line 28: | Line 24: |
||'''Format''' ||'''Representation''' || ||DATETIME20 ||`dd-MMM-yyyy hh:mm:ss` || ||DATETIME17 ||`dd-MMM-yyyy hh:mm` || ||DATE11 ||`dd-MMM-yyyy` || ||DATE9 ||`dd-MMM-yy` || ||TIME8 ||`hh:mm:ss` || ||TIME5 ||`hh:mm` || ||ADATE10 ||`mm/dd/yyyy` || |
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. |
Line 37: | Line 26: |
Note that `MMM` appears as `JAN`, not `001`. | 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 [[SPSS/DataFormats#Print_Formats|here]]. See [[SPSS/DatetimeFunctions|here]] for the built-in library of date and time functions. |
Line 45: | Line 42: |
String data is stored at a fixed length. This length is defined and adjusted through the format; `Aw` where `w` is the width. | String data is stored at a fixed length. A string variable can only be explicitly declared, as by the [[SPSS/String|STRING]] command. Generally, string data uses the string format (`Aw` where `w` is the field width) for displaying data. See [[SPSS/DataFormats#Print_Formats|here]] for further information. See [[SPSS/StringFunctions|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!"'. }}} |
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!"'.