SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Reading Raw Data in Fixed Fields
Using Formatted Input


Reading Columns in Any Order

Column pointer controls are very useful. For instance, you can use the @n to move a pointer forward or backward when reading a record.

In this INPUT statement, the value for FirstName is read first, starting in column 9.

     input @9 FirstName $5.

1---+---V10---+----20---+---
EVANS   DONNY 112 29,996.63 
HELMS   LISA  105 18,567.23 
HIGGINS JOHN  111 25,309.00 


Now let's read the values for LastName that begin in the first column. Here, you must use the @n pointer control to move the pointer back to column 1.

     input @9 FirstName $5. @1 LastName $7.

V---+----10---+----20---+---
EVANS   DONNY 112 29,996.63 
HELMS   LISA  105 18,567.23 
HIGGINS JOHN  111 25,309.00 


The rest of the INPUT statement indicates the column locations of the raw data values for JobTitle and Salary.

     input @9 FirstName $5. @1 LastName $7. @15 JobTitle 3. 
           @19 Salary comma9.; 

1---+----10---V---V20---+---
EVANS   DONNY 112 29,996.63 
HELMS   LISA  105 18,567.23 
HIGGINS JOHN  111 25,309.00 


The $5. , $7., 3., and comma9. informats are explained later in this lesson.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement