![]() Chapter Contents |
![]() Previous |
![]() Next |
| INPUT, Column |
| Valid: | in a DATA step |
| Category: | File-handling |
| Type: | Executable |
| Syntax | |
| Arguments | |
| Details | |
| When to Use Column Input | |
| Missing Values | |
| Reading Data Lines | |
| Reading Variable-Length Records | |
| Examples | |
| See Also | |
Syntax |
|
INPUT variable <$> start-column
<- end-column>
<.decimals> <@ | @@>; |
| Tip: | If the variable is previously defined as character, $ is not required. |
| Tip: | An explicit decimal point in the input value overrides a decimal specification in the INPUT statement. | ||||||||||||||||||||||||||||||||||||
| Example: |
This INPUT statement
reads the input data for a numeric variable using two decimal places:
|
||||||||||||||||||||||||||||||||||||
| Details |
input id 10-15 group 13;
SAS always pads the data records that follow the DATALINES
statement (in-stream data) to a fixed length in multiples of 80. The CARDIMAGE system
option determines whether to read or to truncate data past the 80th
column.
By default, SAS uses the FLOWOVER option to read varying-length data records. If the record contains fewer values than expected, the INPUT statement reads the values from the next data record. To read varying-length data. you may need to use the TRUNCOVER option in the INFILE statement. The TRUNCOVER option is more efficient than the PAD option which pads the records to a fixed length. For more information, see Reading Past the End of a Line.
| Examples |
This DATA step demonstrates how to read input data records with column input:
data scores;
input name $ 1-18 score1 25-27 score2 30-32
score3 35-37;
datalines;
Joseph 11 32 76
Mitchel 13 29 82
Sue Ellen 14 27 74
;
| See Also |
Statement:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.