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 5.2 illustrates the character value alignment produced by the following program:

 data aircode;      input city -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 5.2: Output from the PRINT Procedure
start example
 The SAS System             OBS           CITY             AIRPORT              1            SanFrancisco     SFO              2            Honolulu         HNL              3            New York         JFK or EWR              4            Miami              MIA 
end example
 



SAS 9.1.3 Language Reference. Concepts
SAS 9.1.3 Language Reference: Concepts, Third Edition, Volumes 1 and 2
ISBN: 1590478401
EAN: 2147483647
Year: 2004
Pages: 258

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net