Example 9.2 Determining the Type of a Variable's Content

Goal

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.