SAS Packages Framework, version 20220925

**SAS Packages Framework**, version `20220925`

New parameter `mirror=` added to the `%installPackage()` macro.
The `mirror` indicates which web location for packages installation is used.
Value `1` indicates: `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main`
Value `2` indicates: `https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES`
Default value is `1`.
This commit is contained in:
Bart Jablonski (yabwon)
2022-09-25 19:11:55 +02:00
parent 17b1239087
commit be89c6b9c6
5 changed files with 74 additions and 40 deletions

View File

@@ -42,7 +42,7 @@
- to unload, or
- to generate SAS packages.
Version 20220830.
Version 20220925.
See examples below.
A SAS package is a zip file containing a group of files
@@ -81,7 +81,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to load SAS package, version 20220830. Run %loadPackage() for help info.'
des = 'Macro to load SAS package, version 20220925. Run %loadPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -96,7 +96,7 @@ des = 'Macro to load SAS package, version 20220830. Run %loadPackage() for help
%put ### This is short help information for the `loadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to *load* SAS packages, version `20220830` #;
%put # Macro to *load* SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -271,7 +271,7 @@ des = 'Macro to load SAS package, version 20220830. Run %loadPackage() for help
*/
)/secure
/*** HELP END ***/
des = 'Macro to unload SAS package, version 20220830. Run %unloadPackage() for help info.'
des = 'Macro to unload SAS package, version 20220925. Run %unloadPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -286,7 +286,7 @@ des = 'Macro to unload SAS package, version 20220830. Run %unloadPackage() for h
%put ### This is short help information for the `unloadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to unload SAS packages, version `20220830` #;
%put # Macro to unload SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -430,7 +430,7 @@ des = 'Macro to unload SAS package, version 20220830. Run %unloadPackage() for h
*/
)/secure
/*** HELP END ***/
des = 'Macro to get help about SAS package, version 20220830. Run %helpPackage() for help info.'
des = 'Macro to get help about SAS package, version 20220925. Run %helpPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -445,7 +445,7 @@ des = 'Macro to get help about SAS package, version 20220830. Run %helpPackage()
%put ### This is short help information for the `helpPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to get help about SAS packages, version `20220830` #;
%put # Macro to get help about SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -575,7 +575,7 @@ TODO:
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
*/
/* Macros to install SAS packages, version 20220830 */
/* Macros to install SAS packages, version 20220925 */
/* 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
@@ -586,6 +586,7 @@ TODO:
%macro installPackage(
packagesNames /* space separated list of packages names, without the zip extension */
, sourcePath = /* location of the package, e.g. "www.some.page/", mind the "/" at the end */
, mirror = 1 /* indicates which location for package source should be used */
, replace = 1 /* 1 = replace if the package already exist, 0 = otherwise */
, URLuser = /* user name for the password protected URLs */
, URLpass = /* password for the password protected URLs */
@@ -594,7 +595,7 @@ TODO:
/secure
minoperator
/*** HELP END ***/
des = 'Macro to install SAS package, version 20220830. Run %%installPackage() for help info.'
des = 'Macro to install SAS package, version 20220925. Run %%installPackage() for help info.'
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
%do;
@@ -609,7 +610,7 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
%put ### This is short help information for the `installPackage` macro #;
%put #--------------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to install SAS packages, version `20220830` #;
%put # Macro to install SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -641,8 +642,15 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
%put # Current default location for the framework is: #;
%put # `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/` #;
%put # #;
%put # - `mirror=` Indicates which web location for packages installation is used. #;
%put # Value `1` indicates: #;
%put # `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main` #;
%put # Value `2` indicates: #;
%put # `https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES` #;
%put # Default value is `1`. #;
%put # #;
%put # - `replace=` With default value of `1` it causes existing package file #;
%put # to be replaceed by new downloaded file. #;
%put # to be replaced by new downloaded file. #;
%put # #;
%put # - `URLuser=` A user name for the password protected URLs, no quotes needed. #;
%put # #;
@@ -707,7 +715,26 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
%if %superq(sourcePath)= %then
%do;
%local SPFinitMirror;
/* the defaults are: */
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
%if 1 = %superq(mirror) %then
%do;
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
%goto mirrorEnd;
%end;
%if 2 = %superq(mirror) %then
%do;
%let SPFinitMirror = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/SPF/SPFinit.sas;
%let sourcePath = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/packages/;
%goto mirrorEnd;
%end;
%mirrorEnd:
%put INFO: Source path is &sourcePath.;
%end;
%local i;
@@ -730,7 +757,7 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
%do;
/* allows to install/download the framework file like any other package */
filename &in URL
"https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas"
"&SPFinitMirror."
recfm=N lrecl=1;
filename &out
"&firstPackagesPath./SPFinit.sas"
@@ -923,7 +950,7 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
/* Macro to list SAS packages in packages folder.
Version 20220830
Version 20220925
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -943,7 +970,7 @@ des = 'Macro to install SAS package, version 20220830. Run %%installPackage() fo
%macro listPackages()/secure PARMBUFF
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20220830.'
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20220925.'
;
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
%do;
@@ -958,7 +985,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 `20220830` #;
%put # Macro to list available SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -1108,7 +1135,7 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
/* Macro to generate SAS packages.
Version 20220830
Version 20220925
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -1144,7 +1171,7 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
default value 1 means "delete tests work" */
)/secure minoperator
/*** HELP END ***/
des = 'Macro to generate SAS packages, version 20220830. Run %generatePackage() for help info.'
des = 'Macro to generate SAS packages, version 20220925. Run %generatePackage() for help info.'
;
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
%do;
@@ -1159,7 +1186,7 @@ des = 'Macro to generate SAS packages, version 20220830. Run %generatePackage()
%put ### This is short help information for the `generatePackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to generate SAS packages, version `20220830` #;
%put # Macro to generate SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -2713,7 +2740,7 @@ data _null_;
put ' end ; ';
%end;
put 'put "***"; put "* SAS package generated by generatePackage, version 20220830 *"; put "***";';
put 'put "***"; put "* SAS package generated by generatePackage, version 20220925 *"; put "***";';
put 'run; ' /;
@@ -3570,7 +3597,7 @@ TODO: (in Polish)
*/
)/secure
/*** HELP END ***/
des = 'Macro to load multiple SAS packages at one run, version 20220830. Run %loadPackages() for help info.'
des = 'Macro to load multiple SAS packages at one run, version 20220925. Run %loadPackages() for help info.'
parmbuff
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
@@ -3586,7 +3613,7 @@ parmbuff
%put ### This is short help information for the `loadPackageS` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro wrapper for the loadPackage macro, version `20220830` #;
%put # Macro wrapper for the loadPackage macro, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -3672,7 +3699,7 @@ parmbuff
hashing_file() function, SAS 9.4M6 */
)/secure
/*** HELP END ***/
des = 'Macro to verify SAS package with the hash digest, version 20220830. Run %verifyPackage() for help info.'
des = 'Macro to verify SAS package with the hash digest, version 20220925. Run %verifyPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -3687,7 +3714,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20220830. Run %
%put ### This is short help information for the `verifyPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to verify SAS package with it hash digest, version `20220830` #;
%put # Macro to verify SAS package with it hash digest, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -3857,7 +3884,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20220830. Run %
*/
)/secure
/*** HELP END ***/
des = 'Macro to preview content of a SAS package, version 20220830. Run %previewPackage() for help info.'
des = 'Macro to preview content of a SAS package, version 20220925. Run %previewPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -3872,7 +3899,7 @@ des = 'Macro to preview content of a SAS package, version 20220830. Run %preview
%put ### This is short help information for the `previewPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to get previwe of a SAS packages, version `20220830` #;
%put # Macro to get previwe of a SAS packages, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -3999,7 +4026,7 @@ des = 'Macro to preview content of a SAS package, version 20220830. Run %preview
when empty the "packages" value is used */
)/secure
/*** HELP END ***/
des = 'Macro to list directories pointed by "packages" fileref, version 20220830. Run %extendPackagesFileref(HELP) for help info.'
des = 'Macro to list directories pointed by "packages" fileref, version 20220925. Run %extendPackagesFileref(HELP) for help info.'
;
%if %QUPCASE(&packages.) = HELP %then
@@ -4015,7 +4042,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20220830
%put ### This is short help information for the `extendPackagesFileref` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to list directories pointed by 'packages' fileref, version `20220830` #;
%put # Macro to list directories pointed by 'packages' fileref, version `20220925` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;