diff --git a/README.md b/README.md index d87168c..468f952 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Don't forget to give the repository a **STAR** and become [stargazer](https://gi ### Current version: -**The latest version** of the **SAS Packages Framework** is **`20260409`**. +**The latest version** of the **SAS Packages Framework** is **`20260411`**. --- diff --git a/SPF/Documentation/SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf b/SPF/Documentation/SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf index 27af5bf..4e64c2a 100644 Binary files a/SPF/Documentation/SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf and b/SPF/Documentation/SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf differ diff --git a/SPF/Macros/bundlePackages.sas b/SPF/Macros/bundlePackages.sas index cfda90e..22a02bd 100644 --- a/SPF/Macros/bundlePackages.sas +++ b/SPF/Macros/bundlePackages.sas @@ -8,7 +8,7 @@ ,packagesRef=packages ,ods= /* data set for report file */ )/ -des='Macro to create a bundle of SAS packages, version 20260409. Run %bundlePackages(HELP) for help info.' +des='Macro to create a bundle of SAS packages, version 20260411. Run %bundlePackages(HELP) for help info.' secure minoperator ; @@ -25,7 +25,7 @@ secure minoperator %put ### This is short help information for the `bundlePackages` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *create bundles* of SAS packages, version `20260409` #; + %put # Macro to *create bundles* of SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/extendpackagesfileref.sas b/SPF/Macros/extendpackagesfileref.sas index 3d6c842..e56a5be 100644 --- a/SPF/Macros/extendpackagesfileref.sas +++ b/SPF/Macros/extendpackagesfileref.sas @@ -6,7 +6,7 @@ when empty the "packages" value is used */ )/secure /*** HELP END ***/ -des = 'Macro to list directories pointed by "packages" fileref, version 20260409. Run %extendPackagesFileref(HELP) for help info.' +des = 'Macro to list directories pointed by "packages" fileref, version 20260411. Run %extendPackagesFileref(HELP) for help info.' ; %if %QUPCASE(&packages.) = HELP %then @@ -22,7 +22,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20260409 %put ### This is short help information for the `extendPackagesFileref` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to list directories pointed by 'packages' fileref, version `20260409` #; + %put # Macro to list directories pointed by 'packages' fileref, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/generatepackage.sas b/SPF/Macros/generatepackage.sas index 4f4a560..5b2d15b 100644 --- a/SPF/Macros/generatepackage.sas +++ b/SPF/Macros/generatepackage.sas @@ -3,7 +3,7 @@ Macro to generate SAS packages. - Version 20260409 + Version 20260411 A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -53,7 +53,7 @@ when empty takes buildLocation */ )/ secure minoperator /*** HELP END ***/ -des = 'Macro to generate SAS packages, version 20260409. Run %generatePackage() for help info.' +des = 'Macro to generate SAS packages, version 20260411. Run %generatePackage() for help info.' ; %if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then %do; @@ -68,7 +68,7 @@ des = 'Macro to generate SAS packages, version 20260409. Run %generatePackage() %put ### This is short help information for the `generatePackage` macro #; %put #------------------------------------------------------------------------------------#; %put # #; - %put # Macro to generate SAS packages, version `20260409` #; + %put # Macro to generate SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -950,7 +950,7 @@ title6 "MD5 hashed fileref of package lowcase name: &_PackageFileref_."; title&_titleNumber_. "Package ZIP file location is: &buildLocation."; %end; -footnote1 "SAS Packages Framework, version 20260409"; +footnote1 "SAS Packages Framework, version 20260411"; proc print data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent) @@ -1775,7 +1775,7 @@ data _null_; %end; put +(-1) '`.;''' / ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"' - / ' !! '' %put with the SAS Packages Framework version 20260409.;''' + / ' !! '' %put with the SAS Packages Framework version 20260411.;''' / ' !! '' %put ****************************************************************************;''' / ' !! '' %GOTO theEndOfTheMacro;''' / ' !! '' %end;''' ; @@ -1939,7 +1939,7 @@ data _null_; %end; put +(-1) '`.; '' !!' / ''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' / - ''' %put with the SAS Packages Framework version 20260409.; '' !! ' / + ''' %put with the SAS Packages Framework version 20260411.; '' !! ' / ''' %put ****************************************************************************; '' !! ' / ''' %GOTO theEndOfTheMacro; '' !! ' / ''' %end; '' !! ' / @@ -2811,7 +2811,7 @@ data _null_; %end; put 'put " " / @3 "---------------------------------------------------------------------" / " ";' - / 'put @3 "*SAS package generated by SAS Package Framework, version `20260409`*";' + / 'put @3 "*SAS package generated by SAS Package Framework, version `20260411`*";' / "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';" / "put @3 '*using SAS release: `&sysvlong4.`.*';" / 'put " " / @3 "---------------------------------------------------------------------";'; diff --git a/SPF/Macros/helppackage.sas b/SPF/Macros/helppackage.sas index b663f3f..c8d523e 100644 --- a/SPF/Macros/helppackage.sas +++ b/SPF/Macros/helppackage.sas @@ -28,7 +28,7 @@ */ )/secure /*** HELP END ***/ -des = 'Macro to get help about SAS package, version 20260409. Run %helpPackage() for help info.' +des = 'Macro to get help about SAS package, version 20260411. Run %helpPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -43,7 +43,7 @@ des = 'Macro to get help about SAS package, version 20260409. Run %helpPackage() %put ### This is short help information for the `helpPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to get help about SAS packages, version `20260409` #; + %put # Macro to get help about SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/installpackage.sas b/SPF/Macros/installpackage.sas index 17ee7f8..4446304 100644 --- a/SPF/Macros/installpackage.sas +++ b/SPF/Macros/installpackage.sas @@ -1,5 +1,5 @@ /*+installPackage+*/ -/* Macros to install SAS packages, version 20260409 */ +/* Macros to install SAS packages, version 20260411 */ /* A SAS package is a zip file containing a group of files with SAS code (macros, functions, data steps generating data, etc.) wrapped up together and %INCLUDEed by @@ -13,6 +13,7 @@ , mirror = 0 /* indicates which location for package source should be used */ , version = /* indicates which version of a package to install */ , replace = 1 /* 1 = replace if the package already exist, 0 = otherwise */ +, backup = 0 /* 1 = before replacing make a copy if the package already exist, 0 = do nothing */ , URLuser = /* user name for the password protected URLs */ , URLpass = /* password for the password protected URLs */ , URLoptions = /* options for the `sourcePath` URLs */ @@ -29,7 +30,7 @@ /secure minoperator /*** HELP END ***/ -des = 'Macro to install SAS package, version 20260409. Run %%installPackage() for help info.' +des = 'Macro to install SAS package, version 20260411. Run %%installPackage() for help info.' ; %if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then %do; @@ -44,7 +45,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put ### This is short help information for the `installPackage` macro #; %put #--------------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to install SAS packages, version `20260409` #; + %put # Macro to install SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -93,8 +94,15 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put # When there are multiple packages to install the `version` variable #; %put # is scan sequentially. #; %put # #; - %put # - `replace=` With default value of `1`, it causes existing package file 0 #; - %put # to be replaced by new downloaded file. #; + %put # - `replace=` When set to `1` and a package file exists, it forces the package #; + %put # file replacement by the new downloaded file. #; + %put # It is a binary indicator ('0' or '1'). Default value is `1`. #; + %put # #; + %put # - `backup=` When set to `1` and a package file exists, it creates a backup copy #; + %put # of the package file. The backup copy is created with a suffix of the #; + %put # following format: `_BCKP_yyyymmddJJMMSS`. #; + %put # If `replace=0` then `backup` is set to `0`. #; + %put # It is a binary indicator ('0' or '1'). Default value is `0`. #; %put # #; %put # - `URLuser=` A user name for the password protected URLs, no quotes needed. #; %put # #; @@ -221,9 +229,13 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt))); %let instDoc = %sysevalf(NOT(0=%superq(instDoc))); + %let backup = %sysevalf(NOT(0=%superq(backup))); %let replace = %sysevalf(1=%superq(replace)); + /* in case you do not replace then you also do not do a backup */ + %if 0=&replace. %then %let backup = 0; + %if %superq(sourcePath)= %then %do; %local SPFinitMirror SPFinitMirrorMD; @@ -342,13 +354,16 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put ### &packageName.(&vers.) ###; %put *** %sysfunc(lowcase(&packageName.)) start *****************************************; - %local in out inMD outMD _IOFileref_; + %local in out inMD outMD bckp_ref bckplabel _IOFileref_; data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run; %let in = i&_IOFileref_.; %let out = o&_IOFileref_.; %let inMD = j&_IOFileref_.; %let outMD = u&_IOFileref_.; + %let bckp_ref = b&_IOFileref_.; + %let bckplabel = _BCKP_%sysfunc(compress(%sysfunc(datetime(),b8601dt.),,KD)); + /* %let in = i%sysfunc(md5(&packageName.),hex7.); */ /* %let out = o%sysfunc(md5(&packageName.),hex7.); */ @@ -479,12 +494,34 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo do; if symgetn("replace")=1 then do; + rc = 0; put @2 "The following file will be replaced during " / @2 "installation of the &packageName. package: " / @5 out_path; - rc = FDELETE(out_ref); - rc = FCOPY(in_ref, out_ref); - rcTXT=sysmsg(); + + /* backup package file */ + if symgetn("backup")=1 then + do; + length bckp_ref $ 8 bckplabel $ 32; + bckplabel = "&bckplabel."; + rc = filename(bckp_ref, cats(out_path, bckplabel), "DISK", "recfm=N lrecl=1"); + put / @2 "The following backup file will be created:" + / @5 out_path +(-1) bckplabel; + rc + FCOPY(out_ref, bckp_ref); + rcTXT=sysmsg(); + if rc then put "WARNING: [&packageName.] Backup failed... "; + _N_ = filename(bckp_ref); + end; + + /* replace package file */ + if rc=0 then + do; + rc + FDELETE(out_ref); + if 0=rc then + rc + FCOPY(in_ref, out_ref); + rcTXT=sysmsg(); + if rc then put "WARNING: [&packageName.] Installation failed... "; + end; end; else do; @@ -512,6 +549,9 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo end; else if 1=FEXIST(out_refMD) and 1=symgetn("replace") then do; + if symgetn("backup")=1 then + put @2 "No backup done for documentation file."; + rcMD = FDELETE(out_refMD); if rcMD=0 then rcMD2 = FCOPY(in_refMD, out_refMD); @@ -550,9 +590,29 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %do; %put %str( )The following file will be replaced during; %put %str( )installation of the &packageName. package:; - %put %str( )%sysfunc(pathname(&out.)); - %let notRunHTTP = %sysfunc(FDELETE(&out.)); - %put %sysfunc(sysmsg()); + %put %str( )%sysfunc(pathname(&out.)); + + /* backup package file */ + %if 1=&backup. %then + %do; + filename &bckp_ref. "&firstPackagesPath./%sysfunc(lowcase(&packageName.)).zip&bckplabel." recfm=N lrecl=1; + + %put %str( )The following backup file will be created:; + %put %str( )%sysfunc(pathname(&bckp_ref.)); + + %let notRunHTTP = %sysfunc(FCOPY(&out., &bckp_ref.)); + %put %sysfunc(sysmsg()); + + filename &bckp_ref. clear; + + %let notRunHTTP = %sysevalf(¬RunHTTP. + %sysfunc(FDELETE(&out.))); + %put %sysfunc(sysmsg()); + %end; + %else + %do; + %let notRunHTTP = %sysfunc(FDELETE(&out.)); + %put %sysfunc(sysmsg()); + %end; %end; %else %do; @@ -621,6 +681,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %end; %else %if 1=&replace. %then %do; + %if 1=&backup. %then %put %str( )No backup done for documentation file.; %put %str( )Package documentation installation on demand:; %let notRunHTTP = %sysfunc(FDELETE(&outMD.)); %if ¬RunHTTP. %then %put %sysfunc(sysmsg()); diff --git a/SPF/Macros/ispackagesfilerefok.sas b/SPF/Macros/ispackagesfilerefok.sas index 4849c7b..ed7c530 100644 --- a/SPF/Macros/ispackagesfilerefok.sas +++ b/SPF/Macros/ispackagesfilerefok.sas @@ -4,7 +4,7 @@ vERRb /* indicates if macro should be verbose and report errors */ ) / minoperator PARMBUFF -des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260409.' +des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260411.' ; /*** HELP END ***/ %if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then @@ -20,7 +20,7 @@ des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFile %put ### This is short help information for the `isPackagesFilerefOK` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to check if the `packages` fileref is "correct", version `20260409` #; + %put # Macro to check if the `packages` fileref is "correct", version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/listpackages.sas b/SPF/Macros/listpackages.sas index 3b00f6b..acbc4b9 100644 --- a/SPF/Macros/listpackages.sas +++ b/SPF/Macros/listpackages.sas @@ -3,7 +3,7 @@ Macro to list SAS packages in packages folder. - Version 20260409 + Version 20260411 A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -25,7 +25,7 @@ listDataSet /* Name of a data set to save results */ , quiet = 0 /* Indicate if results should be printed in log */ )/secure parmbuff -des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260409.' +des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260411.' ; %if (%QUPCASE(&listDataSet.) = HELP) %then %do; @@ -40,7 +40,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE %put ### This is short help information for the `listPackages` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to list available SAS packages, version `20260409` #; + %put # Macro to list available SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/loadpackage.sas b/SPF/Macros/loadpackage.sas index 58bfade..3d56683 100644 --- a/SPF/Macros/loadpackage.sas +++ b/SPF/Macros/loadpackage.sas @@ -36,7 +36,7 @@ */ )/secure /*** HELP END ***/ -des = 'Macro to load SAS package, version 20260409. Run %loadPackage() for help info.' +des = 'Macro to load SAS package, version 20260411. Run %loadPackage() for help info.' minoperator ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then @@ -52,7 +52,7 @@ minoperator %put ### This is short help information for the `loadPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *load* SAS packages, version `20260409` #; + %put # Macro to *load* SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/loadpackageaddcnt.sas b/SPF/Macros/loadpackageaddcnt.sas index 9f32200..b6bb962 100644 --- a/SPF/Macros/loadpackageaddcnt.sas +++ b/SPF/Macros/loadpackageaddcnt.sas @@ -19,7 +19,7 @@ is provided in required version */ )/secure /*** HELP END ***/ -des = 'Macro to load additional content for a SAS package, version 20260409. Run %loadPackageAddCnt() for help info.' +des = 'Macro to load additional content for a SAS package, version 20260411. Run %loadPackageAddCnt() for help info.' minoperator ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then @@ -35,7 +35,7 @@ minoperator %put ### This is short help information for the `loadPackageAddCnt` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *load* additional content for a SAS package, version `20260409` #; + %put # Macro to *load* additional content for a SAS package, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/loadpackages.sas b/SPF/Macros/loadpackages.sas index 639b238..2a79115 100644 --- a/SPF/Macros/loadpackages.sas +++ b/SPF/Macros/loadpackages.sas @@ -11,7 +11,7 @@ */ )/secure /*** HELP END ***/ -des = 'Macro to load multiple SAS packages at one run, version 20260409. Run %loadPackages() for help info.' +des = 'Macro to load multiple SAS packages at one run, version 20260411. Run %loadPackages() for help info.' parmbuff ; %if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then @@ -27,7 +27,7 @@ parmbuff %put ### This is short help information for the `loadPackageS` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro wrapper for the loadPackage macro, version `20260409` #; + %put # Macro wrapper for the loadPackage macro, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/previewpackage.sas b/SPF/Macros/previewpackage.sas index 6073021..888cce9 100644 --- a/SPF/Macros/previewpackage.sas +++ b/SPF/Macros/previewpackage.sas @@ -23,7 +23,7 @@ */ )/secure /*** HELP END ***/ -des = 'Macro to preview content of a SAS package, version 20260409. Run %previewPackage() for help info.' +des = 'Macro to preview content of a SAS package, version 20260411. Run %previewPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -38,7 +38,7 @@ des = 'Macro to preview content of a SAS package, version 20260409. Run %preview %put ### This is short help information for the `previewPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to get preview of a SAS packages, version `20260409` #; + %put # Macro to get preview of a SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/relocatepackage.sas b/SPF/Macros/relocatepackage.sas index 3cdcde7..410d2ed 100644 --- a/SPF/Macros/relocatepackage.sas +++ b/SPF/Macros/relocatepackage.sas @@ -15,7 +15,7 @@ ,psMAX=MAX /* pageSise in case executed inside DoSubL() */ ,ods= /* a data set for results, e.g., work.relocatePackageReport */ ) -/ des = 'Utility macro that locally Copies or Moves Packages, version 20260409. Run %relocatePackage() for help info.' +/ des = 'Utility macro that locally Copies or Moves Packages, version 20260411. Run %relocatePackage() for help info.' secure minoperator ; @@ -33,7 +33,7 @@ %put ### This is short help information for the `relocatePackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *locally copy or move* (relocate) SAS packages, version `20260409` #; + %put # Macro to *locally copy or move* (relocate) SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/saspackagesframeworknotes.sas b/SPF/Macros/saspackagesframeworknotes.sas index f4349a3..25d08f6 100644 --- a/SPF/Macros/saspackagesframeworknotes.sas +++ b/SPF/Macros/saspackagesframeworknotes.sas @@ -5,7 +5,7 @@ SPFmacroName /* space separated list of names */ / minoperator secure -des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260409. Run %SasPackagesFrameworkNotes(HELP) for help info.' +des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260411. Run %SasPackagesFrameworkNotes(HELP) for help info.' ; %local list N i element; %let list= @@ -51,7 +51,7 @@ SasPackagesFrameworkNotes %put ### This is short help information for the `SasPackagesFrameworkNotes` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro prints help notes for SAS Packages Framework macros, version `20260409` #; + %put # Macro prints help notes for SAS Packages Framework macros, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/spfint_gnpckg_arch.sas b/SPF/Macros/spfint_gnpckg_arch.sas index 89bf18d..922035f 100644 --- a/SPF/Macros/spfint_gnpckg_arch.sas +++ b/SPF/Macros/spfint_gnpckg_arch.sas @@ -1,6 +1,6 @@ /*+SPFint_gnPckg_arch+*/ %macro SPFint_gnPckg_arch()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; diff --git a/SPF/Macros/spfint_gnpckg_markdown.sas b/SPF/Macros/spfint_gnpckg_markdown.sas index 43a6039..f5507d9 100644 --- a/SPF/Macros/spfint_gnpckg_markdown.sas +++ b/SPF/Macros/spfint_gnpckg_markdown.sas @@ -1,6 +1,6 @@ /*+SPFint_gnPckg_markdown+*/ %macro SPFint_gnPckg_markdown()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; @@ -112,7 +112,7 @@ data &filesWithCodes.markdown; %end; put " " / "---------------------------------------------------------------------" / " " - / "*SAS package generated by SAS Package Framework, version `20260409`,*" + / "*SAS package generated by SAS Package Framework, version `20260411`,*" / "*under `&sysscp.`(`&sysscpl.`) operating system,*" / "*using SAS release: `&sysvlong4.`.*" / " " / "---------------------------------------------------------------------" / " "; diff --git a/SPF/Macros/spfint_gnpckg_tests.sas b/SPF/Macros/spfint_gnpckg_tests.sas index 7fa27ad..e3e552e 100644 --- a/SPF/Macros/spfint_gnpckg_tests.sas +++ b/SPF/Macros/spfint_gnpckg_tests.sas @@ -1,6 +1,6 @@ /*+SPFint_gnPckg_tests+*/ %macro SPFint_gnPckg_tests()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; diff --git a/SPF/Macros/splitcodeforpackage.sas b/SPF/Macros/splitcodeforpackage.sas index dc9af2a..adff3fe 100644 --- a/SPF/Macros/splitcodeforpackage.sas +++ b/SPF/Macros/splitcodeforpackage.sas @@ -8,7 +8,7 @@ ,nobs=0 /* technical parameter */ ) /*** HELP END ***/ -/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260409. Run %splitCodeForPackage() for help info.' +/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260411. Run %splitCodeForPackage() for help info.' ; %if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then %do; @@ -24,7 +24,7 @@ %put #-------------------------------------------------------------------------------#; %put # #; %put # Utility macro to *split* single file with SAS package code into multiple #; - %put # files with separate snippets, version `20260409` #; + %put # files with separate snippets, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -400,7 +400,7 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ; */ if firstLine[j] then do; - put '/* File generated with help of SAS Packages Framework, version 20260409. */'; + put '/* File generated with help of SAS Packages Framework, version 20260411. */'; firstLine[j]=0; end; put _infile_; diff --git a/SPF/Macros/unbundlePackages.sas b/SPF/Macros/unbundlePackages.sas index d2afade..9c876ef 100644 --- a/SPF/Macros/unbundlePackages.sas +++ b/SPF/Macros/unbundlePackages.sas @@ -8,7 +8,7 @@ ,ods= /* data set for report file */ ,verify=0 )/ -des='Macro to extract a bundle of SAS packages, version 20260409. Run %unbundlePackages(HELP) for help info.' +des='Macro to extract a bundle of SAS packages, version 20260411. Run %unbundlePackages(HELP) for help info.' secure minoperator ; @@ -26,7 +26,7 @@ minoperator %put ### This is short help information for the `unbundlePackages` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *extract* SAS packages from a bundle, version `20260409` #; + %put # Macro to *extract* SAS packages from a bundle, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/unloadpackage.sas b/SPF/Macros/unloadpackage.sas index b5d52d4..d988b08 100644 --- a/SPF/Macros/unloadpackage.sas +++ b/SPF/Macros/unloadpackage.sas @@ -20,7 +20,7 @@ */ )/secure /*** HELP END ***/ -des = 'Macro to unload SAS package, version 20260409. Run %unloadPackage() for help info.' +des = 'Macro to unload SAS package, version 20260411. Run %unloadPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -35,7 +35,7 @@ des = 'Macro to unload SAS package, version 20260409. Run %unloadPackage() for h %put ### This is short help information for the `unloadPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to unload SAS packages, version `20260409` #; + %put # Macro to unload SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/Macros/verifypackage.sas b/SPF/Macros/verifypackage.sas index 438a22e..f392c6b 100644 --- a/SPF/Macros/verifypackage.sas +++ b/SPF/Macros/verifypackage.sas @@ -13,7 +13,7 @@ hashing_file() function, SAS 9.4M6 */ )/secure /*** HELP END ***/ -des = 'Macro to verify SAS package with the hash digest, version 20260409. Run %verifyPackage() for help info.' +des = 'Macro to verify SAS package with the hash digest, version 20260411. Run %verifyPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -28,7 +28,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260409. Run % %put ### This is short help information for the `verifyPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to verify SAS package with it hash digest, version `20260409` #; + %put # Macro to verify SAS package with it hash digest, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; diff --git a/SPF/SPFinit.md b/SPF/SPFinit.md index b5915e0..9f3c0c2 100644 --- a/SPF/SPFinit.md +++ b/SPF/SPFinit.md @@ -1,7 +1,7 @@ --- -# SAS Packages Framework, version `20260409` +# SAS Packages Framework, version `20260411` --- @@ -34,7 +34,7 @@ A **SAS package** is an automatically generated, single, stand alone *zip* file The *purpose of a package* is to be a simple, and easy to access, code sharing medium, which will allow: on the one hand, to separate the code complex dependencies created by the developer from the user experience with the final product and, on the other hand, reduce developer's and user's unnecessary frustration related to a remote deployment process. -In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20260409`**. +In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20260411`**. **To get started with SAS Packages** try this [**`Introduction to SAS Packages`**](https://youtube.com/playlist?list=PLeMzGEImIT5eV13IGXQIgWmTFCJt_cLZG&si=ElQm0_ifq76mvUbq "Introduction to SAS Packages video series") video series or [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory). @@ -57,7 +57,7 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack ## This is short help information for the `installPackage` macro -------------------------------------------------------------------------------------------- - Macro to install SAS packages, version `20260409` + Macro to install SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -105,8 +105,15 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack When there are multiple packages to install version variable is scan sequentially. - - `replace=` With default value of `1` it causes existing package file - to be replaced by new downloaded file. + - `replace=` When set to `1` and a package file exists, it forces the package + file replacement by the new downloaded file. + It is a binary indicator ('0' or '1'). Default value is `1`. + + - `backup=` When set to `1` and a package file exists, it creates a backup copy + of the package file. The backup copy is created with a suffix of the + following format: `_BCKP_yyyymmddJJMMSS`. + If `replace=0` then `backup` is set to `0`. + It is a binary indicator ('0' or '1'). Default value is `0`. - `URLuser=` A user name for the password protected URLs, no quotes needed. @@ -203,7 +210,7 @@ filename packages "C:/SAS_PACKAGES"; ## This is short help information for the `helpPackage` macro ------------------------------------------------------------------------------- - Macro to get help about SAS packages, version `20260409` + Macro to get help about SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -281,7 +288,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `loadPackage` macro ------------------------------------------------------------------------------- - Macro to *load* SAS packages, version `20260409` + Macro to *load* SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -439,7 +446,7 @@ If created, those macros are automatically deleted when the `%unloadPackage()` m ## This is short help information for the `loadPackageS` macro ------------------------------------------------------------------------------- - Macro wrapper for the loadPackage macro, version `20260409` + Macro wrapper for the loadPackage macro, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -490,7 +497,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `unloadPackage` macro ------------------------------------------------------------------------------- - Macro to unload SAS packages, version `20260409` + Macro to unload SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -557,7 +564,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `listPackages` macro ----------------------------------------------------------------------------------------- - Macro to list available SAS packages, version `20260409` + Macro to list available SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -606,7 +613,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `verifyPackage` macro ------------------------------------------------------------------------------- - Macro to verify SAS package with it hash digest, version `20260409` + Macro to verify SAS package with it hash digest, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -662,7 +669,7 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages; ## This is short help information for the `previewPackage` macro ------------------------------------------------------------------------------- - Macro to get preview of a SAS packages, version `20260409` + Macro to get preview of a SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -731,7 +738,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `generatePackage` macro ------------------------------------------------------------------------------- - Macro to generate SAS packages, version `20260409` + Macro to generate SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -964,7 +971,7 @@ All files have to have `.sas` extension. Other files are ignored. ## This is short help information for the `extendPackagesFileref` macro ----------------------------------------------------------------------------------------- - Macro to list directories pointed by 'packages' fileref, version `20260409` + Macro to list directories pointed by 'packages' fileref, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1006,7 +1013,7 @@ filename packages ("D:/NEW_DIR" %extendPackagesFileref()); %* add new directory; ## This is short help information for the `loadPackageAddCnt` macro ------------------------------------------------------------------------------- - Macro to load *additional content* for a SAS package, version `20260409` + Macro to load *additional content* for a SAS package, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1100,7 +1107,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ------------------------------------------------------------------------------- Utility macro to *split* single file with SAS package code into multiple - files with separate snippets, version `20260409` + files with separate snippets, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1181,7 +1188,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `relocatePackage` macro ------------------------------------------------------------------------------- - Macro to *locally copy or move* (relocate) SAS packages, version `20260409` + Macro to *locally copy or move* (relocate) SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1293,7 +1300,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `isPackagesFilerefOK` macro ----------------------------------------------------------------------------------------- - Macro to check if the `packages` fileref is "correct", version `20260409` + Macro to check if the `packages` fileref is "correct", version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1344,7 +1351,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `SasPackagesFrameworkNotes` macro ------------------------------------------------------------------------------- - Macro prints help notes for SAS Packages Framework macros, version `20260409` + Macro prints help notes for SAS Packages Framework macros, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1394,7 +1401,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `bundlePackages` macro ------------------------------------------------------------------------------- - Macro to *create bundles* of SAS packages, version `20260409` + Macro to *create bundles* of SAS packages, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1463,7 +1470,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages; ## This is short help information for the `unbundlePackages` macro ------------------------------------------------------------------------------- - Macro to *extract* SAS packages from a bundle, version `20260409` + Macro to *extract* SAS packages from a bundle, version `20260411` A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating diff --git a/SPF/SPFinit.sas b/SPF/SPFinit.sas index 35dce29..f920405 100644 --- a/SPF/SPFinit.sas +++ b/SPF/SPFinit.sas @@ -43,7 +43,7 @@ - to unload, or - to generate SAS packages. - Version 20260409. + Version 20260411. See examples below. A SAS package is a zip file containing a group of files @@ -101,7 +101,7 @@ Contributors: */ )/secure /*** HELP END ***/ -des = 'Macro to load SAS package, version 20260409. Run %loadPackage() for help info.' +des = 'Macro to load SAS package, version 20260411. Run %loadPackage() for help info.' minoperator ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then @@ -117,7 +117,7 @@ minoperator %put ### This is short help information for the `loadPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *load* SAS packages, version `20260409` #; + %put # Macro to *load* SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -398,7 +398,7 @@ minoperator */ )/secure /*** HELP END ***/ -des = 'Macro to unload SAS package, version 20260409. Run %unloadPackage() for help info.' +des = 'Macro to unload SAS package, version 20260411. Run %unloadPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -413,7 +413,7 @@ des = 'Macro to unload SAS package, version 20260409. Run %unloadPackage() for h %put ### This is short help information for the `unloadPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to unload SAS packages, version `20260409` #; + %put # Macro to unload SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -568,7 +568,7 @@ des = 'Macro to unload SAS package, version 20260409. Run %unloadPackage() for h */ )/secure /*** HELP END ***/ -des = 'Macro to get help about SAS package, version 20260409. Run %helpPackage() for help info.' +des = 'Macro to get help about SAS package, version 20260411. Run %helpPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -583,7 +583,7 @@ des = 'Macro to get help about SAS package, version 20260409. Run %helpPackage() %put ### This is short help information for the `helpPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to get help about SAS packages, version `20260409` #; + %put # Macro to get help about SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -728,7 +728,7 @@ TODO: */ /*+installPackage+*/ -/* Macros to install SAS packages, version 20260409 */ +/* Macros to install SAS packages, version 20260411 */ /* A SAS package is a zip file containing a group of files with SAS code (macros, functions, data steps generating data, etc.) wrapped up together and %INCLUDEed by @@ -742,6 +742,7 @@ TODO: , mirror = 0 /* indicates which location for package source should be used */ , version = /* indicates which version of a package to install */ , replace = 1 /* 1 = replace if the package already exist, 0 = otherwise */ +, backup = 0 /* 1 = before replacing make a copy if the package already exist, 0 = do nothing */ , URLuser = /* user name for the password protected URLs */ , URLpass = /* password for the password protected URLs */ , URLoptions = /* options for the `sourcePath` URLs */ @@ -758,7 +759,7 @@ TODO: /secure minoperator /*** HELP END ***/ -des = 'Macro to install SAS package, version 20260409. Run %%installPackage() for help info.' +des = 'Macro to install SAS package, version 20260411. Run %%installPackage() for help info.' ; %if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then %do; @@ -773,7 +774,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put ### This is short help information for the `installPackage` macro #; %put #--------------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to install SAS packages, version `20260409` #; + %put # Macro to install SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -822,8 +823,15 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put # When there are multiple packages to install the `version` variable #; %put # is scan sequentially. #; %put # #; - %put # - `replace=` With default value of `1`, it causes existing package file 0 #; - %put # to be replaced by new downloaded file. #; + %put # - `replace=` When set to `1` and a package file exists, it forces the package #; + %put # file replacement by the new downloaded file. #; + %put # It is a binary indicator ('0' or '1'). Default value is `1`. #; + %put # #; + %put # - `backup=` When set to `1` and a package file exists, it creates a backup copy #; + %put # of the package file. The backup copy is created with a suffix of the #; + %put # following format: `_BCKP_yyyymmddJJMMSS`. #; + %put # If `replace=0` then `backup` is set to `0`. #; + %put # It is a binary indicator ('0' or '1'). Default value is `0`. #; %put # #; %put # - `URLuser=` A user name for the password protected URLs, no quotes needed. #; %put # #; @@ -950,9 +958,13 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt))); %let instDoc = %sysevalf(NOT(0=%superq(instDoc))); + %let backup = %sysevalf(NOT(0=%superq(backup))); %let replace = %sysevalf(1=%superq(replace)); + /* in case you do not replace then you also do not do a backup */ + %if 0=&replace. %then %let backup = 0; + %if %superq(sourcePath)= %then %do; %local SPFinitMirror SPFinitMirrorMD; @@ -1071,13 +1083,16 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %put ### &packageName.(&vers.) ###; %put *** %sysfunc(lowcase(&packageName.)) start *****************************************; - %local in out inMD outMD _IOFileref_; + %local in out inMD outMD bckp_ref bckplabel _IOFileref_; data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run; %let in = i&_IOFileref_.; %let out = o&_IOFileref_.; %let inMD = j&_IOFileref_.; %let outMD = u&_IOFileref_.; + %let bckp_ref = b&_IOFileref_.; + %let bckplabel = _BCKP_%sysfunc(compress(%sysfunc(datetime(),b8601dt.),,KD)); + /* %let in = i%sysfunc(md5(&packageName.),hex7.); */ /* %let out = o%sysfunc(md5(&packageName.),hex7.); */ @@ -1208,12 +1223,34 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo do; if symgetn("replace")=1 then do; + rc = 0; put @2 "The following file will be replaced during " / @2 "installation of the &packageName. package: " / @5 out_path; - rc = FDELETE(out_ref); - rc = FCOPY(in_ref, out_ref); - rcTXT=sysmsg(); + + /* backup package file */ + if symgetn("backup")=1 then + do; + length bckp_ref $ 8 bckplabel $ 32; + bckplabel = "&bckplabel."; + rc = filename(bckp_ref, cats(out_path, bckplabel), "DISK", "recfm=N lrecl=1"); + put / @2 "The following backup file will be created:" + / @5 out_path +(-1) bckplabel; + rc + FCOPY(out_ref, bckp_ref); + rcTXT=sysmsg(); + if rc then put "WARNING: [&packageName.] Backup failed... "; + _N_ = filename(bckp_ref); + end; + + /* replace package file */ + if rc=0 then + do; + rc + FDELETE(out_ref); + if 0=rc then + rc + FCOPY(in_ref, out_ref); + rcTXT=sysmsg(); + if rc then put "WARNING: [&packageName.] Installation failed... "; + end; end; else do; @@ -1241,6 +1278,9 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo end; else if 1=FEXIST(out_refMD) and 1=symgetn("replace") then do; + if symgetn("backup")=1 then + put @2 "No backup done for documentation file."; + rcMD = FDELETE(out_refMD); if rcMD=0 then rcMD2 = FCOPY(in_refMD, out_refMD); @@ -1279,9 +1319,29 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %do; %put %str( )The following file will be replaced during; %put %str( )installation of the &packageName. package:; - %put %str( )%sysfunc(pathname(&out.)); - %let notRunHTTP = %sysfunc(FDELETE(&out.)); - %put %sysfunc(sysmsg()); + %put %str( )%sysfunc(pathname(&out.)); + + /* backup package file */ + %if 1=&backup. %then + %do; + filename &bckp_ref. "&firstPackagesPath./%sysfunc(lowcase(&packageName.)).zip&bckplabel." recfm=N lrecl=1; + + %put %str( )The following backup file will be created:; + %put %str( )%sysfunc(pathname(&bckp_ref.)); + + %let notRunHTTP = %sysfunc(FCOPY(&out., &bckp_ref.)); + %put %sysfunc(sysmsg()); + + filename &bckp_ref. clear; + + %let notRunHTTP = %sysevalf(¬RunHTTP. + %sysfunc(FDELETE(&out.))); + %put %sysfunc(sysmsg()); + %end; + %else + %do; + %let notRunHTTP = %sysfunc(FDELETE(&out.)); + %put %sysfunc(sysmsg()); + %end; %end; %else %do; @@ -1350,6 +1410,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo %end; %else %if 1=&replace. %then %do; + %if 1=&backup. %then %put %str( )No backup done for documentation file.; %put %str( )Package documentation installation on demand:; %let notRunHTTP = %sysfunc(FDELETE(&outMD.)); %if ¬RunHTTP. %then %put %sysfunc(sysmsg()); @@ -1583,7 +1644,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo Macro to list SAS packages in packages folder. - Version 20260409 + Version 20260411 A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1605,7 +1666,7 @@ des = 'Macro to install SAS package, version 20260409. Run %%installPackage() fo listDataSet /* Name of a data set to save results */ , quiet = 0 /* Indicate if results should be printed in log */ )/secure parmbuff -des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260409.' +des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260411.' ; %if (%QUPCASE(&listDataSet.) = HELP) %then %do; @@ -1620,7 +1681,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE %put ### This is short help information for the `listPackages` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to list available SAS packages, version `20260409` #; + %put # Macro to list available SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -1846,7 +1907,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.; Macro to generate SAS packages. - Version 20260409 + Version 20260411 A SAS package is a zip file containing a group of SAS codes (macros, functions, data steps generating @@ -1896,7 +1957,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.; when empty takes buildLocation */ )/ secure minoperator /*** HELP END ***/ -des = 'Macro to generate SAS packages, version 20260409. Run %generatePackage() for help info.' +des = 'Macro to generate SAS packages, version 20260411. Run %generatePackage() for help info.' ; %if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then %do; @@ -1911,7 +1972,7 @@ des = 'Macro to generate SAS packages, version 20260409. Run %generatePackage() %put ### This is short help information for the `generatePackage` macro #; %put #------------------------------------------------------------------------------------#; %put # #; - %put # Macro to generate SAS packages, version `20260409` #; + %put # Macro to generate SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -2793,7 +2854,7 @@ title6 "MD5 hashed fileref of package lowcase name: &_PackageFileref_."; title&_titleNumber_. "Package ZIP file location is: &buildLocation."; %end; -footnote1 "SAS Packages Framework, version 20260409"; +footnote1 "SAS Packages Framework, version 20260411"; proc print data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent) @@ -3618,7 +3679,7 @@ data _null_; %end; put +(-1) '`.;''' / ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"' - / ' !! '' %put with the SAS Packages Framework version 20260409.;''' + / ' !! '' %put with the SAS Packages Framework version 20260411.;''' / ' !! '' %put ****************************************************************************;''' / ' !! '' %GOTO theEndOfTheMacro;''' / ' !! '' %end;''' ; @@ -3782,7 +3843,7 @@ data _null_; %end; put +(-1) '`.; '' !!' / ''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' / - ''' %put with the SAS Packages Framework version 20260409.; '' !! ' / + ''' %put with the SAS Packages Framework version 20260411.; '' !! ' / ''' %put ****************************************************************************; '' !! ' / ''' %GOTO theEndOfTheMacro; '' !! ' / ''' %end; '' !! ' / @@ -4654,7 +4715,7 @@ data _null_; %end; put 'put " " / @3 "---------------------------------------------------------------------" / " ";' - / 'put @3 "*SAS package generated by SAS Package Framework, version `20260409`*";' + / 'put @3 "*SAS package generated by SAS Package Framework, version `20260411`*";' / "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';" / "put @3 '*using SAS release: `&sysvlong4.`.*';" / 'put " " / @3 "---------------------------------------------------------------------";'; @@ -5093,7 +5154,7 @@ options &qlenmax_fstimer_tmp.; /*+SPFint_gnPckg_tests+*/ %macro SPFint_gnPckg_tests()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; @@ -5775,7 +5836,7 @@ options "elenmax_tmp.; /*+SPFint_gnPckg_markdown+*/ %macro SPFint_gnPckg_markdown()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; @@ -5887,7 +5948,7 @@ data &filesWithCodes.markdown; %end; put " " / "---------------------------------------------------------------------" / " " - / "*SAS package generated by SAS Package Framework, version `20260409`,*" + / "*SAS package generated by SAS Package Framework, version `20260411`,*" / "*under `&sysscp.`(`&sysscpl.`) operating system,*" / "*using SAS release: `&sysvlong4.`.*" / " " / "---------------------------------------------------------------------" / " "; @@ -6028,7 +6089,7 @@ options &MarkDownOptionsTmp.; /*+SPFint_gnPckg_arch+*/ %macro SPFint_gnPckg_arch()/secure minoperator -des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260409.'; +des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260411.'; /* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */ %if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then %do; @@ -6195,7 +6256,7 @@ TODO: (in Polish) */ )/secure /*** HELP END ***/ -des = 'Macro to load multiple SAS packages at one run, version 20260409. Run %loadPackages() for help info.' +des = 'Macro to load multiple SAS packages at one run, version 20260411. Run %loadPackages() for help info.' parmbuff ; %if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then @@ -6211,7 +6272,7 @@ parmbuff %put ### This is short help information for the `loadPackageS` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro wrapper for the loadPackage macro, version `20260409` #; + %put # Macro wrapper for the loadPackage macro, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -6309,7 +6370,7 @@ parmbuff hashing_file() function, SAS 9.4M6 */ )/secure /*** HELP END ***/ -des = 'Macro to verify SAS package with the hash digest, version 20260409. Run %verifyPackage() for help info.' +des = 'Macro to verify SAS package with the hash digest, version 20260411. Run %verifyPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -6324,7 +6385,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260409. Run % %put ### This is short help information for the `verifyPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to verify SAS package with it hash digest, version `20260409` #; + %put # Macro to verify SAS package with it hash digest, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -6540,7 +6601,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260409. Run % */ )/secure /*** HELP END ***/ -des = 'Macro to preview content of a SAS package, version 20260409. Run %previewPackage() for help info.' +des = 'Macro to preview content of a SAS package, version 20260411. Run %previewPackage() for help info.' ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then %do; @@ -6555,7 +6616,7 @@ des = 'Macro to preview content of a SAS package, version 20260409. Run %preview %put ### This is short help information for the `previewPackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to get preview of a SAS packages, version `20260409` #; + %put # Macro to get preview of a SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -6689,7 +6750,7 @@ des = 'Macro to preview content of a SAS package, version 20260409. Run %preview when empty the "packages" value is used */ )/secure /*** HELP END ***/ -des = 'Macro to list directories pointed by "packages" fileref, version 20260409. Run %extendPackagesFileref(HELP) for help info.' +des = 'Macro to list directories pointed by "packages" fileref, version 20260411. Run %extendPackagesFileref(HELP) for help info.' ; %if %QUPCASE(&packages.) = HELP %then @@ -6705,7 +6766,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20260409 %put ### This is short help information for the `extendPackagesFileref` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to list directories pointed by 'packages' fileref, version `20260409` #; + %put # Macro to list directories pointed by 'packages' fileref, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -6807,7 +6868,7 @@ filename packages list; is provided in required version */ )/secure /*** HELP END ***/ -des = 'Macro to load additional content for a SAS package, version 20260409. Run %loadPackageAddCnt() for help info.' +des = 'Macro to load additional content for a SAS package, version 20260411. Run %loadPackageAddCnt() for help info.' minoperator ; %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then @@ -6823,7 +6884,7 @@ minoperator %put ### This is short help information for the `loadPackageAddCnt` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *load* additional content for a SAS package, version `20260409` #; + %put # Macro to *load* additional content for a SAS package, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -7194,7 +7255,7 @@ minoperator ,nobs=0 /* technical parameter */ ) /*** HELP END ***/ -/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260409. Run %splitCodeForPackage() for help info.' +/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260411. Run %splitCodeForPackage() for help info.' ; %if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then %do; @@ -7210,7 +7271,7 @@ minoperator %put #-------------------------------------------------------------------------------#; %put # #; %put # Utility macro to *split* single file with SAS package code into multiple #; - %put # files with separate snippets, version `20260409` #; + %put # files with separate snippets, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -7586,7 +7647,7 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ; */ if firstLine[j] then do; - put '/* File generated with help of SAS Packages Framework, version 20260409. */'; + put '/* File generated with help of SAS Packages Framework, version 20260411. */'; firstLine[j]=0; end; put _infile_; @@ -7619,7 +7680,7 @@ options &options_tmp2.; ,psMAX=MAX /* pageSise in case executed inside DoSubL() */ ,ods= /* a data set for results, e.g., work.relocatePackageReport */ ) -/ des = 'Utility macro that locally Copies or Moves Packages, version 20260409. Run %relocatePackage() for help info.' +/ des = 'Utility macro that locally Copies or Moves Packages, version 20260411. Run %relocatePackage() for help info.' secure minoperator ; @@ -7637,7 +7698,7 @@ options &options_tmp2.; %put ### This is short help information for the `relocatePackage` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *locally copy or move* (relocate) SAS packages, version `20260409` #; + %put # Macro to *locally copy or move* (relocate) SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -8295,7 +8356,7 @@ filename PACKAGES ("R:\testPackages2" "R:\testPackages1"); vERRb /* indicates if macro should be verbose and report errors */ ) / minoperator PARMBUFF -des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260409.' +des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260411.' ; /*** HELP END ***/ %if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then @@ -8311,7 +8372,7 @@ des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFile %put ### This is short help information for the `isPackagesFilerefOK` macro #; %put #-----------------------------------------------------------------------------------------#;; %put # #; - %put # Macro to check if the `packages` fileref is "correct", version `20260409` #; + %put # Macro to check if the `packages` fileref is "correct", version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -8445,7 +8506,7 @@ SPFmacroName /* space separated list of names */ / minoperator secure -des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260409. Run %SasPackagesFrameworkNotes(HELP) for help info.' +des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260411. Run %SasPackagesFrameworkNotes(HELP) for help info.' ; %local list N i element; %let list= @@ -8491,7 +8552,7 @@ SasPackagesFrameworkNotes %put ### This is short help information for the `SasPackagesFrameworkNotes` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro prints help notes for SAS Packages Framework macros, version `20260409` #; + %put # Macro prints help notes for SAS Packages Framework macros, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -8614,7 +8675,7 @@ options mlogic symbolgen; ,packagesRef=packages ,ods= /* data set for report file */ )/ -des='Macro to create a bundle of SAS packages, version 20260409. Run %bundlePackages(HELP) for help info.' +des='Macro to create a bundle of SAS packages, version 20260411. Run %bundlePackages(HELP) for help info.' secure minoperator ; @@ -8631,7 +8692,7 @@ secure minoperator %put ### This is short help information for the `bundlePackages` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *create bundles* of SAS packages, version `20260409` #; + %put # Macro to *create bundles* of SAS packages, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #; @@ -9116,7 +9177,7 @@ filename p2 "R:/dontexist"; ,ods= /* data set for report file */ ,verify=0 )/ -des='Macro to extract a bundle of SAS packages, version 20260409. Run %unbundlePackages(HELP) for help info.' +des='Macro to extract a bundle of SAS packages, version 20260411. Run %unbundlePackages(HELP) for help info.' secure minoperator ; @@ -9134,7 +9195,7 @@ minoperator %put ### This is short help information for the `unbundlePackages` macro #; %put #-------------------------------------------------------------------------------#; %put # #; - %put # Macro to *extract* SAS packages from a bundle, version `20260409` #; + %put # Macro to *extract* SAS packages from a bundle, version `20260411` #; %put # #; %put # A SAS package is a zip file containing a group #; %put # of SAS codes (macros, functions, data steps generating #;