mirror of
https://github.com/sasjs/core.git
synced 2026-01-16 04:50:05 +00:00
chore: updating all.sas
This commit is contained in:
125
all.sas
125
all.sas
@@ -7601,6 +7601,98 @@ run;
|
|||||||
%return;
|
%return;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mend;
|
||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Deletes a library by Name
|
||||||
|
|
||||||
|
@details Used to delete a library.
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
%* create a library in the home directory ;
|
||||||
|
%mm_createlibrary(
|
||||||
|
libname=My Temp Library,
|
||||||
|
libref=XXTEMPXX,
|
||||||
|
tree=/User Folders/&sysuserid,
|
||||||
|
directory=%sysfunc(pathname(work))
|
||||||
|
)
|
||||||
|
|
||||||
|
%* delete the library ;
|
||||||
|
%mm_deletelibrary(name=My Temp Library)
|
||||||
|
|
||||||
|
After running the above, the following will be shown in the log:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
@param [in] name= the name (not libref) of the library to be deleted
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_getuniquefileref.sas
|
||||||
|
@li mp_abort.sas
|
||||||
|
|
||||||
|
|
||||||
|
@version 9.4
|
||||||
|
@author Allan Bowe
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mm_deletelibrary(
|
||||||
|
name=
|
||||||
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if library exists and get uri
|
||||||
|
*/
|
||||||
|
data _null_;
|
||||||
|
length type uri $256;
|
||||||
|
rc=metadata_resolve("omsobj:SASLibrary?@Name='&name'",type,uri);
|
||||||
|
call symputx('checktype',type,'l');
|
||||||
|
call symputx('liburi',uri,'l');
|
||||||
|
putlog (_all_)(=);
|
||||||
|
run;
|
||||||
|
%if &checktype ne SASLibrary %then %do;
|
||||||
|
%put &sysmacroname: Library (&name) was not found, and so will not be deleted;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
%local fname1 fname2;
|
||||||
|
%let fname1=%mf_getuniquefileref();
|
||||||
|
%let fname2=%mf_getuniquefileref();
|
||||||
|
|
||||||
|
filename &fname1 temp lrecl=10000;
|
||||||
|
filename &fname2 temp lrecl=10000;
|
||||||
|
data _null_ ;
|
||||||
|
file &fname1 ;
|
||||||
|
put "<DeleteMetadata><Metadata><SASLibrary Id='&liburi'/>";
|
||||||
|
put "</Metadata><NS>SAS</NS><Flags>268436480</Flags><Options/>";
|
||||||
|
put "</DeleteMetadata>";
|
||||||
|
run ;
|
||||||
|
proc metadata in=&fname1 out=&fname2 verbose;run;
|
||||||
|
|
||||||
|
/* list the result */
|
||||||
|
data _null_;infile &fname2; input; list; run;
|
||||||
|
|
||||||
|
filename &fname1 clear;
|
||||||
|
filename &fname2 clear;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check deletion
|
||||||
|
*/
|
||||||
|
%local isgone;
|
||||||
|
data _null_;
|
||||||
|
length type uri $256;
|
||||||
|
rc=metadata_resolve("omsobj:SASLibrary?@Id='&liburi'",type,uri);
|
||||||
|
call symputx('isgone',type,'l');
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_abort(iftrue=(&isgone = SASLibrary)
|
||||||
|
,mac=&sysmacroname
|
||||||
|
,msg=%str(Library (&name) NOT deleted)
|
||||||
|
)
|
||||||
|
|
||||||
|
%put &sysmacroname: Library &name (&liburi) was successfully deleted;
|
||||||
|
|
||||||
%mend;
|
%mend;
|
||||||
/**
|
/**
|
||||||
@file mm_deletestp.sas
|
@file mm_deletestp.sas
|
||||||
@@ -8453,6 +8545,39 @@ run;
|
|||||||
options metarepository=&oldrepo;
|
options metarepository=&oldrepo;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mend;/**
|
||||||
|
@file
|
||||||
|
@brief Compares the metadata of a library with the physical tables
|
||||||
|
|
||||||
|
@param [out] prefix the dataset to create that contains the list of libraries
|
||||||
|
@param mDebug set to anything but 0 to show debug messages in the log
|
||||||
|
|
||||||
|
@test Create a temporary library as follows:
|
||||||
|
|
||||||
|
%
|
||||||
|
|
||||||
|
@details Creates a series of output tables that show the differences between
|
||||||
|
metadata and physical tables.
|
||||||
|
Each output can be created with an optional prefix.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@version 9.3
|
||||||
|
@author Allan Bowe
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mm_getlibmetadiffs
|
||||||
|
prefix=metadiff
|
||||||
|
,mdebug=0
|
||||||
|
)/*/STORE SOURCE*/;
|
||||||
|
|
||||||
|
%if &mdebug = 0 %then %let mdebug=*;
|
||||||
|
|
||||||
|
&mdebug %put _local_;
|
||||||
|
|
||||||
|
|
||||||
%mend;/**
|
%mend;/**
|
||||||
@file
|
@file
|
||||||
@brief Creates a dataset with all metadata libraries
|
@brief Creates a dataset with all metadata libraries
|
||||||
|
|||||||
Reference in New Issue
Block a user