<?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--TERA in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958473#M374071</link>
    <description>&lt;P&gt;The connect statement in your 2nd Proc SQL misses&amp;nbsp;&lt;EM&gt;connection=global&lt;/EM&gt; and though creates a new session on Teradata where the volatile tables don't exists.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either have all your SQLs under a single Proc SQL under a single connection, or make sure you use in multiple SQLs the exactly same connection string including connection=global or (my preference) define the connection once via a Libname statement (with connection=global) and then use syntax &lt;EM&gt;connect using &amp;lt;libref&amp;gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2025 23:11:26 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2025-02-05T23:11:26Z</dc:date>
    <item>
      <title>SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958173#M373995</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that I work on 2 tera tables in order to create sas data set.&lt;/P&gt;
&lt;P&gt;Here are 3 ways: way1 is 100% working well , Way2 is also 100% working well.&lt;/P&gt;
&lt;P&gt;I want to ask about way3 only in order to learn it.&lt;/P&gt;
&lt;P&gt;Is it possible to -&lt;/P&gt;
&lt;P&gt;A-create a violate table1 in Tera&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B-create a violate table2 in Tera&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C-create a violate table3 in Tera&amp;nbsp; &amp;nbsp;by merge&amp;nbsp; violate table1+ violate table2&lt;/P&gt;
&lt;P&gt;D-Create SAS data set from&amp;nbsp;violate table3&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/***WAY1***/
/***WAY1***/
/***WAY1***/
proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table VBM374  as 
select * from connection to teradata
(
SELECT   top 100000  Branch_Cust_Nbr as customer_ID,Branch_Cust_IP,first_Branch_Cust_IP as numerator,Team_IP
from VBM374_USED_BRANCH_CUSTOMER
);
disconnect from teradata;
quit ;
proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table VBM376  as 
select * from connection to teradata
(
SELECT   top 100000 Team_IP,Branch_Nbr 
from VBM376_INTERNAL_ORGANIZATION
);
disconnect from teradata;
quit ;
proc sql;
create table WANT_WAY1 as
select a.*,b.Branch_Nbr
from VBM374 as a
inner join VBM376  as b
on a.Team_IP=b.Team_IP
;
quit;
/***WAY2***/
/***WAY2***/
/***WAY2***/
proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table WANT_WAY2  as 
select * from connection to teradata
(
SELECT   top 100000  a.Branch_Cust_Nbr as customer_ID,a.Branch_Cust_IP,a.first_Branch_Cust_IP as numerator,a.Team_IP,b.Branch_Nbr
from VBM374_USED_BRANCH_CUSTOMER as a
inner join VBM376_INTERNAL_ORGANIZATION as b
on a.Team_IP=b.Team_IP
);
disconnect from teradata;
quit ;
 /***WAY3***/
 /***WAY3***/
 /***WAY3***/
 /**Create violtate table1 in tera data ***/
/*SELECT   top 100000  Branch_Cust_Nbr as customer_ID,Branch_Cust_IP,first_Branch_Cust_IP as numerator,Team_IP*/
/*from VBM374_USED_BRANCH_CUSTOMER*/
 
 /**Create violtate table2 in tera data ***/
/*SELECT   top 100000 Team_IP,Branch_Nbr */
/*from VBM376_INTERNAL_ORGANIZATION*/

 /**Create violtate table3 in tera data ***/
/*by merge violtate table1 +violtate table2*/

