Hi all,
I have below table. I want to adjust my recovery column as per ID against any non-zero amount1.
data have;
infile cards delimeter= "," ;
input ID$ amount1 recovery;
cards;
a,10,0
a,20,0
a,30,40
b,0,0
b,10,5
b,20,40
; run;
data WANT:
ID | amount1 | recovery | final |
A | 10 | 0 | 10 |
A | 20 | 0 | 10 |
A | 30 | 40 | 0 |
B | 0 | 0 | 0 |
B | 10 | 5 | 0 |
B | 20 | 40 | 0 |
Thanks!
I don't understand this. Can you explain the exact logic behind the new variable?
If recovery > amount1 then you want to subtract recovery from amount1? That still does not make sense to me. Why not just set the new var to zero when this is fulfilled?
Please be very specific about the logic.
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.