BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
capam
Pyrite | Level 9

I wrote the following gmap input data  and got  an error for the canada part. 

/* Combine the map data set with the annotate data set. */
data all;
	/* Subset out the states that you do not want. */
	/* The FIPS code of 2 is Alaska, 15 is Hawaii, */

	/* and 72-Puerto Rico. California-6 Florida-12 
	Oregon-41 Nevada-32 Arizona-4*/
	set maps.states(where=(state not in(2 4 6 12 15 32 41 72))) 
		maps.canada(where=(province not in(10:13 60 61))) anno;
		*anno;

	*maps.canada4 anno;
	*maps.canada4(where=(province not in(10:13 60 61))) anno;
run;

The error message is: 

93 data all;
94 /* Subset out the states that you do not want. */
95 /* The FIPS code of 2 is Alaska, 15 is Hawaii, */
96
97 /* and 72-Puerto Rico. California-6 Florida-12
98 Oregon-41 Nevada-32 Arizona-4*/
99 set maps.states(where=(state not in(2 4 6 12 15 32 41 72)))
100 maps.canada(where=(province not in(10:13 60 61))) anno;
ERROR: WHERE clause operator requires compatible variables.

 

I would appreciate help in correcting this error.

 

Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

In my Maps.canada dataset Province is character. You would have to use

 

maps.canada(where=(province not in('10' '11' '12' '13' '60' '61')

 

the value list '10':'13' does not work with character values because '101' would be "between" '10' and '13'. And because there are so many possible issues with inclusion for character SAS has just skipped that coding issue and doesn't allow it.

The error message

ERROR: WHERE clause operator requires compatible variables

means that you are comparing a text variable to numeric somewhere.

 

View solution in original post

1 REPLY 1
ballardw
Super User

In my Maps.canada dataset Province is character. You would have to use

 

maps.canada(where=(province not in('10' '11' '12' '13' '60' '61')

 

the value list '10':'13' does not work with character values because '101' would be "between" '10' and '13'. And because there are so many possible issues with inclusion for character SAS has just skipped that coding issue and doesn't allow it.

The error message

ERROR: WHERE clause operator requires compatible variables

means that you are comparing a text variable to numeric somewhere.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 916 views
  • 0 likes
  • 2 in conversation