1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 22:14:35 +00:00
Files
core/meta/mm_deletestp.sas
2021-04-03 21:30:51 +02:00

71 lines
1.4 KiB
SAS

/**
@file mm_deletestp.sas
@brief Deletes a Stored Process using path as reference
@details Will only delete the metadata, not any physical files associated.
Usage:
%mm_deletestp(target=/some/meta/path/myStoredProcess)
<h4> SAS Macros </h4>
@param target= full path to the STP being deleted
@version 9.4
@author Allan Bowe
**/
%macro mm_deletestp(
target=
)/*/STORE SOURCE*/;
/**
* Check STP does exist
*/
%local cmtype;
data _null_;
length type uri $256;
rc=metadata_pathobj("","&target",'StoredProcess',type,uri);
call symputx('cmtype',type,'l');
call symputx('stpuri',uri,'l');
run;
%if &cmtype ne ClassifierMap %then %do;
%put NOTE: No Stored Process found at &target;
%return;
%end;
filename __in temp lrecl=10000;
filename __out temp lrecl=10000;
data _null_ ;
file __in ;
put "<DeleteMetadata><Metadata><ClassifierMap Id='&stpuri'/>";
put "</Metadata><NS>SAS</NS><Flags>268436480</Flags><Options/>";
put "</DeleteMetadata>";
run ;
proc metadata in=__in out=__out verbose;run;
/* list the result */
data _null_;infile __out; input; list; run;
filename __in clear;
filename __out clear;
/**
* Check deletion
*/
%local isgone;
data _null_;
length type uri $256;
call missing (of _all_);
rc=metadata_pathobj("","&target",'Note',type,uri);
call symputx('isgone',type,'l');
run;
%if &isgone = ClassifierMap %then %do;
%put %str(ERR)OR: STP not deleted from &target;
%let syscc=4;
%return;
%end;
%mend;