Hi to all,
i need to take observation that are not stricly > or < of a number but are nearest of a number … which function i need to use?
Many tnks.
Tecla
OK, this perhaps then ?
proc sql;
CREATE TABLE want AS
SELECT *
FROM have
HAVING abs(x-75)=min(abs(x-75));
quit;
Hello,
Something like this ?
%let precision=1.0e-6;
data have;
input x y;
cards;
1 1.0001
1 0.9999
1 1.0000001
1 0.9999999
;
run;
proc sql;
CREATE TABLE equals AS
SELECT *
FROM have
WHERE abs(x-y)<&precision.;
quit;
Hi Tnks for your kindly reply….
non so much because i don't have a dimension for the around , the around can be bigger but the only i have ….
Example:
If I find an around of 75 and I have only one more observation , like 20... my result will be 20....
I'm clear ? excuse for my english…
Tecla
You can compute the difference between the two values as absolute percentage of of the lowest/highest value
and check vs some logical limit/
OK, this perhaps then ?
proc sql;
CREATE TABLE want AS
SELECT *
FROM have
HAVING abs(x-75)=min(abs(x-75));
quit;
TNKS SO MUCH !!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.