BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nazmul
Quartz | Level 8

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:

Capture.PNG

 

Could you please help me in figuring out the problem? I appreciate your help.


 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

5 REPLIES 5
Onizuka
Pyrite | Level 9

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;
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Onizuka
Pyrite | Level 9

@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

nazmul
Quartz | Level 8
Thank you for the solution. It has been a great help and great learning experience
Tom
Super User Tom
Super User

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1141 views
  • 9 likes
  • 4 in conversation