SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

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

34.0008

-->

7.

-->

34.0008


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

340008

-->

6.4

-->

34.0008

 

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
1---+----10---V----20---+---
EVANS   DONNY 112 29,996.63 
HELMS   LISA  105 18,567.23 
HIGGINS JOHN  111 25,309.00 
LARSON  AMY   113 32,696.78 
MOORE   MARY  112 28,945.89 
POWELL  JASON 103 35,099.50 
RILEY   JUDY  111 25,309.00 
RYAN    NEAL  112 28,180.00 
WILSON  HENRY 113 31,875.46 
WOODS   CHIP  105 17,098.71 



back||next


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

Terms of Use & Legal Information | Privacy Statement