Temporary Table Support for Sybase

Overview

For general information about this feature, see Temporary Table Support for SAS/ACCESS .

Establishing a Temporary Table

When you specify CONNECTION=GLOBAL, you can reference a temporary table throughout a SAS session, in both DATA steps and procedures. The name of the table MUST start with the character '#'. To reference it, use the SAS convention of an n literal, as in mylib.'#foo'n.

Terminating a Temporary Table

You can drop a temporary table at any time, or allow it to be implicitly dropped when the connection is terminated. Temporary tables do not persist beyond the scope of a singe connection.

Example

This example shows how to use temporary tables.
/* clear any connection */
libname x clear;

libname x sybase user=test pass=test connection=global;

/* create the temp table. You can even use bulk copy */
/* Notice how the name is specified: '#mytemp'n */
   data x.'#mytemp'n (bulk=yes);
   x=55;
   output;
   x=44;
   output;
run;

/* print it */
proc print data=x.'#mytemp'n;
run ;

/* The same temp table persists in PROC SQL, */
/* with the global connection specified */
proc sql;
   connect to sybase (user=austin pass=austin connection=global);
   select * from connection to sybase (select * from #mytemp);
quit;

/* use the temp table again in a procedure */
proc means data=x.'#mytemp'n;
run;

/* drop the connection, the temp table is automatically dropped */
libname x clear;

/* to convince yourself it's gone, try to access it */
libname x sybase user=austin password=austin connection=global;

/* it's not there */
proc print data=x.'#mytemp'n;
run;