<?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: Filtering new query based off data results of another query in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122760#M10134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depending on the nature of your system, your system administrators could consider one of the new data management products that are optimized for analytics; they tend to perform very quickly on this kind of query, which is not optimal for traditional DBMS products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2013 14:52:38 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2013-08-28T14:52:38Z</dc:date>
    <item>
      <title>Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122755#M10129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi all! This is my first post, so I hope it is a success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I'm trying to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with very large data tables that need to be filtered as much as possible to reduce run-time and avoid spool space limitations. I have two tables, CUSTOMER_COMPLAINTS and TRANSACTION_HISTORY. I first query CUSTOMER_COMPLAINTS for a specific complaint date to get the subset of complaints I would like to research. The unique identifier for each complaint is CUSTOMER_COMPLAINT_ID. I then want to query all transactions from TRANSACTION_HISTORY based on the CUSTOMER_COMPLAINTS_ID field (which is also in the transaction_history) in order to find all related transactions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is where I need help! I am joining CUSTOMER_COMPLAINTS with TRANSACTION_HISTORY via the CUSTOMER_COMPLAINT_ID but the TRANSACTION_HISTORY table does not include any sort of date field to filter on first, so the query has use go through the entire TRANSACTION_HISTORY table (I believe) to find where the two tables match up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: Is there a way to create a list (or something similar) of CUSTOMER_COMPLAINT_ID's from the initial query that I can use to filter the TRANSACTION_HISTORY table on before joining the two tables? The reason I want to do this is to bring the TRANSACTION_HISTORY table down to a reasonable size before querying it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help in doing this or a better solution to speed this query is greatly appreciated!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122755#M10129</guid>
      <dc:creator>jbrisle</dc:creator>
      <dc:date>2013-08-27T14:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122756#M10130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand the problem correctly, you should be able to use an inner join on CUSTOMER_COMPLAINT_ID and apply the filter where the date field in CUSTOMER_COMPLAINTS matches the date you want.&amp;nbsp; And if the tables are indexed on the customer ID, that might help things perform even faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, if you feel it needs a two-step solution (query on a query), then you can formulate this as a subquery.&amp;nbsp; See &lt;A href="http://blogs.sas.com/content/sasdummy/2013/06/28/building-an-sql-subquery-in-sas-enterprise-guide/"&gt;this blog post about subqueries in SAS Enterprise Guide&lt;/A&gt; for more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122756#M10130</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2013-08-27T14:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122757#M10131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the swift reply. I'm a bit of a noob, but is there a way to see if the customer ID is indexed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122757#M10131</guid>
      <dc:creator>jbrisle</dc:creator>
      <dc:date>2013-08-27T14:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122758#M10132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try Tasks-&amp;gt;Data-&amp;gt;Data Attributes and see if anything is revealed in the reports.&amp;nbsp; If your tables are in a database that someone else manages for you, chances are good that this field is indexed, as it would be a common key to filter/sort by.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122758#M10132</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2013-08-27T14:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122759#M10133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like none of the fields are indexed, which is disappointing. Oh well, at least now I know why it is so slow!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122759#M10133</guid>
      <dc:creator>jbrisle</dc:creator>
      <dc:date>2013-08-27T14:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering new query based off data results of another query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122760#M10134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depending on the nature of your system, your system administrators could consider one of the new data management products that are optimized for analytics; they tend to perform very quickly on this kind of query, which is not optimal for traditional DBMS products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 14:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filtering-new-query-based-off-data-results-of-another-query/m-p/122760#M10134</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-08-28T14:52:38Z</dc:date>
    </item>
  </channel>
</rss>

