TRUNCATE Command and Example

The TRUNCATE command is a PROC SPDO command that enables you to delete all of the rows in a table without deleting the table structure or metadata.
%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;