%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=metadata-server-port>
);

%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 to use in authenticating the user ID to the metadata server.

You can use the PWENCODE form of the password. For more information about the PWENCODE procedure, see the Base SAS Procedures Guide.
Tip
If you use the PWENCODE form of the password, be sure to handle embedded braces ({}) carefully. Do not confuse them with square brackets ([]).

METASERVER=name-of-metadata-server

specifies the name of the metadata server. A value for this parameter is required.

METAUSER=user-ID

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

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 (zFS file system). A value for this

%RMDELETE Options

METAREPOSITORY=name-of-metadata-repository

the name of the metadata repository. The default value for this option is Foundation.

METAPORT=metadata-server-port

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 set the correct options.
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.
CAUTION:
On a directory-based system, if you specify the erase function for an IT data mart, any content that exists under the root path of that IT data mart is deleted.
In other words, content that is not related to the IT data mart is deleted. (This applies only to directory-based systems. It does not apply to traditional z/OS systems.)

%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(
          datamart=myITDataMart
          metapass=myPassword,
          metaserver=myServer, 
          metauser=myUserid,
          type=purge,
          workdir=c:\temp\workdir
          );

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(
          metapass=myPassword, 
          metaserver=myServer,
          metauser=myUserid,
          tableID=A55DZBQ6.B70000ZC
          type=erase,
          workdir=c:\temp\workdir
         );