Creating a General Purpose Macro to Count Missing and Nonmissing Values for Both Numeric and Character Variables

When you omit the VAR statement (or use _NUMERIC_ in place of the variable list) with PROC MEANS, all numeric variables are listed. With PROC FREQ, you can use _CHARACTER_ in place of a variable list in the TABLES statement. However, when you use PROC TABULATE, you need to provide a list of variable names in the CLASS or VAR statement. Yes, it would be nice to use PROC TABULATE to provide a summary of missing values for all the variables in a SAS data set (and minimum and maximum values for the numeric variables) without having to “hard code” all of the variable names. A novel way to accomplish this task is to use PROC SQL to create ...

Get Cody’s Data Cleaning Techniques Using SAS® Software 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.