$CHARw. Format

Writes standard character data.

Category: Character
Alignment: Left

Syntax

$CHARw.

Syntax Description

w

specifies the width of the output field.

Default 8 if the length of variable is undefined; otherwise, the length of the variable
Range 1–32767

Comparisons

  • The $CHARw. format is identical to the $w. format.
  • The $CHARw. and $w. formats do not trim leading blanks. To trim leading blanks, use the LEFT function to left align character data. Alternatively, use the PUT statement with the colon (:) format modifier and the format of your choice to produce list output.
  • Use the following table to compare the SAS format $CHAR8. with notation in other programming languages:
    Language
    Notation
    SAS
    $CHAR8.
    C
    char [8]
    COBOL
    PIC x(8)
    Fortran
    A8
    PL/I
    A(8)

Example

put @7 name $char4.;
Value of name
Result
----+----1
XYZ
      XYZ