Truncating Tables

The Truncate command is a PROC SPDO command that allows the deletion of all rows in a table without deleting the table structure or metadata. The PROC SPDO truncate command is shaded for emphasis in the code example below.
%let host=kaboom ;
%let port=5191 ;
%let domain=path2 ;

LIBNAME &domain sasspds "&domain"
   server=&host..&port
   user='anonymous'
   ip=YES ;
/* create a table */
data &domain..staceys_table ;

   do i = 1 to 100 ;
   output ;
end ;
run ;

* verify the contents of the created table */

PROC CONTENTS data=&domain..staceys_table ;
run ;

/* SPDO Truncate command deletes the table  */
/* data but leaves the table structure in   */
/* place so new data can be appended        */
PROC SPDO lib=&domain ;
set acluser ;
Truncate staceys_table ;

quit ;

* verify that no rows or data remain in    */
/* the structure of staceys_table           */
PROC CONTENTS data=&domain..staceys_table ;
run ;