Hello Everyone,
I used the following code more than 1000 times to merge and the code never lets me down. However, now I am having a weird error sign which I can no way solve.
My original code is as follows:
proc sql;
create table C1 as
select a.*, b.*
from connection a
LEFT JOIN F1 b on a.ISIN = b.ISIN and a.year=b.fyear;
quit;
I get the following log report:
Could you please help me in figuring out the problem? I appreciate your help.
CONNECTION is a special word in SQL that has a special meaning, and it cannot be the name of a SAS data set.
That's why the error message say it is expecting TO, you have to specify a connection TO a database.
I think (i'm not sure) that you can't say a.* AND b.*
Try may be,
proc sql;
create table C1 as
select *
from connection a, F1 b
where a.ISIN = b.ISIN
and a.year = b.year ;
quit ;
I don't have test this but may be it works to :
proc sql;
create table C1 as
select *
from connection a
LEFT JOIN F1 b on a.ISIN = b.ISIN and a.year=b.fyear ;
quit;
CONNECTION is a special word in SQL that has a special meaning, and it cannot be the name of a SAS data set.
That's why the error message say it is expecting TO, you have to specify a connection TO a database.
@PaigeMiller wrote:CONNECTION is a special word in SQL that has a special meaning, and it cannot be the name of a SAS data set.
That's why the error message say it is expecting TO, you have to specify a connection TO a database.
I didn't know it, thanks for the learn
It is getting confused because of the CONNECTION TO keyword.
Just use a two level name
from work.connection a
Or a name literal
from 'connection'n a
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.