SAS Packages Framework, version 20241027
SAS Packages Framework, version 20241027
Changes
New simple utility macro: %splitCodeForPackage()
added to the framework. Now we have a dozen!
The macro is a "helping-hand" for those developers who have a "one-big-code" file and want to turn it into a package structure (separate files in subdirectories) but are to lazy to do it manually. Whit help of additional tags
the macro automatically splits the code file according to the developer's wish.
Run:
%splitCodeForPackage(HELP)
to see more details or, probably even better, visit the Documentation and Hands-on-Workshops materials to learn how %splitCodeForPackage()
works .
Example:
Let's assume that the myPackageCode.sas
file is located in the C:/lazy/
folder and contain the following code and tags:
/*##$##-code-block-start-##$## 01_macro(abc) */
%macro abc();
%put I am "abc".;
%mend abc;
/*##$##-code-block-end-##$## 01_macro(abc) */
/*##$##-code-block-start-##$## 01_macro(efg) */
%macro efg();
%put I am "efg".;
%mend efg;
/*##$##-code-block-end-##$## 01_macro(efg) */
proc FCMP outlib=work.f.p;
/*##$##-code-block-start-##$## 02_functions(xyz) */
function xyz(n);
return(n**2 + n + 1)
endfunc;
/*##$##-code-block-end-##$## 02_functions(xyz) */
quit;
and we want results in C:/split/
folder. We run the following:
filename packages "C:/SAS_PACKAGES"; %* a directory for the framework and packages;
%include packages(SPFinit.sas); %* enable the framework;
%splitCodeForPackage(
codeFile=C:/lazy/myPackageCode.sas
,packagePath=C:/split/ )
As a result two subdirectories 01_macro
and 02_functions
are created inside C:/split/
. The first contains two files: abc.sas
and efg.sas
with corresponding macros definitions, the second contains xyz.sas
file with definition of the xyz
function.
Nesting, overlapping, and multiple file redirection is supported.