<?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: To create a variable COUNTS which will have the counts of outliers. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802412#M315877</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks let me try this!&lt;BR /&gt;&lt;BR /&gt;Regards</description>
    <pubDate>Wed, 16 Mar 2022 03:37:49 GMT</pubDate>
    <dc:creator>Santt0sh</dc:creator>
    <dc:date>2022-03-16T03:37:49Z</dc:date>
    <item>
      <title>To create a variable COUNTS which will have the counts of outliers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802397#M315868</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I m trying to capture the count of the Outliers. I have used the below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA&amp;nbsp; &amp;nbsp;A;&lt;BR /&gt;INPUT A B C;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1 2 3&lt;BR /&gt;1 2 3&lt;BR /&gt;45 45 66&lt;BR /&gt;34 556 334&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;PROC UNIVARIATE DATA=A OUTTABLE=A1;&lt;BR /&gt;VAR A;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA A2;&lt;BR /&gt;SET A1;&lt;BR /&gt;UPPER=_Q1_ *(1.5 + _QRANGE_);&lt;BR /&gt;LOWER=_Q3_ *(1.5 - _QRANGE_);&lt;BR /&gt;CALL SYMPUT('UPPER', UPPER);&lt;BR /&gt;CALL SYMPUT('LOWER', LOWER);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;UPPER. &amp;amp;LOWER.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA X;&lt;BR /&gt;U="&amp;amp;UPPER.";&lt;BR /&gt;L="&amp;amp;LOWER.";&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA X;&lt;BR /&gt;SET A;&lt;BR /&gt;WHERE A GE &amp;amp;UPPER. OR A LE &amp;amp;LOWER.;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA X1;&lt;BR /&gt;SET A;&lt;BR /&gt;WHERE A GE &amp;amp;UPPER. ;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA X2;&lt;BR /&gt;SET A;&lt;BR /&gt;WHERE A LE &amp;amp;LOWER.;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 01:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802397#M315868</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-16T01:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: To create a variable COUNTS which will have the counts of outliers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802410#M315875</link>
      <description>&lt;P&gt;Here is an example of robust outlier detection in biological data (sampled fish measurements):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Calculate a body mass index (BMI) for each sampled fish */
data have;
set sashelp.fish;
BMI= weight / length1**3;
run;

/* identify the BMI outliers (fish that are too thin or too fat) */
proc robustreg data=have;
where species in  ("Perch" "Roach");
by species notsorted;
model BMI = / diagnostics(all);
output out=want outlier=outlier residual=residual;
run;

/* Report on the number of outliers for each species */
proc sql;
select * 
from want
where outlier;
select 
    species, 
    sum(outlier) as count
from want
group by species;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1647398318117.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69504iE6B3EE8FCE4A092A/image-size/large?v=v2&amp;amp;px=999" role="button" title="PGStats_0-1647398318117.png" alt="PGStats_0-1647398318117.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 02:42:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802410#M315875</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2022-03-16T02:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: To create a variable COUNTS which will have the counts of outliers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802412#M315877</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks let me try this!&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 16 Mar 2022 03:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802412#M315877</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-16T03:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: To create a variable COUNTS which will have the counts of outliers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802899#M316118</link>
      <description>Thank you for the suggestion!!&lt;BR /&gt;It worked</description>
      <pubDate>Sat, 19 Mar 2022 11:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802899#M316118</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-19T11:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: To create a variable COUNTS which will have the counts of outliers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802903#M316122</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183704"&gt;@Santt0sh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark the reply from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; as the correct answer, and unmark your own reply as the answer.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2022 12:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-create-a-variable-COUNTS-which-will-have-the-counts-of/m-p/802903#M316122</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-19T12:48:36Z</dc:date>
    </item>
  </channel>
</rss>

