BookmarkSubscribeRSS Feed
Pablo
Calcite | Level 5
Hello Experts,

Is it possible to execute a multiple column update using proc sql?. Example Query:

update tableA T
set ( column1,
column2,
column3) = (select S.column1,
S.column2,
S.column3
from tableB S
where S.filter1 = T.Filter1)

This type of update can be executed in Oracle

Thanks for your help.

Pablo.
2 REPLIES 2
DBailey
Lapis Lazuli | Level 10
I believe you have to do it this way:

update tableA T
set column1 = (select S.column1 from tableB S where S.filter1 = T.Filter1),
column2 = (select S.column2 from tableB S where S.filter1 = T.Filter1),
column3 = (select S.column1 from tableB S where S.filter1 = T.Filter1)
where
t.filter1 in (select filter1 from tableb);

If you don't do the last criteria, then you will get null values populated when there is no match.
Pablo
Calcite | Level 5
Thanks DBailey for your response.

Yes, I was aware of that method with SAS, but it is not an option for me at the moment. I just created a direct connection to Oracle so the update statement will be executed at the Database not at the SAS server and it is working ok.

It seems like SAS does not support vector style queries.

Thanks for your help.

Pablo.

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