Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error updating a table with a Join

Status
Not open for further replies.

LongerSAS

Technical User
Jul 24, 2012
2
0
0
CA
This is driving me crazy, why is the following code:

update bell.ldbase2011

set
FORBEARANCE_IND = FORBEARANCE_IND
FROM
bell.forbearance2 AS f left join bell.ldbase2011.FORBEARANCE_IND AS b
ON
f.ACCT_ID = b.ACCT_ID

Give me an error in the log:


1544 update bell.ldbase2011 k
1545
1546 set
1547 FORBEARANCE_IND = bell.forbearance2.FORBEARANCE_IND
-
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, !!, *, **, +, ',', -, /, WHERE,
||.

ERROR 76-322: Syntax error, statement will be ignored.

1548 FROM
1549 bell.forbearance2 AS f left join bell.ldbase2011.FORBEARANCE_IND AS b
1550 ON
1551 f.ACCT_ID = b.ACCT_ID
1552 Quit;
 
Hi

It seems you are in some sort of confusion.
Updateing a master dataset using a another dataset and Joining two datasets are completely distinct operations.

In addition to that the code you have used do cater to any of those requirements.

1. for updating a master dataset using anohter dataset use UPDATE statement (you can find the brief description about it here - [URL unfurl="true"]https://sites.google.com/site/sasbuddy/update-statement-combining-sas-datasets[/url] )

2. For Joinging two datasets there are multiple ways but the common one is using PROC SQL.

Hope this would clear your doubts.





sasbuddy
 
Hey Sasbuddy,

Looks like you are the confused one, I am using proc sql (pretty obvious I thought) and I am using update, also pretty evident from the line "update bell.ldbase2011". I think the error is a bug - this is SAS9.2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top