turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How to 'print' the remaining data after remove the...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-07-2017 11:49 AM

Hi,

How can I 'print' the data that has been removed the outliers. Specially when it is univariate data.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NURAO

08-07-2017 12:50 PM

You might want to show the code for what you are currently doing and even some example data so we can see some of your outliers. Example data really only would need one variable with outliers.

Default output for proc univariate shows the largest and smallest values by default. Do you need more than those?

Likely the approach is going to involve either manually writing a where clause for proc print or code to extract some key values to use as limits.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ballardw

08-08-2017 04:06 AM

PROC IML;

RESET NONAME;

A={2,2,3,3,3,3,3,3,3,4,4,4,

4,4,5,5,5,6,6,6,7,7,7,8,

8,9,10,14,14,15,20,21,23};

mini=A[><,];

Q=quartile (A);

Q3=Q[4,1];

Q1=Q[2,1];

IQR=Q3-Q1;

L2=Q1-(1.5*IQR);

U2=Q3+(1.5*IQR);

PRINT "L2=" L2,

"U2=" U2;

maxA=max (A);

minA=min (A);

print "mini=" minA,

"max=" maxA;

Here, L2 and U2 are the fences to detect outliers. Based on data A, 20,21 and 23 are the outliers. So my intention is, i want to "print" the data set A by excluded those outliers.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NURAO

08-08-2017 09:48 AM

You should just have to use the LOC function to subset the matrix.

newa=a[loc(a>l2 & a<u2)];

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SAS_Rob

08-08-2017 10:42 PM

Thank you

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NURAO

08-08-2017 10:01 AM

You really should post it at IML forum, since your code is IML code.

```
PROC IML;
RESET NONAME;
A={2,2,3,3,3,3,3,3,3,4,4,4,
4,4,5,5,5,6,6,6,7,7,7,8,
8,9,10,14,14,15,20,21,23};
mini=A[><,];
Q=quartile (A);
Q3=Q[4,1];
Q1=Q[2,1];
IQR=Q3-Q1;
L2=Q1-(1.5*IQR);
U2=Q3+(1.5*IQR);
PRINT "L2=" L2,
"U2=" U2;
maxA=max (A);
minA=min (A);
print "mini=" minA,
"max=" maxA;
left=A[loc(L2<a & a<U2)];
print "exclude outliers: " left;
quit;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ksharp

08-08-2017 10:44 PM

Got it. Thank you