SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2239 views
  • 4 likes
  • 3 in conversation