<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to exclude highest and lowest value from dataset? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340405#M63243</link>
    <description>&lt;P&gt;To help with your Googling, this technique (removing the extreme observations) is known as "trimming". &amp;nbsp;You can use PROC UNIVARIATE to get the trimmed means. You can read about some of the &lt;A href="http://blogs.sas.com/content/iml/2017/02/08/winsorization-good-bad-and-ugly.html" target="_self"&gt;statistical shortcomings that are associated with trimming (or "Winsorizing") data&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to perform a robust ANOVA, the best way is to use a statistical procedure that is not sensitive to outliers. There is an example in the SAS documentation that shows &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_rreg_examples02.htm" target="_self"&gt;how to use PROC ROBUSTREG to perform a robust ANOVA&lt;/A&gt;. By using PROC ROBUSTREG, you will not throw away good data unnecessarily, which is what happens when you automatically discar the minimum and maximum values in each group.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2017 13:27:46 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-03-13T13:27:46Z</dc:date>
    <item>
      <title>How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22091#M4777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;google wasn't much help on my problem so I try to find a solution here. &lt;/P&gt;&lt;P&gt;I have 12 observations from an experiment but only want to use 10 for the Anova. Therefore I want to exclude the lowest and the highest value. which command in the data step does that? i have the observation sorted by size with proc sort but don't find the right coding to do that.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 09:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22091#M4777</guid>
      <dc:creator>Eistee87</dc:creator>
      <dc:date>2011-06-28T09:58:28Z</dc:date>
    </item>
    <item>
      <title>How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22092#M4778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After you sort the data by the variable, use the first.&amp;nbsp; and&amp;nbsp; last.&amp;nbsp; to delete the records.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;proc sort data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt; by x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.x then delete;&lt;/P&gt;&lt;P&gt;if last.x then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dataset test should now have every record but the lowest and highest value of x.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 12:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22092#M4778</guid>
      <dc:creator>garybald</dc:creator>
      <dc:date>2011-06-28T12:01:47Z</dc:date>
    </item>
    <item>
      <title>How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22093#M4779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; proc sort data=dummy;&lt;/P&gt;&lt;P&gt;by l;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dummy;&lt;/P&gt;&lt;P&gt;set dummy;&lt;/P&gt;&lt;P&gt;by l;&lt;/P&gt;&lt;P&gt;if first.l then delete;&lt;/P&gt;&lt;P&gt;if last.l then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 12:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22093#M4779</guid>
      <dc:creator>manojinpec</dc:creator>
      <dc:date>2011-06-28T12:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22094#M4780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless I've misunderstood the OP, I don't think this would work unless the dataset were sorted by an additional field that was the same in all rows.&amp;nbsp; Worst case, if all values are unique then every row would be deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data &lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;i = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1 &lt;/STRONG&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;to &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = ranuni(-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;output&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;end&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;drop &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc &lt;/SPAN&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;sort&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;by &lt;/SPAN&gt;n;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data &lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test_out1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;set &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt; n;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;if &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;first.n &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;delete&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;if &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;last.n &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;delete&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in no rows ever being output.&amp;nbsp; It would work perfectly if there were an additional field that was also part of the sort (e.g. 1 or more categories): such as below: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data &lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;cat = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;do &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;i = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = ranuni(-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;output&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;end&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;cat = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;do &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;i = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = ranuni(-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;output&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;end&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;drop &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;proc &lt;/SPAN&gt;&lt;SPAN style="color: navy; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;sort&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;=test2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;by &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;cat n;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data &lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test_out2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;set &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;test2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;by &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;cat;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;if &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;first.cat &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;then &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;delete&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;if &lt;/SPAN&gt;&lt;SPAN style="color: black; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;last.cat &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;then &lt;/SPAN&gt;&lt;SPAN style="color: blue; background-color: white; font-family: 'Courier New'; font-size: 10pt;"&gt;delete&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One question for the op though - what happens if the first two rows have the same value?&amp;nbsp; If you would want to remove both, then a two step approach is probably required - use proc freq (etc.) to pull the min/max values, and then link the results to the original dataset to remove these relevant rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 13:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22094#M4780</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-06-28T13:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22095#M4781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the dataset is sorted properly, and you truly only wanted to delete the very first record and the very last record, then this simple snippet will do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;data truncated;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set original end=eof;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_ = 1 | eof then delete;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;If there are multiple smallest values or maximum values, only one of them will be deleted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 17:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22095#M4781</guid>
      <dc:creator>DLing</dc:creator>
      <dc:date>2011-06-28T17:50:15Z</dc:date>
    </item>
    <item>
      <title>How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22096#M4782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table work.anova_obs as&lt;/P&gt;&lt;P&gt;select * from work.obs&lt;/P&gt;&lt;P&gt;where value &amp;gt; (select min(value) from work.obs)&lt;/P&gt;&lt;P&gt;and value &amp;lt;(select max(value) from work.obs);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should work if the value column doesn't have duplicates.&amp;nbsp; if it does and you only want to exclude one of them, then something like this might work.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select count(*)-1, count(*)-2 into :FirstObs, :SecondObs from work.obs;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort in=work.obs out=work.obs;&lt;/P&gt;&lt;P&gt;by value;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option obs=&amp;amp;FirstObs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.temp;&lt;/P&gt;&lt;P&gt;set work.obs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort in=work.temp out=work.temp;&lt;/P&gt;&lt;P&gt;by descending value;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option obs=&amp;amp;SecondObs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.anova_obs;&lt;/P&gt;&lt;P&gt;set work.temp&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option obs=max;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 18:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/22096#M4782</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-06-28T18:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340091#M63209</link>
      <description>&lt;P&gt;Could someone explain why this program would also delete the first observation? &amp;nbsp;I vaguely remember that SAS will return to the first observation but why would n=1 for the first observation? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 20:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340091#M63209</guid>
      <dc:creator>shor0016</dc:creator>
      <dc:date>2017-03-10T20:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340100#M63210</link>
      <description>&lt;P&gt;"If _n_=1| eof then delete;" &amp;nbsp; means delete the first or the last observation.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 20:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340100#M63210</guid>
      <dc:creator>shor0016</dc:creator>
      <dc:date>2017-03-10T20:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340247#M63226</link>
      <description>&lt;P&gt;You have the data sorted by size already?&amp;nbsp; Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set have (firstobs=2) end=end_of_have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if end_of_have=0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 18:10:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340247#M63226</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-03-12T18:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude highest and lowest value from dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340405#M63243</link>
      <description>&lt;P&gt;To help with your Googling, this technique (removing the extreme observations) is known as "trimming". &amp;nbsp;You can use PROC UNIVARIATE to get the trimmed means. You can read about some of the &lt;A href="http://blogs.sas.com/content/iml/2017/02/08/winsorization-good-bad-and-ugly.html" target="_self"&gt;statistical shortcomings that are associated with trimming (or "Winsorizing") data&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to perform a robust ANOVA, the best way is to use a statistical procedure that is not sensitive to outliers. There is an example in the SAS documentation that shows &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_rreg_examples02.htm" target="_self"&gt;how to use PROC ROBUSTREG to perform a robust ANOVA&lt;/A&gt;. By using PROC ROBUSTREG, you will not throw away good data unnecessarily, which is what happens when you automatically discar the minimum and maximum values in each group.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 13:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-exclude-highest-and-lowest-value-from-dataset/m-p/340405#M63243</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-03-13T13:27:46Z</dc:date>
    </item>
  </channel>
</rss>

