$CHARw. Informat

Reads character data with blanks.

Category: Character

Syntax

$CHARw.

Syntax Description

w

specifies the width of the input field.

Default 8 if the length of the variable is undefined. Otherwise, the default is the length of the variable
Range 1–32767

Details

The $CHARw. informat does not trim leading and trailing blanks or convert a single period in the input data field to a blank before storing values. If you use $CHARw. in an INFORMAT or ATTRIB statement within a DATA step to read list input, then by default SAS interprets any blank embedded within data as a field delimiter, including leading blanks.

Comparisons

  • The $CHARw. informat is almost identical to the $w. informat. However, $CHARw. does not trim leading blanks or convert a single period in the input data field to a blank, while the $w. informat does.
  • Use the table below to compare the SAS informat $CHAR8. with notation in other programming languages:
    Language
    Character Notation
    SAS
    $CHAR8.
    IBM 370 assembler
    CL8
    C
    char [8]
    COBOL
    PIC x(8)
    Fortran
    A8
    PL/I
    CHAR(8)

Example

input @1 name $char5.;
Data Line
Result 1
----+----1
XYZ
XYZ##
 XYZ
#XYZ#
  .
##.##
 X YZ
#X#YZ
1The character # represents a blank space.