Hi everyone,
I have a numeric variable, lets call it 'times'. I have a macro variable 'myTime' defined to be some value, lets say 200. I would like to extract the closest value in 'times' to 'myTime' as a new macro variable 'closestTime'.
Would anyone know how to modify the code below so it gives the closest time instead of the smallest difference? (Or know of some other way I could extract the closest time into a macro variable?). Help is much appreciated!
proc sql noprint;
select min(abs(times-&myTime) )
into :closestTime
from myData;
quit;
thank you!
I have a numeric variable, lets call it 'times'. I have a macro variable 'myTime' defined to be some value, lets say 200. I would like to extract the closest value in 'times' to 'myTime' as a new macro variable 'closestTime'.
Would anyone know how to modify the code below so it gives the closest time instead of the smallest difference? (Or know of some other way I could extract the closest time into a macro variable?). Help is much appreciated!
proc sql noprint;
select min(abs(times-&myTime) )
into :closestTime
from myData;
quit;
thank you!