Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mm_deletestp.sas
Go to the documentation of this file.
1/**
2 @file mm_deletestp.sas
3 @brief Deletes a Stored Process using path as reference
4 @details Will only delete the metadata, not any physical files associated.
5
6 Usage:
7
8 %mm_deletestp(target=/some/meta/path/myStoredProcess)
9
10 <h4> SAS Macros </h4>
11
12 @param [in] target= full path to the STP being deleted
13
14 @version 9.4
15 @author Allan Bowe
16
17**/
18
19%macro mm_deletestp(
20 target=
21)/*/STORE SOURCE*/;
22
23/**
24 * Check STP does exist
25 */
26%local cmtype;
27data _null_;
28 length type uri $256;
29 rc=metadata_pathobj("","&target",'StoredProcess',type,uri);
30 call symputx('cmtype',type,'l');
31 call symputx('stpuri',uri,'l');
32run;
33%if &cmtype ne ClassifierMap %then %do;
34 %put NOTE: No Stored Process found at &target;
35 %return;
36%end;
37
38filename __in temp lrecl=10000;
39filename __out temp lrecl=10000;
40data _null_ ;
41 file __in ;
42 put "<DeleteMetadata><Metadata><ClassifierMap Id='&stpuri'/>";
43 put "</Metadata><NS>SAS</NS><Flags>268436480</Flags><Options/>";
44 put "</DeleteMetadata>";
45run ;
46proc metadata in=__in out=__out verbose;run;
47
48/* list the result */
49data _null_;infile __out; input; list; run;
50
51filename __in clear;
52filename __out clear;
53
54/**
55 * Check deletion
56 */
57%local isgone;
58data _null_;
59 length type uri $256;
60 call missing (of _all_);
61 rc=metadata_pathobj("","&target",'Note',type,uri);
62 call symputx('isgone',type,'l');
63run;
64%if &isgone = ClassifierMap %then %do;
65 %put %str(ERR)OR: STP not deleted from &target;
66 %let syscc=4;
67 %return;
68%end;
69
70%mend mm_deletestp;