<?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: Sas proc sql to teradata in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670660#M201363</link>
    <description>&lt;P&gt;ok, that's great works really well!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just one thing...this brings back all data for accounts for all the dates?&amp;nbsp;&amp;nbsp;if I have 75 distinct dates it&amp;nbsp;is bringing back 75 rows for&amp;nbsp;each account.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyway of fixing this within this code?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2020 14:02:44 GMT</pubDate>
    <dc:creator>KamikazeBassi</dc:creator>
    <dc:date>2020-07-20T14:02:44Z</dc:date>
    <item>
      <title>Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670441#M201266</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am after suggestions on the following issue I have.&amp;nbsp; My systems allow me access to data on Teradata via SAS EG, but this gives me issues with joins when passing sql&amp;nbsp;to Teradata.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Code:&amp;nbsp; Code is bring back data for customers&amp;nbsp;from a list of say 10k customers for particular dates from a table that holds the accounts and dates required (tmp1).&amp;nbsp; The daily snapshot data is in tera.daily_snapshot_table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table test1 as (&lt;/P&gt;&lt;P&gt;select a.acct, a.id_date, a.somedata1, a.somedata2&lt;/P&gt;&lt;P&gt;from tera.daily_snapshot_table&amp;nbsp; a&lt;/P&gt;&lt;P&gt;where a.acct in (select distinct acct from tmp1)&lt;/P&gt;&lt;P&gt;and a.id_date in (select distinct id_date from tmp1)&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS&amp;nbsp;is unable to join the tables together, so instead pulls everything down from the tera view and then does the extra filtering in SAS. This is what I&amp;nbsp;have found very slow. Here is the actual SQL that is running in Teradata for your query, as you can see no reference to my accounts or snapshot dates and will return an estimated 291 million rows!!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT "acct",&lt;/P&gt;&lt;P&gt;"ID_DATE",&lt;/P&gt;&lt;P&gt;CAST("somedata1" AS FLOAT),&lt;/P&gt;&lt;P&gt;CAST("somedata2" AS FLOAT),&lt;/P&gt;&lt;P&gt;FROM "TERA_VIEWS"."daily_snapshot_table";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't have access to Teradata directly and the DBA has told me what it is doing...but he unfortunately doesn't have SAS experience to fix this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what would be the best way to generate code that will pass though the values to Teradata to enable just the customers/dates I want to be returned?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 09:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670441#M201266</guid>
      <dc:creator>KamikazeBassi</dc:creator>
      <dc:date>2020-07-19T09:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670507#M201300</link>
      <description>&lt;P&gt;When joining a Teradata table to a SAS table you have two choices. Either bring your Teradata data down to SAS and join with your SAS table in the SAS environment - this is what is happening now. The alternative is to upload your SAS table to Teradata and do your joining in the Teradata environment. Given your SAS table is small this is the better option but you would need permissions to create and update a temporary Teradata table. Your Teradata administrator should be able to set this up for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This SAS note describes how to load a SAS table into a temporary Teradata table:&amp;nbsp;&lt;A href="https://support.sas.com/kb/21/038.html" target="_blank"&gt;https://support.sas.com/kb/21/038.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 20:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670507#M201300</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-07-19T20:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670546#M201319</link>
      <description>&lt;P&gt;A third option is to include the values to extract as part of the SQL.&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call execute(
       'proc sql; '
     ||'create table TEST1 as '
     ||'select ACCT, ID_DATE, SOMEDATA1, SOMEDATA2 '
     ||'from TERA.DAILY_SNAPSHOT_TABLE '
     ||'where ACCT in ("DUMMY" ' );
  do until(LASTOBS);
    set UNIQUE_ACCT_LIST end=LASTOBS;
    call execute(','||quote(trim(ACCT)));
  end;
  call execute(') and DATE_ID in (-99 ' );
  do until(LASTOBS1);
    set UNIQUE_DATE_LIST end=LASTOBS1;
    call execute(catts(',', quote(put(DATE,date9.)), 'd' ));
  end;
  call execute('); quit;');
  stop;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does this make sense?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 23:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670546#M201319</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-07-20T23:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670642#M201358</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure on this, how is it picking up my unique list of accounts and corresponding dates?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I replace the ("DUMMY" ' );&amp;nbsp; to a select of the accounts and dates?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670642#M201358</guid>
      <dc:creator>KamikazeBassi</dc:creator>
      <dc:date>2020-07-20T13:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670653#M201359</link>
      <description>&lt;P&gt;ok.....understand what it is doing now,&amp;nbsp; just trying to run it....&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670653#M201359</guid>
      <dc:creator>KamikazeBassi</dc:creator>
      <dc:date>2020-07-20T13:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670660#M201363</link>
      <description>&lt;P&gt;ok, that's great works really well!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just one thing...this brings back all data for accounts for all the dates?&amp;nbsp;&amp;nbsp;if I have 75 distinct dates it&amp;nbsp;is bringing back 75 rows for&amp;nbsp;each account.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyway of fixing this within this code?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 14:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670660#M201363</guid>
      <dc:creator>KamikazeBassi</dc:creator>
      <dc:date>2020-07-20T14:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670745#M201395</link>
      <description>Worked really well, much appreciated.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Jul 2020 18:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670745#M201395</guid>
      <dc:creator>KamikazeBassi</dc:creator>
      <dc:date>2020-07-20T18:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sas proc sql to teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670788#M201407</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332539"&gt;@KamikazeBassi&lt;/a&gt;&amp;nbsp; - Just be aware that this works OK when your lookup table is relatively small. It won't work if you have millions of rows to select on as your WHERE clause will get too big.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 20:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-proc-sql-to-teradata/m-p/670788#M201407</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-07-20T20:01:09Z</dc:date>
    </item>
  </channel>
</rss>

