Hi I am trying to update the value for x in table zz
Proc SQL;
Update apple.zz
Set x = 'Y';
(select * from apple.hh p
join apple.zz d
on d.id = p.ID
and p.drd = 20
and c_ga =5
and x = 'N');
Quit;
can anyone please help
It is not clear what table c_ga belongs to but the query should either be :
Proc SQL;
Update apple.zz as d
Set x = 'Y'
where
x='N' and
c_ga=5 and
exists (select * from apple.hh where drd=20 and ID = d.id);
Quit;
/* OR */
Proc SQL;
Update apple.zz as d
Set x = 'Y'
where
x='N' and
exists (select * from apple.hh where drd=20 and c_ga=5 and ID = d.id);
Quit;
What did you try to do with that select in brackets?
It is not clear what table c_ga belongs to but the query should either be :
Proc SQL;
Update apple.zz as d
Set x = 'Y'
where
x='N' and
c_ga=5 and
exists (select * from apple.hh where drd=20 and ID = d.id);
Quit;
/* OR */
Proc SQL;
Update apple.zz as d
Set x = 'Y'
where
x='N' and
exists (select * from apple.hh where drd=20 and c_ga=5 and ID = d.id);
Quit;
x,c_ga is from apple.zz table
and drd from apple.hh table
It worked . Thank you So much
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.