You can
use the DropTable method to delete a SAS data set from its associated
data source. The definition of data source depends on the provider
that is being used:
-
For the Base SAS provider, a data
source consists of all library names that are known to a local installation
of Base SAS.
-
For the
SAS/SHARE provider, a data
source consists of all library names that are known to a
SAS/SHARE
server.
-
For the IOM provider, a data source
consists of all library names that are known to a SAS Workspace Server.
CAUTION:
Be careful when you design an application that implements
this method.
If you give users the
ability to erase data sets, you should also build in safeguards to
prevent them from accidentally deleting data sets.
The DropTable
method's single parameter is an instance of the DBID structure, which
is used to specify the name of the data set (table) and its variables
(columns). The following code shows how to set up a DBID structure
to delete a data set named MYDATA in a library named MYLIB.
DBID TableID;
TableID.eKind = DBKIND_NAME;
TableID.uName.pwszName = L"MYLIB.MYDATA";
The following
code shows how you would use this DBID structure to delete the data
set:
IDBCreateSession * pCreateSession;
ITableDefinition * pTableDefinition;
pDSO->QueryInterface( IID_IDBCreateSession, );
pCreateSession->CreateSession( NULL, // no aggregation
IID_ITableDefinition, // ID of the interface we want on the session object
); // address of pointer to session
pTableDefinition->DropTable( );