<?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 How to create volatile tables from SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910232#M358990</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am running query code in SAS that&amp;nbsp; work on Tera tables.&lt;/P&gt;
&lt;P&gt;The query has 2 parts:&lt;/P&gt;
&lt;P&gt;1-In part 1 I create table called&amp;nbsp;t_dates&amp;nbsp; and this table is a sas data set.&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 t_dates  as 
select * from connection to teradata
(
SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE
);
disconnect from teradata;
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2-In part 2 the query merge SAS data set with Tera table and then I get an error because Tera doesnt know the SAS data set that was created (t_dates)&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  a.*
FROM VBM5732_AGR_DELAYED_PAYMENTS  AS a 
Where AS52_TAR_DHIA BETWEEN(SEL START_DATE FROM t_dates)  AND (SEL END_DATE FROM t_dates)
);
disconnect from teradata;
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got an error because Tera doesnt know the sas data set that was created,&lt;/P&gt;
&lt;P&gt;Then I have tried to create Tera&amp;nbsp;volatile table but this method is not working&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
execute (
create volatile table t_dates as (

SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE

    ) with data on commit preserve rows 
  ) by teradata;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My Question- How to create volatile tables from SAS ????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 13:11:59 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2024-01-03T13:11:59Z</dc:date>
    <item>
      <title>How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910232#M358990</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am running query code in SAS that&amp;nbsp; work on Tera tables.&lt;/P&gt;
&lt;P&gt;The query has 2 parts:&lt;/P&gt;
&lt;P&gt;1-In part 1 I create table called&amp;nbsp;t_dates&amp;nbsp; and this table is a sas data set.&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 t_dates  as 
select * from connection to teradata
(
SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE
);
disconnect from teradata;
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2-In part 2 the query merge SAS data set with Tera table and then I get an error because Tera doesnt know the SAS data set that was created (t_dates)&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  a.*
FROM VBM5732_AGR_DELAYED_PAYMENTS  AS a 
Where AS52_TAR_DHIA BETWEEN(SEL START_DATE FROM t_dates)  AND (SEL END_DATE FROM t_dates)
);
disconnect from teradata;
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got an error because Tera doesnt know the sas data set that was created,&lt;/P&gt;
&lt;P&gt;Then I have tried to create Tera&amp;nbsp;volatile table but this method is not working&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
execute (
create volatile table t_dates as (

SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE

    ) with data on commit preserve rows 
  ) by teradata;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My Question- How to create volatile tables from SAS ????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 13:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910232#M358990</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-03T13:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910244#M358996</link>
      <description>&lt;P&gt;Don't make TWO different connections to the database, that will lose your volatile tables from the first table when the first connection ends.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make a LIBREF and leave it open for the whole process.&amp;nbsp; You can use the&amp;nbsp;dbmstemp=yes to allow you to access volatile tables.&amp;nbsp; (You will need the check what schema to use. I seem to remember it uses your Teradata userid as the schema name for the volatile tables.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libref td teradata .... dmstemp=yes ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can use that in PROC SQL if you want.&amp;nbsp; So if you do something like this to make volatile table xxx&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect using td ;
execute by td 
(create volatile table xxx ..... )
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can later reference from SAS using TD.XXX as the dataset name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could use PROC APPEND to copy a dataset into TD.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append base=td.class data=sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then reference it from pass through code running in Teradata.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect using td;
create table results as select * from connection to td
(select * from schema.table where name in 
 (select name from xxx)
);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2024 13:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910244#M358996</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-03T13:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910368#M359016</link>
      <description>&lt;P&gt;On top of what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote make sure that the connection is global.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n166tqlopg9p0bn1okz4ilmde7mp.htm" target="_self"&gt;CONNECTION= LIBNAME Statement Option&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1704341480520.png" style="width: 760px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92246i21D8E56646CE889B/image-dimensions/760x54?v=v2" width="760" height="54" role="button" title="Patrick_0-1704341480520.png" alt="Patrick_0-1704341480520.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I also suggest you read the following two docu entries.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/p0gu3f7qh8i83jn18af4i1bf2xlp.htm" target="_self"&gt;Temporary Table Support for Teradata&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0irpkyp22l7vzn1il9lx6f4wmx9.htm" target="_self"&gt;Temporary Table Support for SAS/ACCESS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 04:13:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910368#M359016</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-04T04:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910388#M359020</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Bases on my example can you show the all code?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*****Creating SAS DATA SET FROM Tera table**********/
/*****Creating SAS DATA SET FROM Tera table**********/
/*****Creating SAS DATA SET FROM Tera table**********/
proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table t_dates_Sas_Data_SET  as 
select * from connection to teradata
(
SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE
);
disconnect from teradata;
quit ;


/*****Creating Teradata Volatile Table from FROM Tera table**********/
/*****Creating Teradata Volatile Table from FROM Tera table**********/
/*****Creating Teradata Volatile Table from FROM Tera table**********/
proc sql;
 connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth connection=global);
 execute(
 create volatile table t_dates_Tera_volatile as (
SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE
 )
 with data primary index (START_DATE)
 on commit preserve rows
 ) by teradata;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As I see I didn't succeed creating Tera&amp;nbsp;Volatile table because&amp;nbsp; I run this code and got error&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 Check_Tera_volatile  as 
select * from connection to teradata
(*
from t_dates_Tera_volatile
);
disconnect from teradata;

quit ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jan 2024 06:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910388#M359020</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-04T06:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910389#M359021</link>
      <description>&lt;P&gt;TeraData libname is already&amp;nbsp; defined .&lt;/P&gt;
&lt;P&gt;I have checked and When I run this code then it iw working 100%&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs=5;
create table Check_Libname_TeraData as
select *
from teradata.V797_PROCESS_DATE
;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, this code to create Tera Violate table is not working&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
connect using teradata ;
execute by teradata 
( create volatile table t_dates_Tera_volatile as 
(SELECT (CAST('01/01/2024' AS DATE FORMAT 'DD/MM/YYYY')) as START_DATE ,
        Max(PROCESS_DATE) as End_Date 
FROM   V797_PROCESS_DATE
) 
)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jan 2024 06:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910389#M359021</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-04T06:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910398#M359027</link>
      <description>&lt;P&gt;If your program isn't working then you should always check your SAS log for errors, warnings and notes. Please post your complete SAS log, including your LIBNAME statement - does it include the DBMSTEMP = YES option as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; explained?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 09:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910398#M359027</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-01-04T09:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create volatile tables from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910555#M359081</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;Looks like you haven't read the docu under the links I've shared.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please also always share the SAS log if there are errors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Isn't it obvious to you why below code can't work. What does the SAS log tell you?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1704416487480.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92286iBBB9E6FD1E474AA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1704416487480.png" alt="Patrick_0-1704416487480.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 01:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-volatile-tables-from-SAS/m-p/910555#M359081</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-05T01:02:10Z</dc:date>
    </item>
  </channel>
</rss>

