If Overall_Rating is numeric then you have your answer since '1' and '2' are character literals?
proc sql;
select * from sashelp.class
where age in ('14', '15')
;
quit;
Log:
28 proc sql; 29 select * from sashelp.class 30 where age in ('14', '15') 31 ; ERROR: Expression using IN has components that are of different data types. NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL WHERE clause optimization. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 32 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
If Overall_Rating is numeric then you have your answer since '1' and '2' are character literals?
proc sql;
select * from sashelp.class
where age in ('14', '15')
;
quit;
Log:
28 proc sql; 29 select * from sashelp.class 30 where age in ('14', '15') 31 ; ERROR: Expression using IN has components that are of different data types. NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL WHERE clause optimization. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 32 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Show us the ENTIRE log for this PROC SQL. Showing us an error detached from the code doesn't usually help.
@PaigeMiller wrote:
Show us the ENTIRE log for this PROC SQL. Showing us an error detached from the code doesn't usually help.
Any bets that this new data was created with Proc Import and the result is one or more of the variables changing type.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.