BookmarkSubscribeRSS Feed
Premier
Calcite | Level 5

Is it possible to create multiple volatile teradata  tables in the same SAS session?

Eg. Create a volatile table called vol1 with 10 records in it.

      Then create a 2nd volatile table called vol2 that will read the records from vol1.

1 REPLY 1
ScottBass
Rhodochrosite | Level 12

I'm a bit late to the party with this reply, but in case someone else finds this in the future...

 

libname x  teradata server=&server authdomain=&authdomain connection=global dbmstemp=yes;

options sastrace=',,,d' sastraceloc=saslog;

data x.vol1;
   do x=1 to 10;
      output;
   end;
run;

data x.vol2;
   set x.vol1;
   y=x**2;
run;

* explicit passthru ;
proc sql;
   connect to teradata(server=&server authdomain=&authdomain connection=global);
   execute (
      CREATE MULTISET VOLATILE TABLE vol3 AS 
      (
         SELECT x,y,(x**3) as z FROM vol2
      ) WITH DATA
      ON COMMIT PRESERVE ROWS
   ) by teradata;
   execute (COMMIT WORK) by teradata;
quit;

* data returned in indeterminate order ;
title "vol1";
proc print data=x.vol1;
run;

title "vol2";
proc print data=x.vol2;
run;

title "vol3";
proc print data=x.vol3;
run;

proc sql;
   title "SQL select";
   select * from x.vol3 order by x;
   create view foo as select * from x.vol3 order by x;
quit;

title "foo view";
proc print data=foo;
run;

Pay close attention to the trace output in the SAS log.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2943 views
  • 0 likes
  • 2 in conversation