Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This has been the MOST helpful forum that I have been a part of and I want to say thank you. The tips, tricks and helpful advice that you all contribute to have been lifesavers in many instances..."

Geography

Where in the world do Tek-Tips members come from?
felicity1212 (Programmer)
24 May 12 15:51
Hi. I am trying to update 4 columns in one table with information from 4 columns in another table. The error message i received says:
ERROR 79-322: Expecting a SET.

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


Here is my code, can someone help me please?
THank you!!

PROC SQL;
UPDATE
WORK.YODDAYODDA slmbrs

JOIN DWH.MEMBERS mbrs ON slmbrs.HFMemberID = mbrs.membno

JOIN DWH.PROVIDER prov ON mbrs.pcpno = prov.provno

SET

slmbrs.pcpid = mbrs.pcpno,
slmbrs.pcpparent = prov.parent,
slmbrs.pcpfirstname = prov.pfstnam,
slmbrs.pcplastname = prov.plstnam;
QUIT;

sasbuddy (Programmer)
25 May 12 4:10
Hi,

It seems there is problem with the syntax;
you should you corelated subquery for this, as shown below.

CODE :

PROC SQL;
UPDATE
WORK.YODDAYODDA slmbrs
SET
slmbrs.pcpid = (select mbrs.pcpno where slmbrs.HFMemberID = mbrs.membno),
slmbrs.pcpparent = (select prov.parent where mbrs.pcpno = prov.provno ),
slmbrs.pcpfirstname = (select prov.pfstnam where mbrs.pcpno = prov.provno ),
slmbrs.pcplastname = (select prov.plstnam where mbrs.pcpno = prov.provno );
QUIT;

********************************************************************
However my suggestion would be as this is query is using multiple joins;
it better to join all the three tables in query creating a temporary dataset and then
making changes to that dataset.

sasbuddy
http://sites.google.com/site/sasbuddy/

felicity1212 (Programmer)
25 May 12 9:34
the datasets are really large. idk if i should make a temporary dataset out of them.

I would like to work with the code that you gave me, thank you. but i still need to join the tables together to do the update. anyway you can help me with that portion too

I redid the code. and then got an error that says expecting an "="



PROC SQL;

UPDATE

WORK.leads slmbrs

SET

slmbrs.pcpid = mbrs.pcpno,
slmbrs.pcpparent = prov.parent,
slmbrs.pcpfirstname = prov.pfstnam,
slmbrs.pcplastname = prov.plstnam

FROM

slmbrs

INNER JOIN DWH.MEMBERS mbrs ON slmbrs.HFMemberID = mbrs.membno
INNER JOIN DWH.PROVIDER prov ON mbrs.pcpno = prov.provno;



QUIT;


sasbuddy (Programmer)
29 May 12 2:39
HI,

Please try following code.

PROC SQL;
create table leads as
select slmbrs.*, mbrs.pcpno, prov.parent, prov.pfstnam, prov.plstnam
from
WORK.leads slmbrs, DWH.MEMBERS mbrs, DWH.PROVIDER prov
where
slmbrs.HFMemberID = mbrs.membno
and mbrs.pcpno = prov.provno;
quit;

data leads(drop=pcpno parent pfstnam plstnam);
set leads;
if not missing(pcpno) then pcpid = pcpno;
if not missing (parent) then pcpparent = parent ;
if not missing (pfstnam) then pcpfirstname = pfstnam;
if not missing (plstnam) then pcplastname = plstnam;
run;

********************
I hope this will work. Best luck.

sasbuddy
http://sites.google.com/site/sasbuddy/

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close