Hi everyone,
I am using SAS EG 8.3 to query Snowflake database. I wrote a query like below:
proc sql; select count(*) as cnt from ( select col1, col2, col3... (there are 12 columns) from tbl1 inner join tbl2 on ... inner join tbl3 on ... where ... ) quit;
the expected cnt should be 337,947 because I ran similar code in snowflake successfully (less than 1 minute). But I got errors saying
My question is how to modify the code so it can run in SAS? Because I need the 337,947 records for further analysis.
To me, I feel the code is trying to pull all data into local machine before aggregation. Is the code supposed to be run in Snowflake?
Thanks!
Move it into the Snowflake server.
Say you have a libref named SNOW pointing to Snowflake then use code like:
proc sql;
connect using snow;
select cnt from connection to snow (
select count(*) as cnt from (
select
col1, col2, col3... (there are 12 columns)
from tbl1
inner join tbl2
on ...
inner join tbl3
on ...
where ...
))
;
quit;
Move it into the Snowflake server.
Say you have a libref named SNOW pointing to Snowflake then use code like:
proc sql;
connect using snow;
select cnt from connection to snow (
select count(*) as cnt from (
select
col1, col2, col3... (there are 12 columns)
from tbl1
inner join tbl2
on ...
inner join tbl3
on ...
where ...
))
;
quit;
it works! Thank you @Tom
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.