%RMDELPVT

%RMDELPVT Overview

The %RMDELPVT macro deletes the unused private code macros that are stored in the data libraries of staged and aggregation tables.
The private code macros are in a catalog in each library called SASMACR. Each time the code is generated for a job, either from the PFD or by deploying the job, a new version of the private code macro is generated. Old versions of the private code macros are not deleted, so the SASMACR catalog continues to grow every time the code is generated.
The %RMDELPVT macro deletes the unused private code macros from the SASMACR catalog. %RMDELPVT determines whether a private code macro is still in use. It does so by parsing the SAS code for all the deployed jobs and retrieving the name of the private code macro from the code. (This private code macro that is used in a deployed job is considered to be in use, and it is not deleted.) All private code macros that are not used in deployed jobs are deleted.

%RMDELPVT Syntax

%RMDELPVT(
BACKUPLOCATION=name-of-the-backup-library
,DATAMART=name-of-the-IT-data-mart
,METAPASS=user-password
,METASERVER=name-of-metadata-server
,METAUSER=user-ID

<,DOBACKUP=Yes | No>
<,DODELETE=Yes | No>
<,DOREPORT=Yes | No>
<,DORESTORE=Yes | No>
<,METAPORT=metadata-server-port>
);

%RMDELPVT Required Arguments

BACKUPLOCATION=name-of-the-backup-library

specifies the name of an existing SAS library that stores a backup of the SASMACR catalogs.

Note: The entire contents of this library will be deleted before running the backup procedure.
The default value of this argument is YES. This argument is required if the DORESTORE option is set to Yes.

DATAMART=name-of-the-IT-data-mart

specifies the name of the IT data mart. The macro will clean up all the private code in this IT data mart.

This value is not case sensitive.

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.

METAUSER=user-ID

specifies the user ID that is to access the metadata server.

%RMDELPVT Options

DOBACKUP=Yes | No

specifies whether to perform a backup of the SASMACR catalogs before they are cleaned.

The default value of this argument is YES.

DODELETE=Yes | No

specifies whether to delete the unused private macros from the data mart libraries. A report that indicates the results of the process is generated.

The default value of this argument is No.

DOREPORT=Yes | No

specifies whether to create a report that shows the private macros that are found in the IT data mart libraries. It also shows which private macros are in use in deployed jobs.

The default value of this argument is Yes.

DORESTORE=Yes | No

specifies whether to restore the data from the backup made during a previous run of the macro. If doRestore is set to Yes, only the BACKUPLOCATION option is required. No other functions are performed and all other options are ignored.

The default value of this argument is No.

METAPORT=metadata-server-port

specifies the port of the metadata server.

The default value for this option is 8561.

%RMDELPVT Notes

The %RMDELPVT provides the ability to back up the SASMACR catalogs before cleaning them. It also provides the ability to restore the data from the backup.

%RMDELPVT Example

Example 1: Run the Report and Perform the Backup and Delete Functions

This example runs the report and performs the backup and delete functions on a data mart called “my IT Data Mart”.
%rmdelpvt(
          backupLocation=c:\rmdelpvt_backup,
          dataMart=my IT Data Mart, 
          doBackup=YES,
          doDelete=YES,
          doReport=YES, 
          metaPass=myPassword, 
          metaPort=8561,
          metaServer=myServer,
          metaUser=myUserid 
         );  

Example 2: Restore the Backup

This example restores the backup to the original IT data mart.
%rmdelpvt(
          backupLocation=c:\rmdelpvt_backup)
          doRestore=YES
);