Remember the following rules for reading numeric data:
• Parentheses or a minus sign preceding the number (without an intervening blank)
indicates a negative value.
• Leading zeros and the placement of a value in the input field do not affect the value
assigned to the variable. Leading zeros and leading and trailing blanks are not stored
with the value. Unlike some languages, SAS does not read trailing blanks as zeros by
default. To cause trailing blanks to be read as zeros, use the BZ. informat described
in SAS Formats and Informats: Reference.
• Numeric data can have leading and trailing blanks but cannot have embedded blanks
(unless they are read with a COMMA. or BZ. informat).
• To read decimal values from input lines that do not contain explicit decimal points,
indicate where the decimal point belongs by using a decimal parameter with column
input or an informat with formatted input. See the full description of the INPUT
statement in SAS Formats and Informats: Reference for more information. An
explicit decimal point in the input data overrides any decimal specification in the
INPUT statement.
Character Data
A value that is read with an INPUT statement is assumed to be a character value if one
of the following is true:
• A dollar sign ($) follows the variable name in the INPUT statement.
• A character informat is used.
• The variable has been previously defined as character. For example, a value is
assumed to be a character value if the variable has been previously defined as
character in a LENGTH statement, in the RETAIN statement, by an assignment
statement, or in an expression.
Input data that you want to store in a character variable can include any character. Use
the guidelines in the following table when your raw data includes leading blanks and
semicolons.
Table 19.4 Reading Instream Data and External Files Containing Leading Blanks and
Semicolons
Characters in the Data What to Use Reason
leading or trailing blanks that
you want to preserve
formatted input and the
$CHARw. informat
List input trims leading
and trailing blanks from a
character value before the
value is assigned to a
variable.
semicolons in instream data DATALINES4 or CARDS4
statements and four
semicolons (;;;;) to mark the
end of the data
With the normal
DATALINES and CARDS
statements, a semicolon in
the data prematurely
signals the end of the data.
Types of Data 433