/**Create sas data set from violtate table3**/
&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 09:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958173#M373995</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-04T09:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958179#M373997</link>
      <description>&lt;P&gt;I'd go for your Way 2 because it can take advantage of indexes for the join (if they exist), of Teradata parallel processing and importantly it will reduce the data volume to what you really need on the SAS side. The data transfer between SAS and a DB is normally the bottleneck so you want to reduce data volumes as much as possible before transferring them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your way 3: Yes, of course, you can also first create volatile tables. They are pretty much the same to work with than permanent tables. You just need to ensure that you run all the processing in the same Teradata session (connection=global).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would define the connection to Teradata via a libname statement that you then use in your connect statement (like in the code in your other question &lt;A href="https://communities.sas.com/t5/SAS-Programming/connect-to-tera-via-sas/m-p/958167#M373992" target="_self"&gt;here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;Using a libname statement has also the advantage that you can use the same libref in both Proc SQL and a data step that then all can connect to the same Teradata session (if using connection=global).&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 11:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958179#M373997</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-04T11:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958195#M374004</link>
      <description>&lt;P&gt;Why do you keep connecting and disconnecting from the database?&amp;nbsp; That will make it hard to use volatile tables since they will disappear when you connection ends.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It will be much easier if you just make a libref that points to the database and leave it open as long as you need it.&amp;nbsp; Then in your SQL steps you can CONNECT USING to have SQL re-use the already existing connection.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tera teradata server=dwprod schema=DWP_vall authdomain=TeraDataAuth;
