BookmarkSubscribeRSS Feed
Ngo99
Fluorite | Level 6

hi, I am trying to check for missing values in the dataset.

 

Below is the code I used to check for missing values:

PROC PRINT data = WORK.IMPORT;
WHERE ID = ' ' OR name = .;
RUN;

 

Below is the error message after running the code:

ERROR: WHERE clause operator requires compatible variables.

2 REPLIES 2
Kurt_Bremser
Super User

@Ngo99 wrote:

hi, I am trying to check for missing values in the dataset.

 

Below is the code I used to check for missing values:

PROC PRINT data = WORK.IMPORT;
WHERE ID = ' ' OR name = .;
RUN;

 

Below is the error message after running the code:

ERROR: WHERE clause operator requires compatible variables.


I seriously doubt that a variable called "name" will be numeric. Check for the data types of the variables and use the proper missing values.

Patrick
Opal | Level 21

To define a where clause syntax that deals with both numerical and character variables you could use the missing() function as below:

WHERE missing(ID) or missing(name);

or alternatively the cmiss() function:

where cmiss(id,name)>0;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1328 views
  • 4 likes
  • 3 in conversation