Hi,
Can't find the solution to the error. pls help.
proc sql;
create table pledge20 as select
a.*,
b.waterfall_frb_ny as waterfall_frb_ny_pbnew ,
case when b.loan_nb is null then 1 else 0 end as missingpb
from pledge15 as a left join PledgeDataLoanLevel8 as b
on a.loan_number2 = b.loan_nb
;
quit ;
Cykelops
From now on, please help us out by posting the log for the PROC SQL (or whatever step has the error), including the code as it appears in the log. Do not show us error messages detached from the code as it appears in the log.
a.loan_number2 = b.loan_nb
One of these two variables is numeric, and the other is character. So you will have to convert one of these two variables to the other data type.
So let's suppose b.loan_nb is a character variable. The code to convert b.loan_nb to numeric would be
a.loan_number2 = input(b.loan_nb,32.)
and that should work. Or if a.loan_number2 is character, then a similar change will make that work.
Hi @Cykelops, can you share the log after you run this query?
From now on, please help us out by posting the log for the PROC SQL (or whatever step has the error), including the code as it appears in the log. Do not show us error messages detached from the code as it appears in the log.
a.loan_number2 = b.loan_nb
One of these two variables is numeric, and the other is character. So you will have to convert one of these two variables to the other data type.
So let's suppose b.loan_nb is a character variable. The code to convert b.loan_nb to numeric would be
a.loan_number2 = input(b.loan_nb,32.)
and that should work. Or if a.loan_number2 is character, then a similar change will make that work.
Thank you!
Cykelosps
This is the second question with essentially the same problem cause: Not knowing your data.
Almost certainly you are going to have more of these, just different variables. Time to learn PROC CONTENTS to examine data sets to get properties of variables and likely to review exactly how all of these data sets are created that allow different types of variables to be created that likely should be of the same type.
General note: if a variable is not used for arithmetic, especially if it is an identifier like "account number", "product code", "part number" or similar the variable should not be numeric. But the define lengths may need to be consistent if appearing in multiple data sets.
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.