Hi,
I have 2 datasets, 1 data with date and value, and the other data has start and end date.
I want to find the Max value between start and end date.
I can do it with my code below but I think there should be a better way using Proc SQL.
Can you please help?
Thanks,
HHC
data have;
input date value;
datalines;
1 5
2 6
3 8
4 1
5 9999
6 99
;run;
data condition;
input start end;
datalines;
2 4
3 6
;run;
proc sql;
create table temp as select * from condition as a left join have as b
on a.start<=b.date<a.end; quit;
proc sort data=temp; by start end descending value;
data want; set temp;
by start end;
if first.end; run;