BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hexx18
Quartz | Level 8


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

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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;

 

PG

View solution in original post

5 REPLIES 5
hexx18
Quartz | Level 8
I am not sure if my code works it might be wrong too
PGStats
Opal | Level 21

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;

 

PG
hexx18
Quartz | Level 8

x,c_ga is from apple.zz table

 

and drd from apple.hh table

 

hexx18
Quartz | Level 8

It worked . Thank you So much

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

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
  • 5 replies
  • 1085 views
  • 0 likes
  • 3 in conversation