BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Cykelops
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

4 REPLIES 4
antonbcristina
SAS Employee

Hi @Cykelops, can you share the log after you run this query?

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 708 views
  • 0 likes
  • 4 in conversation