<?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: Create volatile table in Tera via SAS  and view the table in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911372#M359392</link>
    <description>Would guess that you need to register the table in SAS meta data.</description>
    <pubDate>Fri, 12 Jan 2024 11:27:07 GMT</pubDate>
    <dc:creator>rudfaden</dc:creator>
    <dc:date>2024-01-12T11:27:07Z</dc:date>
    <item>
      <title>Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911365#M359388</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to write a code in SAS that create&amp;nbsp;volatile table and then view the table in SAS .&lt;/P&gt;
&lt;P&gt;Here are 2 examples:&lt;/P&gt;
&lt;P&gt;Example 1 is working 100%&lt;/P&gt;
&lt;P&gt;Example 2 is getting an error(ERROR: File TDWORK.t_VBM374.DATA does not exist)&lt;/P&gt;
&lt;P&gt;Can explain and fix the code in order that example 2 work well?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/***Example1****/
/***Example1****/
/***Example1****/
/* Set global connection for all tables*/
libname tdwork teradata mode=teradata server=dwprod schema=DWP_vall authdomain=TeraDataAuth CONNECTION=GLOBAL  dbmstemp=yes ;
/*Run in SAS-Create a volatile table*/
proc sql;
   connect to teradata(server=dwprod schema=DWP_vall authdomain=TeraDataAuth connection=global);

   execute (CREATE VOLATILE TABLE ttt (col1 INT) 
            ON COMMIT PRESERVE ROWS) by teradata;

quit;
/*Run in SAS-Insert 1 row into the volatile table*/
proc sql;
   connect to teradata(server=dwprod schema=DWP_vall authdomain=TeraDataAuth connection=global);
   execute (INSERT INTO ttt VALUES(2)) by teradata;
quit;
/* Access the temporary table through the global libref*/
proc print data=tdwork.ttt;run;


/***Example2****/
/***Example2****/
/***Example2****/
/* Set global connection for all tables*/
libname tdwork teradata mode=teradata server=dwprod schema=DWP_vall authdomain=TeraDataAuth CONNECTION=GLOBAL dbmstemp=yes ;
/*Run in SAS-Create a volatile table*/
proc sql;
connect to teradata(server=dwprod schema=DWP_vall authdomain=TeraDataAuth connection=global);
execute (
create volatile table t_VBM374 as (
SELECT top 5 *
from VBM374_USED_BRANCH_CUSTOMER
) by teradata;
quit;
/*Access the temporary table through the global libref*/
proc print data=tdwork.t_VBM374;run;
/*ERROR: File TDWORK.t_VBM374.DATA does not exist.*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jan 2024 10:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911365#M359388</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-12T10:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911372#M359392</link>
      <description>Would guess that you need to register the table in SAS meta data.</description>
      <pubDate>Fri, 12 Jan 2024 11:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911372#M359392</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2024-01-12T11:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911395#M359399</link>
      <description>&lt;P&gt;What does it mean? can you show code please?&lt;/P&gt;
&lt;P&gt;What is the difference between example 1 and example 2 that in example 1 I can view the table in SAS and in example 2 cannot?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911395#M359399</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-12T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911396#M359400</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/117666"&gt;@rudfaden&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Would guess that you need to register the table in SAS meta data.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect you are thinking about controlled environments using SAS metadata manager.&lt;/P&gt;
&lt;P&gt;These examples have nothing to do with that system.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They are just using plain old SAS code.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911396#M359400</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-12T16:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911397#M359401</link>
      <description>&lt;P&gt;Can you highlight exactly what you changed between the two examples?&lt;/P&gt;
&lt;P&gt;To me it looks like you made these changes.&lt;/P&gt;
&lt;P&gt;1) Different dataset (aka "table") name.&lt;/P&gt;
&lt;P&gt;2) Used a query to define the table instead of actually defining the variables.&amp;nbsp; Did you check with Teradata query that this step actually worked.&lt;/P&gt;
&lt;P&gt;3) In the first the dataset name is all lowercase letters, in the second it is mixed. I don't think that matters in Teradata, but it does matter in other database languages like POSTGRESQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Your first used the clause "ON COMMIT PRESERVE ROWS" and the second did not.&amp;nbsp; Does that mean the insertion of data was never done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At a minimum add a step to check that the volatile table creation in the second query actually worked.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * from connection to teradata
(select cast(count(*) as float) as nobs from t_VMB374)
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also why are you bothering to redefine the connection each time you want to use PROC SQL?&amp;nbsp; Just reuse the connection you made with the LIBNAME statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect using TDWORK as TERADATA.
execute by teradata (....) ;
select ... from connection to teradata (....);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911397#M359401</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-12T16:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create volatile table in Tera via SAS  and view the table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911504#M359424</link>
      <description>&lt;P&gt;Inspect in detail this docu sample:&amp;nbsp;Example: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/p0he4t6yjfmkhpn16qrf0cdhllu6.htm#p1670uazqoglsvn1iywvcd6pv8d4" target="_self"&gt;Create and Join a Permanent Table and a Temporary Table&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DO NOT create a new connection for explicit passthrough...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1705201435259.png" style="width: 636px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92526i5181F4F65B540720/image-dimensions/636x35?v=v2" width="636" height="35" role="button" title="Patrick_0-1705201435259.png" alt="Patrick_0-1705201435259.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;...but either use implicit pass-through like in the sample code (with the libref for temp tables) OR use the libref for temp tables in your connection statement (I believe with explicit pass-through you can actually use either of the two librefs).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1705201608239.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92527iFDD3484F20587F82/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1705201608239.png" alt="Patrick_1-1705201608239.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your 2nd code sample: I would expect that you need to use a two level name &amp;lt;schema&amp;gt;.&amp;lt;table&amp;gt; for this to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_3-1705202332929.png" style="width: 390px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92529i40965DEAA6B00C15/image-dimensions/390x124?v=v2" width="390" height="124" role="button" title="Patrick_3-1705202332929.png" alt="Patrick_3-1705202332929.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You should by now also know that just stating&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 03:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-volatile-table-in-Tera-via-SAS-and-view-the-table-in-SAS/m-p/911504#M359424</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-14T03:25:08Z</dc:date>
    </item>
  </channel>
</rss>

