Desktop productivity for business analysts and programmers

Update a field conditioning another field

Reply
Occasional Contributor
Posts: 17

Update a field conditioning another field

Hi. I'm new with SAS and I have a problem with EG 5.1. I need Update a Field, but conditioning another field. For example:

 

AMOUNT SITUATION

100        

200

530

 

When "AMOUNT" <500 , then UPDATE field "SITUATION" with the char "Menores", and if AMOUNT >=500, then UPDATE with the char "Mayores".

 

I tried, but I couldn't fix it. Is possible makei without a code? (just using the GUI of EG)

 

Thanks in advanced.

Grand Advisor
Posts: 17,360

Re: Update a field conditioning another field

You can use Query Builder with a computed column. Use either advanced with a CASE statement or a variable RECODE. If you're going through the point and click the RECODE option may be easier for you.

I don't know think EG supports updates in place, but it looks like a new variable anyways. Otherwise if you really need to only update the table, you may want to write a data step.

data want;
set want;
if amound>500 then situation='Menores';
else if amount>=500 then situation='Mayores';
run;
Ask a Question
Discussion stats
  • 1 reply
  • 206 views
  • 0 likes
  • 2 in conversation