DATA Step, Macro, Functions and more

ERROR: Expression using equals (=) has components that are of different data types

Accepted Solution Solved
Reply
Contributor
Posts: 72
Accepted Solution

ERROR: Expression using equals (=) has components that are of different data types

Could you please help with this error?, I checked my variables on both sides of the "=" signs and they seem to be match. However, I still get the error!

 

SprCreditType_0001 ---> character

ConstClass_0002 ---> numeric

 

PROC SQL;

 

.

.

.

 

WHERE (t1.SprCreditType_0001 = 'P' AND t1.ConstClass_0002 = '5')

OR

(t1.SprCreditType_0001 = 'N' AND t1.ConstClass_0002 = '5')

OR 

(t1.SprCreditType_0001 = 'P' AND t1.ConstClass_0002 = '6')

OR

(t1.SprCreditType_0001 = 'N' AND t1.ConstClass_0002 = '6') ;


QUIT;


Accepted Solutions
Solution
‎01-28-2016 03:31 PM
Super User
Posts: 19,865

Re: ERROR: Expression using equals (=) has components that are of different data types

Posted in reply to almmotamedi

If ConstClass_0002 is numeric the numbers should not be in quotes, quotes are for character variables.

 

WHERE (t1.SprCreditType_0001 = 'P' AND t1.ConstClass_0002 = 5)

View solution in original post


All Replies
Solution
‎01-28-2016 03:31 PM
Super User
Posts: 19,865

Re: ERROR: Expression using equals (=) has components that are of different data types

Posted in reply to almmotamedi

If ConstClass_0002 is numeric the numbers should not be in quotes, quotes are for character variables.

 

WHERE (t1.SprCreditType_0001 = 'P' AND t1.ConstClass_0002 = 5)
Contributor
Posts: 72

Re: ERROR: Expression using equals (=) has components that are of different data types

It worked! Thank you so mcuh 

Super User
Posts: 11,343

Re: ERROR: Expression using equals (=) has components that are of different data types

Posted in reply to almmotamedi
Also consider"
WHERE (t1.SprCreditType_0001 in ( 'P' ,'N') AND t1.ConstClass_0002 in (5, 6) )
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 1845 views
  • 2 likes
  • 3 in conversation