Hi Colleagues,
I have these 2 datasets.
data table_1;
input Account_number;
cards;
11111111
12222222
;
run;
data table_2;
input Account_number Account_name $ 10-26;
cards;
11111111 AAAAA IIIII LLLL
100000 WWWWWWW SSSSS DDD
100002 TTTTTT EEEEEEE
102222 NNNNNN
12222222 OOOOOO YYYYYYY
;
run;
Question:
When join the above 2 tables using below code, it does the job correctly but a warming comes in the log like this:
/*WARNING: Variable Account_number already exists on file WORK.ANY_NAME.
*/
How come this? How could I get rid of it?
proc sql;
create table any_name as
select a.* ,
b.*
from table_1 a,
table_2 b
where a.account_number=b.account_number;
quit;
Your heilp is greatly appreciated.
Thanks
Mirisage
Just loose the a.* in the select
proc sql;
create table any_name as
select a.* ,
b.*
from table_1 a,
table_2 b
where a.account_number=b.account_number;
quit;
Since you're selecting just the key from A, and the where clause restricts the query to a inner join (same value on both sides), it' doesn't matter from which table comes the Account_Number.
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
Just loose the a.* in the select
proc sql;
create table any_name as
select a.* ,
b.*
from table_1 a,
table_2 b
where a.account_number=b.account_number;
quit;
Since you're selecting just the key from A, and the where clause restricts the query to a inner join (same value on both sides), it' doesn't matter from which table comes the Account_Number.
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
In case you have two data sets that have multiple variables you wish to keep, you can use the <dsnam>* approach for one but for the other you need to specify the variables you wish to extract from it but not the key variable. You will then not get tthat warning
Hi Jerry,
Thank you very much for your inputs.
Regards
Mirisage
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.