Is anyone aware of a good technique to stop the following message from appearing when joining tables using PROC SQL?
"WARNING: Variable XXXX already exists on file WORK.XX"
In my example below I want to select all exclusive fields in both tables A and B as well as the fields used to join (I don't care which table the join fields come from as it makes no difference).
UPDATE: I don't want to have to type them all out explicitly because I have a large number of fields in each table.
If for some reaons you can't (or don't want to) hard code all the variable names, you can use a couple of dictionary queries to build a warning-free select statement in macro, as per the following example:
Make sure the table aliases you use are the same as the prefixes you use in the "cats" function!
This didn't come out as neatly as I'd have liked it to, can anybody figure out a way to make it work with a single (and not horribly complex) dictionary query?
-- Regards, Will
answered 22 Sep '10, 15:32
PROC SQL statement option NOWARN.
answered 24 Sep '10, 19:59
Not knowing the scope of this NOWARN option, I rather use the official SAS solution:
proc sql; create table all(drop=tmpid) as select * from one, two(rename=(id=tmpid)) where one.id = two.tmpid; quit;
answered 03 Nov '10, 15:50
Spell out your select statement in more detail, and only select the overlapping variable(s) from one table:
answered 22 Sep '10, 10:51
Martin Bøgelund ♦