Previous PageNext Page

Example 5: Conversion of character values to numeric values
What about the reverse? The data in example 5 is a mixture of numeric and character.
Data Temp;
Input TempCode $ @@;
IF TempCode='N'
THEN Temp = 98.6;
Else Temp = Input (TempCode, 8.);
Drop TempCode;
Datalines;
99.7 N 97.9 N N 112.5
Proc Print;

The Proc Print output shows what you might expect.
OBS TEMP

1 99.7
2 98.6
3 97.9
4 98.6
5 98.6
6 112.5

Previous PageTable Of ContentsNext Page