diff --git a/generatePackage.sas b/generatePackage.sas index 4d4e74a..6832d33 100644 --- a/generatePackage.sas +++ b/generatePackage.sas @@ -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;