version 20200609

version 20200609, element of type "FUNCTIONS" added  (mind the S at the end, it is not the same as "FUNCTION"). It allows to compile multiple functionS in one FCMP call. Description/instruction will be added soon.
The code of each new function in 'xxx_functions' subfolder should be stored in a single file but without "proc fcmp" header and "run" footer just plain function/subroutine definition.
This commit is contained in:
yabwon
2020-06-09 17:29:54 +02:00
parent aef9868c2d
commit 8846418a50

View File

@@ -36,7 +36,7 @@
*/
/**#############################################################################**/
/* Macros to generate SAS packages, version 20200608 */
/* Macros to generate SAS packages, version 20200609 */
/* A SAS package is a zip file containing a group
of SAS codes (macros, functions, datasteps generating
data, etc.) wrapped up together and %INCLUDEed by
@@ -699,13 +699,14 @@ data _null_;
do until(eof);
set &filesWithCodes. end = EOF nobs=NOBS;
by TYPE notsorted;
if (upcase(type) in: ('CLEAN' 'LAZYDATA' 'TEST')) then continue; /* cleaning files are only included in unload.sas */
/* lazy data are only loaded on demand
%loadPackage(packagename, lazyData=set1 set2 set3)
test files are used only during package generation
*/
/* test for supported types */
if not (upcase(type) in: ('LIBNAME' 'MACRO' 'DATA' 'FUNCTION' 'FORMAT' 'EXEC' 'CLEAN' 'LAZYDATA' 'TEST')) then
if not (upcase(type) in: ('LIBNAME' 'MACRO' 'DATA' 'FUNCTION' /*'FUNCTIONS'*/ 'FORMAT' 'EXEC' 'CLEAN' 'LAZYDATA' 'TEST')) then
do;
putlog 'WARNING: Type ' type 'is not yet supported.';
continue;
@@ -727,8 +728,18 @@ data _null_;
put '%put NOTE- ;';
end;
if 1 = FIRST.type and upcase(type)='FUNCTIONS' then /* for multiple functions in one FCMP run */
do;
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package; ";
end;
put '%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;' /;
if 1 = LAST.type and upcase(type)='FUNCTIONS' then /* for multiple functions in one FCMP run */
do;
put "run; ";
end;
isFunction + (upcase(type)=:'FUNCTION');
isFormat + (upcase(type)=:'FORMAT');
@@ -1105,7 +1116,7 @@ data _null_;
put ' end ; ';
%end;
put 'put "***"; put "* SAS package generated by generatePackage, version 20200608 *"; put "***";';
put 'put "***"; put "* SAS package generated by generatePackage, version 20200609 *"; put "***";';
put 'run; ' /;
@@ -1144,7 +1155,7 @@ data _null_;
select;
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
when (upcase(type) = "MACRO") fileshort2 = cats('%',fileshort,'()');
when (upcase(type) = "FUNCTION") fileshort2 = cats(fileshort,'()');
when (upcase(type) =:"FUNCTION") fileshort2 = cats(fileshort,'()');
when (upcase(type) = "FORMAT") fileshort2 = cats('$',fileshort);
otherwise fileshort2 = fileshort;
end;