SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
MadhuriDara
Calcite | Level 5
Hi, I am using SAS 9.3 to connect to SQL Server 2017 (AWS RDS) . I run an update statement like this: libname SQL ODBC DSN=SQL_ODBC UID=UID PASSWORD=PWD DIRECT_EXE=DELETE; PROC SQL; UPDATE SQL.TAB100 SET KEY = 1 WHERE KEY IN (SELECT KEY FROM SQL.TAB200); QUIT; TAB100 has 5.3 million rows and TAB200 has 2 rows. This SAS statement just hangs for 2-3 hrs. When the update stmt is run on the SQL Server database it takes 2 sec. I have tired creating DSN with both these dlls: MSODBCSQL17.DLL and SQLNCLI11.DLL. The SAS statement hangs with both the ODBC DSNs. Could you please share your thoughts on how it could be improved. Thanks Much, Madhuri Dara
1 REPLY 1
ChrisNZ
Tourmaline | Level 20

There is a wonderful thing called formatting, which is linked to another invention called paragraphs.

You should try to look into that. I hear it helps written communication.

 

Regarding your question, you should use explicit SQL pass-through.

The syntax is something like this:

proc sql;
  connect using SQL;
  execute by SQL (
    update TAB100 set KEY = 1 where KEY in (select KEY from TAB200)
  );
quit; 

The way you wrote your query, the whole tables are sent to SAS and then back.

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
  • 1 reply
  • 632 views
  • 1 like
  • 2 in conversation