Example 9.2 Determining the Type of a Variable's Content


Determine whether a character variable's value contains numeric data, alphabetic text, missing data, or nonalphanumeric characters. Save the values that are determined to be numeric in a numeric variable.

Example Features

Featured StepDATA step
Featured Step Options and StatementsCOMPRESS, INPUT with ?? format modifier, NOTALPHA, REVERSE, STRIP, SUBSTR, and UPCASE functions
A Closer LookUnderstanding Functions That Evaluate the Content of Variable Values

Input Data Set

Data set CHEMTEST contains preliminary results of 14 lab samples in character variable CHEM_PPB. The values of CHEM_PPB contain a mix of alphanumeric and other characters.

 CHEMTEST Obs sample chem_ppb 1 57175 1250.3 ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.