BookmarkSubscribeRSS Feed
thegraduate
Calcite | Level 5
Hi All,

Quite a simple one for most, i have two tables with a URN for each, one is a text and one is a number. When i link them, it gives me an error due to invalid field type (ERROR: Expression using equals (=) has components that are of different data types.)

How can I convert one of the fields so it is a number?

Thanks.
4 REPLIES 4
SASKiwi
PROC Star
You haven't said how you are doing the joining.

However in SAS SQL you can do:

create table xxxx as
select *
from table1 as a, table2 as b
where a.urn = input(b.urn,12.);

Here I am assuming that table1 has the numeric URN and table2 the character one.
thegraduate
Calcite | Level 5
Hi,

I am joining through Query builder.

So Table one has AccountNumber (Text)
Table two has AccNum(Number)

Just wondering how I would do it through there?
SASKiwi
PROC Star
I suggest you use the computed column option, and the Advanced Expression Editor to type in the INPUT function as I have already mentioned, to create a new computed column that converts the character column to numeric. Then you should be able to use the new computed column in your join.
deleted_user
Not applicable
Nice to see a kiwi here lol

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 14246 views
  • 1 like
  • 3 in conversation