BookmarkSubscribeRSS Feed
podarum
Quartz | Level 8

Hi,  I'm not that familiar with the update step in SAS.  I have a code in Teradata that uses update, and I need to find the equivalent in proc sql.. However, I'm not sure if the way I have it set out is the most optimal way.  In my Proc SQL, it's taking way to long to process.

Teradata SQl Code:

UPDATE ACCT_TABLE

   FROM BAL_TABLE A

   SET CURR_STRT_DT = SNAP_DT

   WHERE ACCT_TABLE.ARQ_ID = A.ARQ_ID

     AND ACCT_TABLE.OD_CURR_STRT_DT IS NULL

     AND ACCT_TABLE.ACCT_OPEN_CLS_STS = 'O'

     AND A.BAL_INCL_B < 0

;

PROC SQL  (My)

proc sql;

  update ACCT_TABLE B

set CURR_STRT_DT = (select SNAP_DT from BAL_TABLE  A

          WHERE A.ARQ_ID = B.ARQ_ID

          AND B.SNAP_DT is NULL

          AND B.ACCT_OPEN_CLS_STS = 'O'

          AND A.BAL_INCL_B < 0)

;quit;

3 REPLIES 3
kiranv_
Rhodochrosite | Level 12

If both tables are in Teradata, then explicit pass through would be good

podarum
Quartz | Level 8

The tables are originally from Teradata, but I was able to bring them locally into my SAs server, and I have to update them there.  Using the second code.

kiranv_
Rhodochrosite | Level 12

if you have both tables in Teradata, if possible please run an explain plan and check what it tell you. How large are this tables. if you both tables in Teradata, it is always a good practice to do it in Teradata

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 808 views
  • 0 likes
  • 2 in conversation