BookmarkSubscribeRSS Feed
skygold16
Fluorite | Level 6

Hi All,

 

Has anyone experienced joining tables from SAS and Athena?

 

I have a requirement of joining table one in SAS and another in Athena.

 

proc sql noprint;
connect to ODBC as athn (DSN="AWS-Athena-SAS-xxx-xxx" );

create TABLE data.join(compress=char) as
select base.*
from connection to athn
(
Select A.id

       from data.table_in_sas A

       INNER JOIN table_in_s3 B
       ON A.id = B.id
) base;
disconnect from athn;
quit;

7 REPLIES 7
skygold16
Fluorite | Level 6

Hi All,

 

Has anyone experienced joining tables from SAS and Athena?

 

I have a requirement of joining table one in SAS and another in Athena.

 

proc sql noprint;
connect to ODBC as athn (DSN="AWS-Athena-SAS-xxx-xxx" );

create TABLE data.join(compress=char) as
select base.*
from connection to athn
(
Select A.id

       from data.table_in_sas A

       INNER JOIN table_in_s3 B
       ON A.id = B.id
) base;
disconnect from athn;
quit;

ChrisNZ
Tourmaline | Level 20
What is this? Why do you ask the same question twice? Do you understand the reply? Did you try?
ChrisNZ
Tourmaline | Level 20
Ah it makes more sense! :)I usually mark the second post as spam.No worries. Thanks.
skygold16
Fluorite | Level 6

Hope confusion is clear now. That wasn't intentional to ask same question again, but by mistake might have submited the same question twice. 

 

@ChrisNZ I will try your solution tomorrow and see if it works. 

 

 

ChrisNZ
Tourmaline | Level 20

This is not possible with any data base.

The join must take place where both tables are.

So either you download the athena table to sas or you upload the sas table to athena.

The does the former:

libname ATH odbc DSN="AWS-Athena-SAS-xxx-xxx" user=xxx etc ;
proc sql ;
  create table SASLIB.TAB3 as
  select *
  from ATH.TAB1, SASLIB.TAB2
  where ID1=ID2;
quit;

 

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
  • 7 replies
  • 1529 views
  • 4 likes
  • 3 in conversation