Example 10: Reading Fields with a combination of Numeric and Character values
Measurements in the fields are express as either inches (I) or centimeters (C).
DATA CONVERT;
INPUT DUMMY $ @@;
DUMMY2=SUBSTR (DUMMY,1,LENGTH(DUMMY)-1);
IF INDEX (DUMMY,"I") NE 0 THEN
CM=2.54*INPUT (DUMMY2,5.);
ELSE IF INDEX (DUMMY,"C") NE 0 THEN
CM=INPUT (DUMMY2,5.);
ELSE CM=.;
DROP DUMMY DUMMY2;
DATALINES;
23C 100I 12I 133C
35I 45C 35 47I
RUN;