DATA Step, Macro, Functions and more

PROC SQL - UPDATE

Reply
Contributor scb
Contributor
Posts: 69

PROC SQL - UPDATE

Any idea to correct the syntax below?


PROC SQL;
UPDATE TABLEA
SET NAME='',ACCOUNT=''
WHERE ID =(SELECT ID FROM TABLEB WHERE AMOUNT LE 0);
QUIT;

 

I GOT THIS ERROR MESSAGE: ERROR: Subquery evaluated to more than one row.

Many Thanks.

Super Contributor
Posts: 252

Re: PROC SQL - UPDATE

Without having the data to prove the code on, this might work:

PROC SQL;
UPDATE TABLEA
SET NAME='',ACCOUNT=''
WHERE ID in(SELECT distinct ID FROM TABLEB WHERE AMOUNT LE 0);
QUIT;
Super User
Posts: 10,048

Re: PROC SQL - UPDATE

WHERE ID  IN  (SELECT ID FROM TABLEB WHERE AMOUNT LE 0);
QUIT;

Ask a Question
Discussion stats
  • 2 replies
  • 130 views
  • 0 likes
  • 3 in conversation