<?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: Problems with query design in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29565#M4053</link>
    <description>Your data example appears to show, for your query steps, the resulting output file will have each unique CUSTOMER_ID, sorted by the DATE (variable / column) in descending order,and output variables CUSTOMER_ID, EVENT and DATE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Mon, 31 May 2010 14:56:17 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-05-31T14:56:17Z</dc:date>
    <item>
      <title>Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29564#M4052</link>
      <description>hi,&lt;BR /&gt;
&lt;BR /&gt;
i got a question for one of my queries. This is the structure of my table:&lt;BR /&gt;
&lt;BR /&gt;
table 1&lt;BR /&gt;
&lt;BR /&gt;
customer_ID|event|date&lt;BR /&gt;
1 | A | 20020529&lt;BR /&gt;
1 | B | 20050403&lt;BR /&gt;
1 |C  | 20040509&lt;BR /&gt;
2 |C  | 20040509&lt;BR /&gt;
2| B | 20050403&lt;BR /&gt;
2| A | 20020529&lt;BR /&gt;
&lt;BR /&gt;
Regarding this dataset my query should only contain the following records:&lt;BR /&gt;
1|B| 20050403 &lt;BR /&gt;
2| B | 20050403&lt;BR /&gt;
&lt;BR /&gt;
What might be the settings for the Query-/Filter Designer?&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Chris</description>
      <pubDate>Mon, 31 May 2010 13:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29564#M4052</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-31T13:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29565#M4053</link>
      <description>Your data example appears to show, for your query steps, the resulting output file will have each unique CUSTOMER_ID, sorted by the DATE (variable / column) in descending order,and output variables CUSTOMER_ID, EVENT and DATE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 31 May 2010 14:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29565#M4053</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-05-31T14:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29566#M4054</link>
      <description>Hi:&lt;BR /&gt;
  In addition to Scott's comments, it also looks like your criteria for selection might have something to do either with EVENT or DATE -- what your desire output has in common is that the EVENT for both rows is equal to 'B' and the date for both rows is equal to 20050403.&lt;BR /&gt;
 &lt;BR /&gt;
  You are the person who is most familiar with your data. The query that you build will need to use a filter to select the rows that you want. When you build the filter, you have to decide which criteria will get you the rows you want. For example:&lt;BR /&gt;
&lt;BR /&gt;
Option 1: Filter and Select ALL the rows where event = 'B' and date = '20050403' &lt;BR /&gt;
OR&lt;BR /&gt;
Option 2: Filter and Select ALL the rows where event = 'B' (could get ANY date)&lt;BR /&gt;
OR&lt;BR /&gt;
Option 3: Filter and Select ALL the rows where date = '20050403' (could get ANY event code)&lt;BR /&gt;
OR&lt;BR /&gt;
Option 4: Filter and Select the rows where event = 'B' or date = '20050403' &lt;BR /&gt;
    &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 31 May 2010 16:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29566#M4054</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-31T16:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29567#M4055</link>
      <description>Thanks for your comments, but i think i haven't describe my problem exactly, so i try again:&lt;BR /&gt;
&lt;BR /&gt;
the output should contain that row with the &lt;B&gt;youngest&lt;/B&gt; date for every customer&lt;BR /&gt;
&lt;BR /&gt;
chris

Message was edited by: Chris55</description>
      <pubDate>Thu, 03 Jun 2010 11:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29567#M4055</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-03T11:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29568#M4056</link>
      <description>If you want to solve this in Filter and query, you need to create a computed column (max(date)), group by customer_id, and then subset via having (data = maxdate).&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Fri, 04 Jun 2010 08:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29568#M4056</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2010-06-04T08:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29569#M4057</link>
      <description>hi linus,&lt;BR /&gt;
&lt;BR /&gt;
thanks for your reply.&lt;BR /&gt;
i have implemented that query but i am afraid it doesn't work.&lt;BR /&gt;
Maybe the format (01012000) of the date-column is the problem?&lt;BR /&gt;
&lt;BR /&gt;
chris</description>
      <pubDate>Fri, 04 Jun 2010 08:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29569#M4057</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-04T08:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with query design</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29570#M4058</link>
      <description>it works ... thank you.&lt;BR /&gt;
&lt;BR /&gt;
seems my first version had some problems with the having statement!</description>
      <pubDate>Fri, 04 Jun 2010 09:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Problems-with-query-design/m-p/29570#M4058</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-04T09:19:49Z</dc:date>
    </item>
  </channel>
</rss>

