Chapter Contents

Previous

Next

Aligning Variable Values

In SAS, numeric variables are automatically 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. Output from the PRINT Procedure 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:

Output from the PRINT Procedure
                      The SAS System                             

             OBS    CITY              AIRPORT

              1     San Francisco    SFO
              2     Honolulu         HNL
              3     New York         JFK or EWR
              4     Miami               MIA


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.