Example 9.3 Determining Whether a Variable Is Character or Numeric

Goal

Determine whether a variable is character or numeric to ensure that you have the right type of data for your application.

Example Features

Featured StepDATA step
Featured Step Options and StatementsATTRN, CLOSE, INDEX, OPEN, UPCASE, VARNAME, and VARTYPE functions CALL SYMPUTX routine Open code macro variables
Related TechniquePROC SQL, DICTIONARY.COLUMNS table, INTO clause to create a macro variable, INDEX and UPCASE functions
A Closer LookUsing the SAS File I/O Functions Specifying Variable Lists

Input Data Set

Data set ENTRANCE_EXAM stores exam results for 15 applicants to an academic program. The results are saved in a mix of character and numeric variables.

 ENTRANCE_EXAM ...

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.