mirror of
https://github.com/sasjs/core.git
synced 2026-01-19 22:40:06 +00:00
feat(*): recreate library as scoped package
This commit is contained in:
70
meta/mm_deletestp.sas
Normal file
70
meta/mm_deletestp.sas
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
@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> Dependencies </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 ⌖
|
||||
%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 ⌖
|
||||
%let syscc=4;
|
||||
%return;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
Reference in New Issue
Block a user