I would like to write below code using Nested If else condition using R programming. As I am using Aggregate function(MAX) to get maximum value from it. Do i need to use rowwise()? Can someone help me to get R code for below code,as I am new to R programming.
if (missing(eosdt)) then do;
if (COMPLSFL = 'Y') then
EOSDT = max( __plndeotdt, __plndfudt, __fuassdt);
else if dcsreas ne "DEATH" and not missing(dcsdt) then
EOSDT = dcsdt;
else if dcsreas = "DEATH" and (not missing(dcsdt) or not missing(__adjudicationdt)) then
EOSDT = max(dcsdt, __adjudicationdt);
else
EOSDT = max(__lastvisitdt, __aeonsetdt, __adjudicationdt);
end;