<?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: Filter Data in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499741#M6296</link>
    <description>Add another condition to your having clause. Max(estimid) NE min(estimid)&lt;BR /&gt;&lt;BR /&gt;If the max is different than the min, you have at least two different estimators.</description>
    <pubDate>Fri, 28 Sep 2018 00:46:17 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-09-28T00:46:17Z</dc:date>
    <item>
      <title>Filter Data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499719#M6295</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to compare forecasts done by &lt;U&gt;at least two different&lt;/U&gt; analysts (ESTIMID) for the same stock (TICKER) having the same horizon (HORIZON), currency (ESTCUR), and announce date (ANNDATS).&lt;/P&gt;&lt;P&gt;Since my dataset is still too large I want to filter out all the forecast matches which are done by the same analysts (since it would not be useful for me to compare forecasts of the same stock done by the same analyst).&lt;/P&gt;&lt;P&gt;As an example please see three different matches:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ROW // TICKER // ESTIMID // HORIZON // VALUE // ESTCURR // USFIRM // ANNDATS&lt;BR /&gt;1 // X // &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt; // 12 // 4.6 // CAD // 0 // 23MAR2014&lt;BR /&gt;2 // X // &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt; //12 // 4.7 // CAD // 0 // 23MAR2014&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is &lt;U&gt;NOT&lt;/U&gt; useful since the two forecasts are done by the same&amp;nbsp;ESTMID (&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt;), therefore these two rows should be filtered out (delete) of the table.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;3 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Y &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;B&lt;/FONT&gt; &lt;/STRONG&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;5.5 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;CAD &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;25JUN2014&lt;BR /&gt;4 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Y &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;C&lt;/FONT&gt; &lt;/STRONG&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;3.9&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;CAD &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;25JUN2014&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is &lt;U&gt;useful&lt;/U&gt; since the two forecasts are done by &lt;U&gt;two different&lt;/U&gt;&amp;nbsp;ESTIMID (&lt;FONT color="#339966"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;FONT color="#339966"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/FONT&gt;), therefore these two rows should stay in the table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;D&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;120 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;BR /&gt;6&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;130 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;BR /&gt;&lt;SPAN&gt;7 //&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;105 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is also &lt;U&gt;useful&lt;/U&gt; since the&amp;nbsp;three forecasts are done by &lt;U&gt;at least two different&lt;/U&gt;&amp;nbsp;ESTIMID (&lt;FONT color="#339966"&gt;&lt;STRONG&gt;D&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;), therefore this three rows should stay in the table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is at the moment my code with the matches:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE WORK.PTMatchInt 
AS SELECT TICKER , ESTIMID , HORIZON , 'VALUE'n , ESTCUR , USFIRM , ANNDATS 
FROM IBES.PTGDET
WHERE USFIRM=0
group by TICKER , HORIZON , ESTCUR , ANNDATS having count(*) &amp;gt;=2;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate if someone could provide me with some help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Jorge&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default dgrid-selected ui-state-active"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Sep 2018 21:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499719#M6295</guid>
      <dc:creator>jozuleta</dc:creator>
      <dc:date>2018-09-27T21:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499741#M6296</link>
      <description>Add another condition to your having clause. Max(estimid) NE min(estimid)&lt;BR /&gt;&lt;BR /&gt;If the max is different than the min, you have at least two different estimators.</description>
      <pubDate>Fri, 28 Sep 2018 00:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499741#M6296</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-28T00:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499742#M6297</link>
      <description>&lt;P&gt;In SQL MAX/MIN works on both character and numerics so you can use this approach. It will not work in a datastep, and may not in other SQL types.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236579"&gt;@jozuleta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I want to compare forecasts done by &lt;U&gt;at least two different&lt;/U&gt; analysts (ESTIMID) for the same stock (TICKER) having the same horizon (HORIZON), currency (ESTCUR), and announce date (ANNDATS).&lt;/P&gt;
&lt;P&gt;Since my dataset is still too large I want to filter out all the forecast matches which are done by the same analysts (since it would not be useful for me to compare forecasts of the same stock done by the same analyst).&lt;/P&gt;
&lt;P&gt;As an example please see three different matches:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ROW // TICKER // ESTIMID // HORIZON // VALUE // ESTCURR // USFIRM // ANNDATS&lt;BR /&gt;1 // X // &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt; // 12 // 4.6 // CAD // 0 // 23MAR2014&lt;BR /&gt;2 // X // &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt; //12 // 4.7 // CAD // 0 // 23MAR2014&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is &lt;U&gt;NOT&lt;/U&gt; useful since the two forecasts are done by the same&amp;nbsp;ESTMID (&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/FONT&gt;), therefore these two rows should be filtered out (delete) of the table.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;3 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Y &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;B&lt;/FONT&gt; &lt;/STRONG&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;5.5 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;CAD &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;25JUN2014&lt;BR /&gt;4 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Y &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;C&lt;/FONT&gt; &lt;/STRONG&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;3.9&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;CAD &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;25JUN2014&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is &lt;U&gt;useful&lt;/U&gt; since the two forecasts are done by &lt;U&gt;two different&lt;/U&gt;&amp;nbsp;ESTIMID (&lt;FONT color="#339966"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;FONT color="#339966"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/FONT&gt;), therefore these two rows should stay in the table&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;D&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;120 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;BR /&gt;6&amp;nbsp;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt; &lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;130 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;BR /&gt;&lt;SPAN&gt;7 //&amp;nbsp;&lt;/SPAN&gt;Z &lt;SPAN&gt;//&lt;FONT color="#339966"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;12 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;105 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;BPN &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;0 &lt;SPAN&gt;//&amp;nbsp;&lt;/SPAN&gt;06DEC2016&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This match is also &lt;U&gt;useful&lt;/U&gt; since the&amp;nbsp;three forecasts are done by &lt;U&gt;at least two different&lt;/U&gt;&amp;nbsp;ESTIMID (&lt;FONT color="#339966"&gt;&lt;STRONG&gt;D&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;FONT color="#339966"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;), therefore this three rows should stay in the table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is at the moment my code with the matches:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE WORK.PTMatchInt 
AS SELECT TICKER , ESTIMID , HORIZON , 'VALUE'n , ESTCUR , USFIRM , ANNDATS 
FROM IBES.PTGDET
WHERE USFIRM=0
group by TICKER , HORIZON , ESTCUR , ANNDATS having count(*) &amp;gt;=2;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate if someone could provide me with some help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Jorge&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default dgrid-selected ui-state-active"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 00:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Filter-Data/m-p/499742#M6297</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-28T00:49:01Z</dc:date>
    </item>
  </channel>
</rss>

