SAS Packages Framework, version 20260710

SAS Packages Framework, version `20260710`

Changes:

- Code cleanup
This commit is contained in:
Bart Jablonski
2026-07-10 11:05:38 +02:00
parent 3ca1cae526
commit 8102ab5513
25 changed files with 358 additions and 358 deletions
+80 -80
View File
@@ -32,8 +32,8 @@
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**#############################################################################**/
*/
/**############################################################################**/
/*** HELP START ***/
/* SPF (SAS Packages Framework) is a set of macros:
@@ -43,7 +43,7 @@
- to unload, or
- to generate SAS packages.
SAS Packages Framework, version 20260617.
SAS Packages Framework, version 20260710.
See examples below.
A SAS package is a zip file containing a group of files
@@ -67,7 +67,7 @@ Contributors:
Macro to generate SAS packages.
Version 20260617
Version 20260710
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -95,7 +95,7 @@ Contributors:
if null (the default) the WORK is used */
,workInTestResults=0 /* indicates if WORK directories for tests should be located
in the same place as results */
,testWorkPath= /* location where tests SAS sessions' work directories
,testWorkPath= /* location where tests SAS session work directories
should be stored, if null (the default) the main SAS
session WORK is used. Takes precedence over workInTestResults= */
,sasexe= /* a DIRECTORY where the SAS binary is located,
@@ -117,7 +117,7 @@ Contributors:
when empty takes buildLocation */
)/ secure minoperator
/*** HELP END ***/
des = 'Macro to generate SAS packages, version 20260617. Run %generatePackage(HELP) for help info.'
des = 'Macro to generate SAS packages, version 20260710. Run %generatePackage(HELP) for help info.'
;
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
%do;
@@ -132,7 +132,7 @@ des = 'Macro to generate SAS packages, version 20260617. Run %generatePackage(HE
%put ### This is short help information for the `generatePackage` macro #;
%put #------------------------------------------------------------------------------------#;
%put # #;
%put # Macro to generate SAS packages, version `20260617` #;
%put # Macro to generate SAS packages, version `20260710` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -189,8 +189,8 @@ des = 'Macro to generate SAS packages, version 20260617. Run %generatePackage(HE
%put # if null (the default) then the `!SASROOT` is used. #;
%put # #;
%put # - `sascfgFile=` Location of a FILE with testing session configuration #;
%put # parameters, if null (the default) then no config file #;
%put # is pointed during the SAS invocation, #;
%put # parameters, if null (the default) then no configuration #;
%put # file is pointed during the SAS invocation, #;
%put # if set to `DEF` then the `!SASROOT/sasv9.cfg` is used. #;
%put # #;
%put # - `delTestWork=` Indicates if `WORK` directories generated by user tests #;
@@ -512,7 +512,8 @@ data _null_;
/* test if version is a number */
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
v = "&packageVersion.";
length v $ 64;
v = symget("packageVersion");
version = coalesce(input(scan(v,1,".","M"), ?? best32.),0)*1e8
+ coalesce(input(scan(v,2,".","M"), ?? best32.),0)*1e4
+ coalesce(input(scan(v,3,".","M"), ?? best32.),0)*1e0
@@ -520,7 +521,7 @@ data _null_;
if not (version > 0) then
do;
put 'ERROR: Package version should be a positive NUMBER.'
/ 'ERROR- Current value is: ' "&packageVersion."
/ 'ERROR- Current value is: ' v
/ 'ERROR- Try something small, e.g. 0.1'
/ 'ERROR- Aborting.';
put;
@@ -1014,7 +1015,7 @@ title6 "MD5 hashed fileref of package lowcase name: &_PackageFileref_.";
title&_titleNumber_. "Package ZIP file location is: &buildLocation.";
%end;
footnote1 "SAS Packages Framework, version 20260617";
footnote1 "SAS Packages Framework, version 20260710";
proc print
data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent)
@@ -1195,7 +1196,7 @@ data _null_;
/ ' %let pV = %sysevalf((%scan(&pV0.,1,.,M)+0)*1e8 '
/ ' + (%scan(&pV0.,2,.,M)+0)*1e4 '
/ ' + (%scan(&pV0.,3,.,M)+0)*1e0); '
/ ' '
/ ' %let rV0 = %sysfunc(compress(&requiredVersion.,.,kd)); '
/ ' %let rVsign = %sysfunc(compress(&requiredVersion.,<=>,k)); '
/ ' %if %superq(rVsign)= %then %let rVsign=<=; '
@@ -1208,7 +1209,7 @@ data _null_;
/ ' %let rV = %sysevalf((%scan(&rV0.,1,.,M)+0)*1e8 '
/ ' + (%scan(&rV0.,2,.,M)+0)*1e4 '
/ ' + (%scan(&rV0.,3,.,M)+0)*1e0); '
/ ' '
/ ' %if NOT %sysevalf(&rV. &rVsign. &pV.) %then '
/ ' %do; '
/ ' %put ERROR: Package &packageName. will not be loaded!; '
@@ -1228,8 +1229,8 @@ data _null_;
/ ' %local cherryPick; %let cherryPick=*; '
/ ' %local tempLoad_minoperator; '
/ ' %let tempLoad_minoperator = %sysfunc(getoption(minoperator)); '
/ " "
/ ' %if %superq(suppressExec) NE 1 %then %let suppressExec = 0; '
/ ' %if %sysevalf(%superq(suppressExec) NE 1,boolean) %then %let suppressExec = 0; '
/ ' %include &_PackageFileref_.(load.sas) / &source2.; '
/ ' options &tempLoad_minoperator.; '
/ ' filename &_PackageFileref_. clear; '
@@ -1287,72 +1288,71 @@ data _null_;
or (%superq(packageReqPackages) ne )
%then
%do;
put ' data _null_; '
/ ' call symputX("packageRequiredErrors", 0, "L"); '
/ ' run; ';
put ' data _null_; '
/ ' call symputX("packageRequiredErrors", 0, "L"); '
/ ' run; ';
%end;
%if %superq(packageRequired) ne %then
%if %sysevalf(%superq(packageRequired) ne,boolean) %then
%do;
put ' %put NOTE- *Testing required SAS components*%sysfunc(DoSubL(' /* <- DoSubL() is here */
/ ' options nonotes nosource %str(;) '
/ ' options ls=max ps=max locale=en_US %str(;) '
/ ' /* temporary redirect log */ '
/ ' filename _stinit_ TEMP %str(;) '
/ ' proc printto log = _stinit_ %str(;) run %str(;) '
/ ' /* print out setinit */ '
/ ' proc setinit %str(;) run %str(;) '
/ ' proc printto %str(;) run %str(;) '
/ ' options ps=min %str(;) '
/ ' data _null_ %str(;) '
/ ' /* loadup checklist of required SAS components */ '
/ ' if _n_ = 1 then '
/ ' do %str(;) '
/ ' length req $ 256 %str(;) '
/ ' declare hash R() %str(;) '
/ ' _N_ = R.defineKey("req") %str(;) '
/ ' _N_ = R.defineDone() %str(;) '
/ ' declare hiter iR("R") %str(;) ';
put ' %put NOTE- *Testing required SAS components*%sysfunc(DoSubL(%str(' /* <- DoSubL() is here */
/ ' options nonotes nosource ; '
/ ' options ls=max ps=max locale=en_US ; '
/ ' /* temporary redirect log */ '
/ ' filename _stinit_ TEMP ; '
/ ' proc printto log = _stinit_ ; run ; '
/ ' /* print out setinit */ '
/ ' proc setinit ; run ; '
/ ' proc printto ; run ; '
/ ' options ps=min ; '
/ ' data _null_ ; '
/ ' /* loadup checklist of required SAS components */ '
/ ' if _n_ = 1 then '
/ ' do ; '
/ ' length req $ 256 ; '
/ ' declare hash R() ; '
/ ' _N_ = R.defineKey("req") ; '
/ ' _N_ = R.defineDone() ; '
/ ' declare hiter iR("R") ; ';
length packageRequired $ 32767;
packageRequired = upcase(symget('packageRequired'));
put ' do req = %bquote(' / packageRequired / ') %str(;) '
/ ' _N_ = R.add(key:req,data:req) %str(;) '
/ ' end %str(;) '
/ ' end %str(;) '
/ ' '
/ ' /* read in output from proc setinit */ '
/ ' infile _stinit_ end=eof %str(;) '
/ ' input %str(;) '
/* / ' put "*> " _infile_ %str(;) ' */ /* for testing */
/ ' '
put ' do req = %bquote(' / packageRequired / ') ; '
/ ' _N_ = R.add(key:req,data:req) ; '
/ ' end ; '
/ ' end ; '
/ ' '
/ ' /* read in output from proc setinit */ '
/ ' infile _stinit_ end=eof ; '
/ ' input ; '
/* / ' put "*> " _infile_ ; ' */ /* for testing */
/ ' '
/ ' /* if component is in setinit remove it from checklist */ '
/ ' if _infile_ =: "---" then '
/ ' do %str(;) '
/ ' req = upcase(substr(_infile_, 4, 64)) %str(;) '
/ ' if R.find(key:req) = 0 then '
/ ' do %str(;) '
/ ' _N_ = R.remove() %str(;) '
/ ' end %str(;) '
/ ' end %str(;) '
/ ' '
/ ' /* if checklist is not null rise error */ '
/ ' if eof and R.num_items > 0 then '
/ ' do %str(;) '
/ ' put "WARNING- ###########################################" %str(;) '
/ ' put "WARNING: The following SAS components are missing! " %str(;) '
/ ' call symputX("packageRequiredErrors", 0, "L") %str(;) '
/ ' do while(iR.next() = 0) %str(;) '
/ ' put "WARNING- " req %str(;) '
/ ' end %str(;) '
/ ' put "WARNING: The package may NOT WORK as expected " %str(;) '
/ ' put "WARNING: or even result with ERRORS! " %str(;) '
/ ' put "WARNING- ###########################################" %str(;) '
/ ' put %str(;) '
/ ' end %str(;) '
/ ' run %str(;) '
/ ' filename _stinit_ clear %str(;) '
/ ' options notes source %str(;) '
/ ' ))*; ';
/ ' if _infile_ =: "---" then '
/ ' do ; '
/ ' req = upcase(substr(_infile_, 4, 64)) ; '
/ ' if R.find(key:req) = 0 then '
/ ' do ; '
/ ' _N_ = R.remove() ; '
/ ' end ; '
/ ' end ; '
/ ' '
/ ' /* if checklist is not null rise error */ '
/ ' if eof and R.num_items > 0 then '
/ ' do ; '
/ ' put "WARNING- ###########################################" ; '
/ ' put "WARNING: The following SAS components are missing! " ; '
/ ' call symputX("packageRequiredErrors", 0, "L") ; '
/ ' do while(iR.next() = 0) ; '
/ ' put "WARNING- " req ; '
/ ' end ; '
/ ' put "WARNING: The package may NOT WORK as expected " ; '
/ ' put "WARNING: or even result with ERRORS! " ; '
/ ' put "WARNING- ###########################################" ; '
/ ' put ; '
/ ' end ; '
/ ' run ; '
/ ' filename _stinit_ clear ; '
/ ' options notes source ; '
/ ' )))*; ';
%end;
%if %superq(packageReqPackages) ne %then
@@ -1839,7 +1839,7 @@ data _null_;
%end;
put +(-1) '`.;'''
/ ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"'
/ ' !! '' %put with the SAS Packages Framework version 20260617.;'''
/ ' !! '' %put with the SAS Packages Framework version 20260710.;'''
/ ' !! '' %put ****************************************************************************;'''
/ ' !! '' %GOTO theEndOfTheMacro;'''
/ ' !! '' %end;''' ;
@@ -2003,7 +2003,7 @@ data _null_;
%end;
put +(-1) '`.; '' !!' /
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' /
''' %put with the SAS Packages Framework version 20260617.; '' !! ' /
''' %put with the SAS Packages Framework version 20260710.; '' !! ' /
''' %put ****************************************************************************; '' !! ' /
''' %GOTO theEndOfTheMacro; '' !! ' /
''' %end; '' !! ' /
@@ -2875,7 +2875,7 @@ data _null_;
%end;
put 'put " " / @3 "---------------------------------------------------------------------" / " ";'
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260617`*";'
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260710`*";'
/ "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';"
/ "put @3 '*using SAS release: `&sysvlong4.`.*';"
/ 'put " " / @3 "---------------------------------------------------------------------";';