🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 11-02-2018 06:17 AM
(2195 views)
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
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
OK, this perhaps then ?
proc sql;
CREATE TABLE want AS
SELECT *
FROM have
HAVING abs(x-75)=min(abs(x-75));
quit;
5 REPLIES 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can compute the difference between the two values as absolute percentage of of the lowest/highest value
and check vs some logical limit/
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
OK, this perhaps then ?
proc sql;
CREATE TABLE want AS
SELECT *
FROM have
HAVING abs(x-75)=min(abs(x-75));
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
TNKS SO MUCH !!