Hello SASAcc,
I am not sure that understand you correctly. What do you mean by t1 = max(0,c1 - c4);?
Is this t1 = max(0,c1,c2,c3);
or t1 = max(0,c1-c3):?
Using c4 is impossible because c1, c2, c3 are numeric and c4 is character.
Anyway this my solution:
[pre]
Data New;
input c1 c2 c3 c4 $;
datalines;
1 2 3 c2
1 3 5 c1
run;
data a;
set new;
t1 = max(0, c1,c2,c3);
if c4="c2" then c2=t1;
else if c4="c1" then c1=t1;
drop t1;
run;
[/pre]
Sincerely,
SPR