In SAS, numeric variables are right-aligned
and character values are left-aligned. You can further control their
alignment by using a format.
However, when you assign
a character value in an assignment statement, SAS stores the value
as it appears in the statement and does not perform any alignment.
Character Variable Alignment illustrates the character value alignment produced by the
following program:
data aircode;
input city $1-13;
length airport $ 10;
if city='San Francisco' then airport='SFO';
else if city='Honolulu' then airport='HNL';
else if city='New York' then airport='JFK or EWR';
else if city='Miami' then airport=' MIA ';
datalines;
San Francisco
Honolulu
New York
Miami
;
proc print data=aircode;
run;
This example produces
the following output:
Character Variable Alignment
The SAS System
Obs city airport
1 San Francisco SFO
2 Honolulu HNL
3 New York JFK or EWR
4 Miami MIA