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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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