Help using Base SAS procedures

How could I get rid of this warning!

Accepted Solution Solved
Reply
Super Contributor
Posts: 338
Accepted Solution

How could I get rid of this warning!

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


Accepted Solutions
Solution
‎09-03-2012 01:03 PM
Super Contributor
Posts: 474

Re: How could I get rid of this warning!

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

View solution in original post


All Replies
Solution
‎09-03-2012 01:03 PM
Super Contributor
Posts: 474

Re: How could I get rid of this warning!

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

Occasional Contributor
Posts: 9

Re: How could I get rid of this warning!

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

Super Contributor
Posts: 338

Re: How could I get rid of this warning!

Hi Jerry,

Thank you very much for your inputs.

Regards

Mirisage


🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 194 views
  • 0 likes
  • 3 in conversation