mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-11 00:40:06 +00:00
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:
@@ -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
|
/* A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, datasteps generating
|
of SAS codes (macros, functions, datasteps generating
|
||||||
data, etc.) wrapped up together and %INCLUDEed by
|
data, etc.) wrapped up together and %INCLUDEed by
|
||||||
@@ -699,13 +699,14 @@ data _null_;
|
|||||||
|
|
||||||
do until(eof);
|
do until(eof);
|
||||||
set &filesWithCodes. end = EOF nobs=NOBS;
|
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 */
|
if (upcase(type) in: ('CLEAN' 'LAZYDATA' 'TEST')) then continue; /* cleaning files are only included in unload.sas */
|
||||||
/* lazy data are only loaded on demand
|
/* lazy data are only loaded on demand
|
||||||
%loadPackage(packagename, lazyData=set1 set2 set3)
|
%loadPackage(packagename, lazyData=set1 set2 set3)
|
||||||
test files are used only during package generation
|
test files are used only during package generation
|
||||||
*/
|
*/
|
||||||
/* test for supported types */
|
/* 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;
|
do;
|
||||||
putlog 'WARNING: Type ' type 'is not yet supported.';
|
putlog 'WARNING: Type ' type 'is not yet supported.';
|
||||||
continue;
|
continue;
|
||||||
@@ -727,8 +728,18 @@ data _null_;
|
|||||||
put '%put NOTE- ;';
|
put '%put NOTE- ;';
|
||||||
end;
|
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;' /;
|
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');
|
isFunction + (upcase(type)=:'FUNCTION');
|
||||||
isFormat + (upcase(type)=:'FORMAT');
|
isFormat + (upcase(type)=:'FORMAT');
|
||||||
|
|
||||||
@@ -1105,7 +1116,7 @@ data _null_;
|
|||||||
put ' end ; ';
|
put ' end ; ';
|
||||||
%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; ' /;
|
put 'run; ' /;
|
||||||
|
|
||||||
@@ -1144,7 +1155,7 @@ data _null_;
|
|||||||
select;
|
select;
|
||||||
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
|
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
|
||||||
when (upcase(type) = "MACRO") fileshort2 = cats('%',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);
|
when (upcase(type) = "FORMAT") fileshort2 = cats('$',fileshort);
|
||||||
otherwise fileshort2 = fileshort;
|
otherwise fileshort2 = fileshort;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user