Reputation: 427
I want to compare three columns and make a new variable, start, that retains the earliest date recorded. I would love something to be more efficient because this computer is struggling.
data new1;
set new;
format start date MMDDYY10;
if input(service_start, MMDDYY10) < input(Pay_start,MMDDYY10) and input(service_start, MMDDYY10) < input(cost_start,MMDDYY10) then start = service_start;
Else if input(Pay_start,MMDDYY10) < input(service_start, MMDDYY10) and input(Pay_start,MMDDYY10) < input(cost_start,MMDDYY10) then start = pay_start;
Else start = cost_start;
run;
Upvotes: 1
Views: 535
Reputation: 164
data new1;
set new;
format start date MMDDYY10.;
start = min( input( service_start, MMDDYY10. ), input( Pay_start, MMDDYY10. ), input( cost_start, MMDDYY10. );
run;
Upvotes: 4