BookmarkSubscribeRSS Feed
vallsas
Pyrite | Level 9

HI,

I am creating the join by using the query builder where as my source tables both are directly reading from DB as one of the table join column is not matching (data type) with other table join column , where as i know eg programming while joining in proc sql we can convert to numeric(input) and join the tables  but here the problem is we are reading from db  in query builder and joining.The error saying data type not matching on the join column.

any ideas with out locally creating and coNverting the column , i want to do directly in query builder join even if data type is different .

3 REPLIES 3
ballardw
Super User

Are these two external tables from the same database? If so, my first feeling would be to talk to the data base administrator about why the types are different and see if the admin will provide a work around, such as view in the database that does the conversion and you can use that as your source.

 

If they are not from the same database it may be unreasonable to expect them to be of the same type(or properties) and a conversion somewhere will be needed. Again you may convince one of the database admins to make a conversion view of the needed data.

vallsas
Pyrite | Level 9
The both tables are from same database but as per the business they have created the data type as character in one table.So we need to handle at the analysis side and looking for best option without creating the temp table I would like to do in query builder only .I wonder that we can do by code without creating a temp table but not in query builder.
Kurt_Bremser
Super User

I doubt that the query builder allows a function to be applied before the join is defined. You either need two steps (define a view which does the conversion, then join), or you write the SQL yourself in a code node.

 

A business item (and one used for joining!) stored as a number in one table, and character in another? My word for this is "clusterfuck". Somebody needs to have their head examined for possible absence of a brain.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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