<?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 Trying to see outliners with proc sql but having problem with char/num in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-see-outliners-with-proc-sql-but-having-problem-with/m-p/926991#M41584</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate outliners within a datset trying:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;SELECT&lt;BR /&gt;CASE&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.25 * b.total_rows) THEN 1&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.5 * b.total_rows) THEN 2&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.75 * b.total_rows) THEN 3&lt;BR /&gt;ELSE 4&lt;BR /&gt;END AS quartile,&lt;BR /&gt;AVG(a.value) AS quartile_value&lt;BR /&gt;FROM&lt;BR /&gt;(SELECT value, row_num() AS row_num FROM MYDATASET) AS a&lt;BR /&gt;INNER JOIN&lt;BR /&gt;(SELECT count(*) AS total_rows FROM MYDATASET) AS b&lt;BR /&gt;ON&lt;BR /&gt;1=1&lt;BR /&gt;GROUP BY&lt;BR /&gt;quartile;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset have three col=sector (char), country (char), value (num)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Function ROW_NUM could not be located.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;1451 quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I can't use OVER or HAVING or such beacuse of my version of my computer,&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 May 2024 10:41:21 GMT</pubDate>
    <dc:creator>cleokatt</dc:creator>
    <dc:date>2024-05-04T10:41:21Z</dc:date>
    <item>
      <title>Trying to see outliners with proc sql but having problem with char/num</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-see-outliners-with-proc-sql-but-having-problem-with/m-p/926991#M41584</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate outliners within a datset trying:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;SELECT&lt;BR /&gt;CASE&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.25 * b.total_rows) THEN 1&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.5 * b.total_rows) THEN 2&lt;BR /&gt;WHEN a.row_num &amp;lt;= ceil(0.75 * b.total_rows) THEN 3&lt;BR /&gt;ELSE 4&lt;BR /&gt;END AS quartile,&lt;BR /&gt;AVG(a.value) AS quartile_value&lt;BR /&gt;FROM&lt;BR /&gt;(SELECT value, row_num() AS row_num FROM MYDATASET) AS a&lt;BR /&gt;INNER JOIN&lt;BR /&gt;(SELECT count(*) AS total_rows FROM MYDATASET) AS b&lt;BR /&gt;ON&lt;BR /&gt;1=1&lt;BR /&gt;GROUP BY&lt;BR /&gt;quartile;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset have three col=sector (char), country (char), value (num)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Function ROW_NUM could not be located.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data&lt;BR /&gt;types.&lt;BR /&gt;1451 quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I can't use OVER or HAVING or such beacuse of my version of my computer,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 10:41:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-see-outliners-with-proc-sql-but-having-problem-with/m-p/926991#M41584</guid>
      <dc:creator>cleokatt</dc:creator>
      <dc:date>2024-05-04T10:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to see outliners with proc sql but having problem with char/num</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-see-outliners-with-proc-sql-but-having-problem-with/m-p/926992#M41585</link>
      <description>&lt;P&gt;SQL extension row_num() is a function available in some databases but not in the SAS SQL flavour.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look into &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procstat/procstat_univariate_syntax01.htm" target="_self"&gt;Proc Univariate&lt;/A&gt; that provides a lot of stats for what I believe you're after.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 10:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-see-outliners-with-proc-sql-but-having-problem-with/m-p/926992#M41585</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-04T10:59:42Z</dc:date>
    </item>
  </channel>
</rss>

