F, N, and E Formats

The following table lists the formats most commonly used to read in and write out numeric data. Format names are followed by total width (w) and an optional number of decimal positions (d). For example, a format of F5.2 represents a numeric value with a total width of 5, including two decimal positions and a decimal indicator.

Table 1. Common numeric formats
Format type Sample format Sample input Fixed output format Fixed output value Freefield output format Freefield output value
Fw F5 1234 F5.0 1234 F5.0 1234
Fw F5 1.234 F5.0 1* F5.0 1*
Fw.d F5.2 1234 F6.2 1234.0 F6.2 1234.0
Fw.d F5.2 1.234 F6.2 1.23* F6.2 1.23*
Nw N5 00123 N5 00123 N5 00123
Nw N5 123 N5 . N5 00123
Ew.d E8.0 1234E3 E10.3 1234E+06 E10.3 1234E+06
Ew.d E8.0 1234 E10.3 1234E+03 E10.3 1234E+03

* Only the display is truncated. The value is stored in full precision.

System-missing value.

Scientific notation is accepted in input data with F, COMMA, DOLLAR, DOT, and PCT formats. The same rules apply as specified below.

For fixed data:

  • With the N format, only unsigned integers are allowed as input values. Values not padded with leading zeros to the specified width or those containing decimal points are assigned the system-missing value. This input format is useful for reading and checking values that should be integers containing leading zeros.
  • The E format reads all forms of scientific notation. If the sign is omitted, + is assumed. If the sign (+ or –) is specified before the exponent, the E or D can be omitted. A single space is permitted after the E or D and/or after the sign. If both the sign and the letter E or D are omitted, implied decimal places are assumed. For example, 1.234E3, 1.234+3, 1.234E+3, 1.234D3, 1.234D+3, 1.234E 3, and 1234 are all legitimate values. Only the last value can imply decimal places.
  • E format input values can be up to 40 characters wide and include up to 15 decimal positions.
  • The default output width (w) for the E format is either the specified input width or the number of specified decimal positions plus 7 (d+7), whichever is greater. The minimum width is 10 and the minimum decimal places are 3.
  • The DATA LIST command can read fixed-format numeric data with implied decimal positions. See the topic Implied Decimal Positions (DATA LIST command) for more information.

For freefield data:

  • F format w and d specifications do not affect how data are read. They only determine the output formats (expanded, if necessary). 1234 is always read as 1234 in freefield data, but a specified F5.2 format will be expanded to F6.2 and the value will be displayed as 1234.0 (the last decimal place is rounded because of lack of space).
  • When the N format is used for freefield data, input values with embedded decimal indicators are assigned the system-missing value, but integer input values without leading zeroes are treated as valid. For example, with an input format of N5.0, a value of 123 is treated the same as a value of 00123, but a value of 12.34 is assigned the system-missing value.
  • The E format for freefield data follows the same rules as for fixed data except that no blank space is permitted in the value. Thus, 1.234E3 and 1.234+3 are allowed, but the value 1.234 3 will cause mistakes when the data are read.
  • The default output E format and the width and decimal place limitations are the same as with fixed data.