Reading Raw Data in Fixed Fields |
Using
Informats |
Reading Standard Numeric Data
Remember that standard numeric data are values that contain numbers, decimal points, scientific notation, and minus signs. The informat for reading standard numeric data is the w.d informat. The w specifies the field width of the raw data value, the period serves as a delimiter, and the d optionally specifies the number of implied decimal places for the value. The w.d informat ignores any specified d value if the data already contains a decimal point. For example, the raw data value 34.0008 contains 6 digits (4 are decimals) and 1 decimal point. The w. informat requires a field width of 7 to correctly read the raw data value. |
Raw Data Value |
w. Informat |
Variable Value |
|||||
|
In the following example, the raw data value 340008 contains no decimal places. The w.d informat can be used to create a variable value with four decimal places. In this case, the w.d informat requires a w field width of 6 to read the entire raw data value and a d value of 4 to specify the number of decimal places. |
Raw Data Value |
w.d Informat |
Variable Value |
|||||
|
In the example below, the values for JobTitle
contain standard numeric data. A d value is not necessary to
read the values for JobTitle . Simply advance the column
pointer control 7 spaces to column 15, name the variable, and specify
a field width of 3. |
input @9 FirstName $5. @1 LastName $7. +7 JobTitle 3. |
123 | |||||||||||
|
Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.