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;
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
  • 1290 views
  • 4 likes
  • 3 in conversation