<?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: Search by category in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473404#M121481</link>
    <description>&lt;P&gt;Show us the desired output.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 14:36:04 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-06-26T14:36:04Z</dc:date>
    <item>
      <title>Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473397#M121475</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have been struggling with a search algo, the data looks as follows:&lt;/P&gt;&lt;P&gt;category start_date end_date&lt;/P&gt;&lt;P&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;10jan2018&amp;nbsp; &amp;nbsp; 15feb2018&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;02jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;09jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;01jan2018&amp;nbsp; &amp;nbsp; 15feb2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;10jan2018&amp;nbsp; &amp;nbsp; 15feb2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;blue&amp;nbsp; &amp;nbsp;01jan2018&amp;nbsp; &amp;nbsp; &amp;nbsp;10jan2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What i'm trying to do:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Where the category is red, compare every start date to every other end date where they are equal.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hope that makes sense.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Pseudo code is fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473397#M121475</guid>
      <dc:creator>Frex</dc:creator>
      <dc:date>2018-06-26T14:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473404#M121481</link>
      <description>&lt;P&gt;Show us the desired output.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473404#M121481</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-06-26T14:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473410#M121484</link>
      <description>&lt;P&gt;so say for example I start looping through, the first category will be red and the start date 10JAN2018:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect it to find:&lt;/P&gt;&lt;P&gt;category start_date end_date&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;02jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;09jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hope that helps...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473410#M121484</guid>
      <dc:creator>Frex</dc:creator>
      <dc:date>2018-06-26T14:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473415#M121487</link>
      <description>I’m basically trying to find instances where other events in the category start on the same day a certain event ends.&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473415#M121487</guid>
      <dc:creator>Frex</dc:creator>
      <dc:date>2018-06-26T14:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473421#M121489</link>
      <description>&lt;P&gt;Let us know if this helps, if not i will switch to hash solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input category $ (start_date end_date) (:date9.);
format start_date end_date date9.;
cards;
red     10jan2018    15feb2018
red     02jan2018    10jan2018
red     09jan2018    10jan2018
red     01jan2018    15feb2018
red     10jan2018    15feb2018
blue   01jan2018     10jan2018
;

proc sql;
create table want as
select distinct a.category,b.start_date as start_date,b.end_Date
from have a, have b
where a.category=b.category and a.start_date=b.end_date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jun 2018 14:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473421#M121489</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-26T14:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473425#M121492</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;input color $5. start_date date9. @16 end_date date9.;&lt;BR /&gt;informat start_date date9. end_date date9.;&lt;BR /&gt;format start_date date9. end_date date9.;&lt;BR /&gt;cards;&lt;BR /&gt;red 10jan2018 15feb2018&lt;BR /&gt;red 02jan2018 10jan2018&lt;BR /&gt;red 09jan2018 10jan2018&lt;BR /&gt;red 01jan2018 15feb2018&lt;BR /&gt;red 10jan2018 15feb2018&lt;BR /&gt;red 10dec2018 10dec2018&lt;BR /&gt;blue 01jan2018 10jan2018&lt;BR /&gt;;&lt;BR /&gt;proc print data=test; run;&lt;/P&gt;&lt;P&gt;Data test2;&lt;BR /&gt;set test;&lt;/P&gt;&lt;P&gt;if color ='red' and start_date = end_date then flag = 1;&lt;BR /&gt;else flag = 0;&lt;BR /&gt;proc print data=test2; run;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 15:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473425#M121492</guid>
      <dc:creator>Larrihoover</dc:creator>
      <dc:date>2018-06-26T15:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473436#M121496</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217775"&gt;@Frex&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;so say for example I start looping through, the first category will be red and the start date 10JAN2018:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I expect it to find:&lt;/P&gt;
&lt;P&gt;category start_date end_date&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;02jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp;09jan2018&amp;nbsp; &amp;nbsp; 10jan2018&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;hope that helps...&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Nope, doesn't help a bit. You have end date of 15feb2018, and start date of 01jan2018, why aren't those used?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you&amp;nbsp;show us and give us a &lt;STRONG&gt;thorough and clear explanation&lt;/STRONG&gt; of what you want?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 15:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473436#M121496</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-06-26T15:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473439#M121497</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;Good morning,&amp;nbsp; My understanding is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look up startdate &amp;lt;=&amp;gt;enddate , if there is a match, fetch the startdate for those matches&lt;/P&gt;&lt;P&gt;So in OP's example, only 10 jan2018 exisits in enddate and 2nd and 9th are the corresponding startdate for those matches,&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 15:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473439#M121497</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-26T15:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search by category</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473623#M121562</link>
      <description>&lt;P&gt;Thanks man, this worked with some slight modification to skip missing values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 08:06:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-by-category/m-p/473623#M121562</guid>
      <dc:creator>Frex</dc:creator>
      <dc:date>2018-06-27T08:06:46Z</dc:date>
    </item>
  </channel>
</rss>

