<?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 Referencing Existing SAS Table in Teradata Execute in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Referencing-Existing-SAS-Table-in-Teradata-Execute/m-p/369390#M65037</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried searching the site but can't quite figure out what I am missing. I have successfully created a table in SAS that I would like to join with a table in SQL I am accessing through Teradata. I have tried to create a temporary table, but this doesn't seem to be working.&lt;BR /&gt;&lt;BR /&gt;I have also tried to reference the location I have saved the SAS data file to, but this doesn't seem to be working within the Teradata execute().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS code I am using to create a SAS data set:&lt;/P&gt;&lt;PRE&gt;proc sql;&lt;BR /&gt;connect to teradata as tera(server=? user=? password=? mode=teradata connection=global);
create table &lt;STRONG&gt;gold.apple&lt;/STRONG&gt; as
select distinct code
from loc1.codes
where product = 'big apples'
group by codes;&lt;/PRE&gt;&lt;P&gt;I would like the below code to pull my previously saved SAS data set and join it with an existing SQL table in Teradata.&lt;/P&gt;&lt;PRE&gt;execute(
create multiset volatile table ig as (
select distinct s.1,
     g.code,
     s.2,
     s.3
from &lt;STRONG&gt;gold.apple&lt;/STRONG&gt; as g left join silver.apple as s
group by code)
with data primary index (code) on commit preserve rows)
by tera;&lt;/PRE&gt;&lt;P&gt;When I try and run everything I get the following error: ERROR: Teradata execute: Database 'gold'&amp;nbsp; does not exist. I have tried the steps suggested here: &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Access-to-Teradata-How-to-create-Temporary-tables-in/td-p/228852" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Access-to-Teradata-How-to-create-Temporary-tables-in/td-p/228852&lt;/A&gt;, but it ends up saying I don't have the rights to create a table. I'm sure there's a way to create a linkage, I have a SAS data set and I can pull from Teradata without any issues. I'm hoping someone can point me in the right direction.&lt;BR /&gt;&lt;BR /&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2017 05:16:40 GMT</pubDate>
    <dc:creator>SASRt</dc:creator>
    <dc:date>2017-06-22T05:16:40Z</dc:date>
    <item>
      <title>Referencing Existing SAS Table in Teradata Execute</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Referencing-Existing-SAS-Table-in-Teradata-Execute/m-p/369390#M65037</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried searching the site but can't quite figure out what I am missing. I have successfully created a table in SAS that I would like to join with a table in SQL I am accessing through Teradata. I have tried to create a temporary table, but this doesn't seem to be working.&lt;BR /&gt;&lt;BR /&gt;I have also tried to reference the location I have saved the SAS data file to, but this doesn't seem to be working within the Teradata execute().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS code I am using to create a SAS data set:&lt;/P&gt;&lt;PRE&gt;proc sql;&lt;BR /&gt;connect to teradata as tera(server=? user=? password=? mode=teradata connection=global);
create table &lt;STRONG&gt;gold.apple&lt;/STRONG&gt; as
select distinct code
from loc1.codes
where product = 'big apples'
group by codes;&lt;/PRE&gt;&lt;P&gt;I would like the below code to pull my previously saved SAS data set and join it with an existing SQL table in Teradata.&lt;/P&gt;&lt;PRE&gt;execute(
create multiset volatile table ig as (
select distinct s.1,
     g.code,
     s.2,
     s.3
from &lt;STRONG&gt;gold.apple&lt;/STRONG&gt; as g left join silver.apple as s
group by code)
with data primary index (code) on commit preserve rows)
by tera;&lt;/PRE&gt;&lt;P&gt;When I try and run everything I get the following error: ERROR: Teradata execute: Database 'gold'&amp;nbsp; does not exist. I have tried the steps suggested here: &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Access-to-Teradata-How-to-create-Temporary-tables-in/td-p/228852" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Access-to-Teradata-How-to-create-Temporary-tables-in/td-p/228852&lt;/A&gt;, but it ends up saying I don't have the rights to create a table. I'm sure there's a way to create a linkage, I have a SAS data set and I can pull from Teradata without any issues. I'm hoping someone can point me in the right direction.&lt;BR /&gt;&lt;BR /&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 05:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Referencing-Existing-SAS-Table-in-Teradata-Execute/m-p/369390#M65037</guid>
      <dc:creator>SASRt</dc:creator>
      <dc:date>2017-06-22T05:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Existing SAS Table in Teradata Execute</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Referencing-Existing-SAS-Table-in-Teradata-Execute/m-p/369400#M65038</link>
      <description>&lt;P&gt;Teradata can only "see" its own tables.&lt;/P&gt;
&lt;P&gt;You will have to create a libname that points to the Teradata database, and use your SAS code to create the dataset there:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname gold /* all the necessary options to connect to the Teradata database "gold" */;

proc sql;
create table gold.apple as
select distinct code
from loc1.codes
where product = 'big apples'
group by codes;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to teradata as tera(server=? user=? password=? mode=teradata connection=global);

execute(
  create multiset volatile table ig as (
    select distinct s.1,
      g.code,
      s.2,
      s.3
    from gold.apple as g left join silver.apple as s
    group by code
  )
  with data primary index (code) on commit preserve rows
)
by tera;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;as the dataset is now available as a Teradata table in the database.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 07:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Referencing-Existing-SAS-Table-in-Teradata-Execute/m-p/369400#M65038</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-22T07:47:59Z</dc:date>
    </item>
  </channel>
</rss>

