%RMDELETE

%RMDELETE Overview

The %RMDELETE macro enables you to purge, erase, or delete either a table or an entire IT data mart. The TYPE=, DATAMART=, and TABLEID= arguments determine the actions to perform.

%RMDELETE Syntax

%RMDELETE(
DATAMART=name-of-ITdatamart | TABLEID=table-ID
,METAPASS=user-password
, METASERVER=name-of-metadata-server
, METAUSER=user-ID
, TYPE=PURGE | ERASE | DELETE
, WORKDIR=directory-path-for-work-files
,<METADATAREPOSITORY=name-of-metadata-repository>
,<METAPORT=port-for-metadata-server>
);

%RMDELETE Required Arguments

DATAMART=name-of-ITdatamart
specifies the name of the IT data mart that is to be purged, erased, or deleted. If the TABLEID argument is not specified, a value for this option is required.
TABLEID=table-ID
specifies the name of the table that is to be purged, erased, or deleted. If the DATAMART argument is not specified, a value for this option is required.
METAPASS=user-password
specifies the password that is associated with the metauser ID. A value for this parameter is required.
METASERVER=name-of-metadata-server
specifies the name of the metadata server. A value for this parameter is required.
METAUSER=user-ID
specifies the user ID that is to access the metadata server. A value for this parameter is required.
TYPE=PURGE | ERASE | DELETE
specifies the function that the macro is to perform. The function varies depending on whether an IT data mart or a table is specified. A value for this parameter is required.
PURGE If the DATAMART argument is specified, the PURGE function deletes the contents of all the physical tables that are associated with the specified IT data mart. If the TABLEID argument is specified, the PURGE function deletes the contents of the specified physical table.
ERASE If the DATAMART argument is specified, the ERASE function deletes all the physical tables, libraries, and folders that are associated with the specified IT data mart. It also deletes the metadata for the specified IT data mart. If the TABLEID argument is specified, the ERASE function deletes the physical table and the metadata for the specified table.
DELETE If the DATAMART argument is specified, the DELETE function deletes the metadata for the specified IT data mart. If the TABLEID argument is specified, the DELETE function deletes the metadata for the specified table.
WORKDIR=directory-location
specifies a directory where %RMDELETE can write temporary external files. If this directory does not exist, it is created. For z/OS, this parameter needs to be a UNIX System Services directory path (HFS or zFS file system). A value for this parameter is required.

%RMDELETE Options

METAREPOSITORY=name-of-metadata-repository
specifies the name of the metadata repository. The default value for this option is Foundation.
METAPORT=port-for-metadata-server
specifies the port for the metadata server. The default value for this option is 8561.

%RMDELETE Notes

On Windows, run this macro with the sasbatch.bat command in order to have the correct options set.
The %RMDELETE code must be run on the same machine that the data is located, because the data libraries are accessed with local LIBNAME statements.
If %RMDELETE is accessing an IT data mart on a metadata server on z/OS, the SAS session and the metadata server must have the same character-set encoding.

%RMDELETE Examples

Example 1: Purging All Tables in an IT Data Mart

The following example purges all the tables in the IT data mart called “myITDataMart.”
%rmdelete(metaserver=myServer, 
          metauser=myUserid,
          metapass=myPassword, 
          workdir=c:\temp\workdir, 
          type=purge, 
          datamart=myITDataMart); 

Example 2: Erasing a Table in an IT Data Mart

The following example erases the physical table with the A55DZBQ6.B70000ZC metadata ID. It also deletes the metadata for that table.
%rmdelete(metaserver=myServer, 
          metauser=myUserid, 
          metapass=myPassword,
          workdir=c:\temp\workdir, 
          type=erase, 
          tableID=A55DZBQ6.B70000ZC);