I would like to join two tables using one of EG's built in features like query builder. The two columns I would like to use contain matching characters, but also contain other extraneous ones. Both columns are character columns, but one contains a max length of 12 and the other a max length of 128. Is it possible to join these two tables?
Example Column 1
E001234
E012345
E123456
Example Column 2
Hi
Could you please explain a bit more like what you have and what you would like to get?
You can chnage the length. But it looks like your column1 (numeric part)) are same as the numeric part of column2.
Do you like to match on these?
Here is a suggestion:
create a column (say match_col) as the numeric part from Column1
create a column(same name match_col) as the numeric part from Column2
then match the tables on match_col
Thanks
Mita
Hi Mita,
I have two tables, and I would like to use the common numbers between one column in each table to merge two tables into one.
I don't know how to create new columns and only bring the numbers over from the existing columns I would like to match.
Yes it's possible.
In your example it looks you can make them "look" the same.
So lets work on making the columns in Table 2 look like the ones in Table 1.
It looks like the ones in table one all start with E and have 6 digits afterwards. Assuming this is consistent across all your data, then we can make the ones from Table 2 similar by
1) Extracting first portion of the email (use Scan() Function)
2) Making the number a length of 6 by zero padding. (Use Z6. Format in a put statement)
3) Adding an E to the beginning (Concatenate)
For EG make a calculated column that implements this and then join on the calculated column.
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!
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.