proc sql;
connect using tera;
execute by tera 
( ... teradata statement here ...
);
create table want as select * from connection to tera
( .. teradata query here ...
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When you done using Teradata you can just clear the libref.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tera clear;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Feb 2025 18:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958195#M374004</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-05T18:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958318#M374038</link>
      <description>&lt;P&gt;I don't understand this code.&lt;/P&gt;
&lt;P&gt;As I said-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a violtate table1 IN TERA&lt;/P&gt;
&lt;P&gt;I want to create a violtate table2 IN TERA&lt;/P&gt;
&lt;P&gt;I want to merge In TERA the two&amp;nbsp; violtate tables (Result&amp;nbsp; be&amp;nbsp; violtate table3)&lt;/P&gt;
&lt;P&gt;Then I want to create SAS data set from the&amp;nbsp;violtate table3&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 08:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958318#M374038</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T08:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958319#M374039</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;I dont understand your code.&lt;/P&gt;
&lt;P&gt;You wrote one time "tera staement"&lt;/P&gt;
&lt;P&gt;in other time you wrote "tera query"&lt;/P&gt;
&lt;P&gt;I dont understand the difference between tera query and tera sdtatement&lt;/P&gt;
&lt;P&gt;Also ,I see only one create table statement and I guess it create the data set in sas&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 08:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958319#M374039</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T08:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958320#M374040</link>
      <description>&lt;P&gt;Can you please show full code of Way 3?&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 08:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958320#M374040</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T08:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958328#M374043</link>
      <description>Statement in this context means an operation that doesn't give you any data back as a result. CREATE is an example.&lt;BR /&gt;A query returns a result in form of data, i.e., SELECT.</description>
      <pubDate>Wed, 05 Feb 2025 09:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958328#M374043</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-02-05T09:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958334#M374047</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can you please show full code of Way 3?&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You've got already almost all the pieces and just need to put them together. I also strongly suggest that you spend a bit of time reading in the SAS and Teradata docu the bits you don't fully understand. That's really the only way to really learn and understand.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I've take known bits and copy/pasted them into Copilot.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1738751652804.png" style="width: 560px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104353i7896ECDB0106EA49/image-dimensions/560x482?v=v2" width="560" height="482" role="button" title="Patrick_0-1738751652804.png" alt="Patrick_0-1738751652804.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And here the answer I've got which looks to me like valid code. Test it and if there are issues debug. That's how you learn.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Connect to Teradata using the LIBNAME statement&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tdwork teradata 
    AUTHDOMAIN=TeraDataAuth 
    mode=teradata  
    server=dwprod
    connection=global 
    dbmstemp=yes;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Create the volatile tables and merge them&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    connect using tdwork;
    
    /* Create volatile table1 */
    execute (
        CREATE VOLATILE TABLE volatile_table1 AS
        (SELECT TOP 100000
            Branch_Cust_Nbr AS customer_ID,
            Branch_Cust_IP,
            first_Branch_Cust_IP AS numerator,
            Team_IP
        FROM VBM374_USED_BRANCH_CUSTOMER)
        ON COMMIT PRESERVE ROWS
    ) by tdwork;
    
    /* Create volatile table2 */
    execute (
        CREATE VOLATILE TABLE volatile_table2 AS
        (SELECT TOP 100000
            Team_IP,
            Branch_Nbr
        FROM VBM376_INTERNAL_ORGANIZATION)
        ON COMMIT PRESERVE ROWS
    ) by tdwork;
    
    /* Create volatile table3 by merging table1 and table2 */
    execute (
        CREATE VOLATILE TABLE volatile_table3 AS
        (SELECT
            a.customer_ID,
            a.Branch_Cust_IP,
            a.numerator,
            b.Team_IP,
            b.Branch_Nbr
        FROM volatile_table1 a
        LEFT JOIN volatile_table2 b
        ON a.Team_IP = b.Team_IP)
        ON COMMIT PRESERVE ROWS
    ) by tdwork;
    
    disconnect from tdwork;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Create a SAS data set from the volatile table3&lt;/STRONG&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.final_dataset;
    set tdwork.volatile_table3;
run;

proc print data=work.final_dataset;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;In this example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;CODE&gt;libname&lt;/CODE&gt; statement establishes a global connection to the Teradata database using the LIBNAME reference &lt;CODE&gt;tdwork&lt;/CODE&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;CODE&gt;proc sql&lt;/CODE&gt; block uses this LIBNAME reference to create three volatile tables: &lt;CODE&gt;volatile_table1&lt;/CODE&gt;, &lt;CODE&gt;volatile_table2&lt;/CODE&gt;, and &lt;CODE&gt;volatile_table3&lt;/CODE&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;CODE&gt;volatile_table3&lt;/CODE&gt; is created by merging &lt;CODE&gt;volatile_table1&lt;/CODE&gt; and &lt;CODE&gt;volatile_table2&lt;/CODE&gt; using a &lt;CODE&gt;LEFT JOIN&lt;/CODE&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN&gt;Finally, the &lt;CODE&gt;data&lt;/CODE&gt; step creates a SAS data set from the &lt;CODE&gt;volatile_table3&lt;/CODE&gt; table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 10:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958334#M374047</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-05T10:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958355#M374051</link>
      <description>In your code should use Tera language or sas language?</description>
      <pubDate>Wed, 05 Feb 2025 13:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958355#M374051</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T13:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958360#M374053</link>
      <description>&lt;P&gt;you please show the code?&lt;/P&gt;
&lt;P&gt;Then I will apply it and let you know if it is working&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 13:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958360#M374053</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T13:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958364#M374056</link>
      <description>All syntax within an EXCUTE or ..FROM CONNECTION TO blocks need to be in RDBMS specific.&lt;BR /&gt;Anything outside these blocks should be SAS PROC SQL syntax.</description>
      <pubDate>Wed, 05 Feb 2025 13:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958364#M374056</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-02-05T13:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958365#M374057</link>
      <description>I suggest that you read through the documentation for a better understanding:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/n1kbstf7vw0qcjn1ibfc8c78a9lc.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/n1kbstf7vw0qcjn1ibfc8c78a9lc.htm&lt;/A&gt;</description>
      <pubDate>Wed, 05 Feb 2025 13:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958365#M374057</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-02-05T13:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958399#M374061</link>
      <description>So use DBMS SQL syntax</description>
      <pubDate>Wed, 05 Feb 2025 15:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958399#M374061</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T15:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958402#M374063</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In your code should use Tera language or sas language?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It was already clear which parts are using SAS syntax and which parts are using Teradata syntax.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tera teradata server=dwprod schema=DWP_vall authdomain=TeraDataAuth;
proc sql;
connect using tera;
execute by tera 
( ... teradata statement here ...
);
create table want as select * from connection to tera
( .. teradata query here ...
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code shown is all SAS code. The parts with the ... elipses ... are where you place the Teradata code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 18:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958402#M374063</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-05T18:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958447#M374065</link>
      <description>Thank you so much.&lt;BR /&gt;I will apply it and let you know how it worked</description>
      <pubDate>Wed, 05 Feb 2025 18:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958447#M374065</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T18:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958461#M374067</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I tried to run this code but get error.&lt;/P&gt;
&lt;P&gt;I also see that in the libname statement that you wrote there is no&amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;nbsp;schema=DWP_vall&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tdwork teradata 
AUTHDOMAIN=TeraDataAuth 
mode=teradata  
server=dwprod
connection=global 
dbmstemp=yes;
proc sql;
connect using tdwork;
/* Create volatile table1 */
execute 
(
CREATE VOLATILE TABLE volatile_table1 AS
(SELECT TOP 1000 Branch_Cust_Nbr AS customer_ID,Branch_Cust_IP,first_Branch_Cust_IP AS numerator,Team_IP
 FROM VBM374_USED_BRANCH_CUSTOMER)
 ON COMMIT PRESERVE ROWS
)
by tdwork;
disconnect from tdwork;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the error in Log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 The SAS System 10:47 Wednesday, February 5, 2025&lt;/P&gt;
&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Program 1';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10 &lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=SVG;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;16 %mend;&lt;BR /&gt;17 FILENAME EGHTML TEMP;&lt;BR /&gt;18 ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;19 OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;20 %HTML5AccessibleGraphSupported&lt;BR /&gt;NOTE: The ACCESSIBLE_GRAPH option is pre-production for this release.&lt;BR /&gt;21 ENCODING='utf-8'&lt;BR /&gt;22 STYLE=HTMLBlue&lt;BR /&gt;23 NOGTITLE&lt;BR /&gt;24 NOGFOOTNOTE&lt;BR /&gt;25 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;26 ;&lt;BR /&gt;NOTE: Writing HTML5(EGHTML) Body file: EGHTML&lt;BR /&gt;27 &lt;BR /&gt;28 &lt;BR /&gt;29 &lt;BR /&gt;30 &lt;BR /&gt;31 libname tdwork teradata&lt;BR /&gt;32 AUTHDOMAIN=TeraDataAuth&lt;BR /&gt;33 mode=teradata&lt;BR /&gt;34 server=dwprod&lt;BR /&gt;35 connection=global&lt;BR /&gt;36 dbmstemp=yes;&lt;BR /&gt;NOTE: Libref TDWORK was successfully assigned as follows: &lt;BR /&gt;Engine: TERADATA &lt;BR /&gt;Physical Name: dwprod&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;37 proc sql;&lt;BR /&gt;38 connect using tdwork;&lt;BR /&gt;39 /* Create volatile table1 */&lt;BR /&gt;40 execute&lt;BR /&gt;41 (&lt;BR /&gt;42 CREATE VOLATILE TABLE volatile_table1 AS&lt;BR /&gt;43 (SELECT TOP 1000 Branch_Cust_Nbr AS customer_ID,Branch_Cust_IP,first_Branch_Cust_IP AS numerator,Team_IP&lt;BR /&gt;44 FROM VBM374_USED_BRANCH_CUSTOMER)&lt;BR /&gt;45 ON COMMIT PRESERVE ROWS&lt;BR /&gt;46 )&lt;BR /&gt;47 by tdwork;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Teradata execute: Syntax error: expected something between ')' and the 'ON' keyword.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;48 disconnect from tdwork;&lt;BR /&gt;NOTE: Statement not executed due to NOEXEC option.&lt;BR /&gt;2 The SAS System 10:47 Wednesday, February 5, 2025&lt;/P&gt;
&lt;P&gt;49 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.00 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 95.21k&lt;BR /&gt;OS Memory 24984.00k&lt;BR /&gt;Timestamp 02/05/2025 11:09:09 PM&lt;BR /&gt;Step Count 127 Switch Count 0&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 16&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 2&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 0&lt;BR /&gt;&lt;BR /&gt;50 &lt;BR /&gt;51 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;52 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;53 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;54 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;55 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;56 %LET _SASPROGRAMFILE=;&lt;BR /&gt;57 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;58 &lt;BR /&gt;59 ;*';*";*/;quit;run;&lt;BR /&gt;60 ODS _ALL_ CLOSE;&lt;BR /&gt;61 &lt;BR /&gt;62 &lt;BR /&gt;63 QUIT; RUN;&lt;BR /&gt;64&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 21:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958461#M374067</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T21:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958464#M374068</link>
      <description>&lt;P&gt;Great now it is working 100% and 3 violate tables were created in tera&lt;/P&gt;
&lt;P&gt;How can I now create a sas data set from&amp;nbsp;violate3 (the last&amp;nbsp;violate table)?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth connection=global); 
/* Create volatile table1 */
execute( 
create volatile table volatile1 as
(
SELECT TOP 100000
            Branch_Cust_Nbr AS customer_ID,
            Branch_Cust_IP,
            first_Branch_Cust_IP AS numerator,
            Team_IP
        FROM VBM374_USED_BRANCH_CUSTOMER
)  
with data primary index (Branch_Cust_IP) 
on commit preserve rows  ) by teradata; 
/* Create volatile table2 */
execute( 
create volatile table volatile2 as
(
SELECT TOP 100000
            Team_IP,
            Branch_Nbr
        FROM VBM376_INTERNAL_ORGANIZATION
)  
with data primary index (TEAM_IP) 
on commit preserve rows  ) by teradata; 
 /* Create volatile table3 by merging table1 and table2 */
  execute (
CREATE VOLATILE TABLE volatile3 AS
(SELECT
            a.customer_ID,
            a.Branch_Cust_IP,
            a.numerator,
            b.Team_IP,
            b.Branch_Nbr
        FROM volatile1 as a
        LEFT JOIN volatile2 as b
        ON a.Team_IP =b.Team_IP)

with data primary index (Branch_Cust_IP) 
on commit preserve rows  ) by teradata; 
    disconnect from teradata;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;I tried this code but error--ERROR: Teradata prepare: Object 'volatile3' does not exist. SQL statement was: SELECT * from volatile3.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
 proc sql;    
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);   
create table want as
select * from connection to teradata 
(
SELECT * from volatile3
);  
disconnect from teradata; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 21:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958464#M374068</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-05T21:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958465#M374069</link>
      <description>&lt;P&gt;Most likely from the code you posted all three volatile tables were deleted when you closed PROC SQL (and hence closed the connection to Teradata).&amp;nbsp; What happens if you do all four statements in same PROC SQL steps?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is why I recommend making a LIBREF first and then using that, so your volatile tables will persist until you close the libref.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 21:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958465#M374069</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-05T21:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958473#M374071</link>
      <description>&lt;P&gt;The connect statement in your 2nd Proc SQL misses&amp;nbsp;&lt;EM&gt;connection=global&lt;/EM&gt; and though creates a new session on Teradata where the volatile tables don't exists.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either have all your SQLs under a single Proc SQL under a single connection, or make sure you use in multiple SQLs the exactly same connection string including connection=global or (my preference) define the connection once via a Libname statement (with connection=global) and then use syntax &lt;EM&gt;connect using &amp;lt;libref&amp;gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 23:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958473#M374071</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-05T23:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS--TERA</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958494#M374079</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The connect statement in your 2nd Proc SQL misses&amp;nbsp;&lt;EM&gt;connection=global&lt;/EM&gt; and though creates a new session on Teradata where the volatile tables don't exists.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either have all your SQLs under a single Proc SQL under a single connection, or make sure you use in multiple SQLs the exactly same connection string including connection=global or (my preference) define the connection once via a Libname statement (with connection=global) and then use syntax &lt;EM&gt;connect using &amp;lt;libref&amp;gt;&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;CONNECTION=GLOBAL is not going to magically cause SAS to keep connections open.&amp;nbsp; Instead it is so you can have two more different connections (two libnames&amp;nbsp; or one libname and one SQL step) share the one connection to the database.&amp;nbsp; So for it to allow you to run two separate PROC SQL steps you must have a libref open the whole time.&amp;nbsp; It which point you might as well not bother with the CONNECTION=GLOBAL and just use the CONNECT USING in your PROC SQL steps.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 02:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-TERA/m-p/958494#M374079</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-06T02:59:03Z</dc:date>
    </item>
  </channel>
</rss>

