mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-06-08 19:30:20 +00:00
SAS Packages Framework, version 20260602
SAS Packages Framework, version `20260602` Changes: - New macro: `%requestPackage()`; - Error fix for `githubRepo=` selection in the `%installPackage()` macro; - check for already loaded packages added to the `%loadPackage()` macro to avoid unnecessary re-loading; - update in `CMPLIB` cleaning for the `%unloadPacjkage()` macro.
This commit is contained in:
@@ -17,7 +17,7 @@ Don't forget to give the repository a **STAR** and become [stargazer](https://gi
|
|||||||
|
|
||||||
### Current version:
|
### Current version:
|
||||||
|
|
||||||
**The latest version** of the **SAS Packages Framework** is **`20260515**.
|
**The latest version** of the **SAS Packages Framework** is **`20260602**.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -197,35 +197,37 @@ The SAS Packages Framework [(short) documentation](https://github.com/yabwon/SAS
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Updates worth mentioning:
|
### Updates worth mentioning:
|
||||||
**Update**\[April 9th, 2026\]**:**Packages can be installed from private repositories. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20260409 "bundling macros"))**.
|
**Update**\[June 2nd, 2026\]**:** `%requestPackage()` utility macros is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20260602 "Request Package")).
|
||||||
|
|
||||||
**Update**\[December 31st, 2025\]**:** `%bundlePackages()` and `%unbundlePackages()` **macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20251231 "bundling macros"))**.
|
**Update**\[April 9th, 2026\]**:** Packages can be installed from private repositories. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20260409 "Private Repos")).
|
||||||
|
|
||||||
**Update**\[December 28th, 2025\]**:** `buildLocation=` and `archLocation=` **parameters added to** `%generatePackage()` **macro, they allow to redirect results of the packages generation process. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20251228 "redirect results with buildLocation="))**.
|
**Update**\[December 31st, 2025\]**:** `%bundlePackages()` and `%unbundlePackages()` macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20251231 "Bundling Packages")).
|
||||||
|
|
||||||
**Update**\[December 21st, 2025\]**:** `%relocatePackage()`, `%SasPackagesFrameworkNotes()`, and `%isPackagesFilerefOK()` **utility macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241221 "relocatePackage, SasPackagesFrameworkNotes, and isPackagesFilerefOK macros"))**.
|
**Update**\[December 28th, 2025\]**:** `buildLocation=` and `archLocation=` parameters added to `%generatePackage()` macro, they allow to redirect results of the packages generation process. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20251228 "Redirect Results")).
|
||||||
|
|
||||||
**Update**\[October 27th, 2024\]**:** `%splitCodeForPackage()` **utility macro is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241027 "splitCodeForPackage"))**.
|
**Update**\[December 21st, 2025\]**:** `%relocatePackage()`, `%SasPackagesFrameworkNotes()`, and `%isPackagesFilerefOK()` utility macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241221 "relocatePackage, SasPackagesFrameworkNotes, and isPackagesFilerefOK macros")).
|
||||||
|
|
||||||
**Update**\[October 14th, 2024\]**:** `DS2PCK` and `DS2THR` **types for `PROC DS2` *threads* and *packages* added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241014 "PROC DS2"))**.
|
**Update**\[October 27th, 2024\]**:** `%splitCodeForPackage()` utility macro is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241027 "splitCodeForPackage")).
|
||||||
|
|
||||||
**Update**\[December 10th, 2023\]**:** `markdownDoc=` **parameter added to** `%generatePackage()` **macro, it allows to generate markdown file with documentation. Content is taken from the help information notes and the description. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20231210 "markdown documentation"))**.
|
**Update**\[October 14th, 2024\]**:** `DS2PCK` and `DS2THR` types for `PROC DS2` *threads* and *packages* added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241014 "PROC DS2")).
|
||||||
|
|
||||||
**Update**\[November 11th, 2023\]**:** `KMFSNIP` **type for *key macro abbreviations* snippets added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20231111 "KMF-abbreviations"))**.
|
**Update**\[December 10th, 2023\]**:** `markdownDoc=` parameter added to `%generatePackage()` macro, it allows to generate markdown file with documentation. Content is taken from the help information notes and the description. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20231210 "Markdown Documentation")).
|
||||||
|
|
||||||
**Update**\[February 7th, 2023\]**:** `ADDCNT` **type for *additional content* feature and ** `%loadPackageAddCnt()` **macro added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20230207 "Additional Content"))**.
|
**Update**\[November 11th, 2023\]**:** `KMFSNIP` type for *key macro abbreviations* snippets added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20231111 "KMF-abbreviations")).
|
||||||
|
|
||||||
**Update**\[December 12th, 2022\]**:** `CASLUDF` **type for CASL user defined functions added to the framework. Utility macros for for loading content in proc IML and proc CAS added. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20221212 "New Type and Utility macros"))**.
|
**Update**\[February 7th, 2023\]**:** `ADDCNT` type for *additional content* feature and `%loadPackageAddCnt()` macro added to the framework. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20230207 "Additional Content")).
|
||||||
|
|
||||||
**Update**\[November 21st, 2022\]**:** `%loadPackage()` **macro allows Cherry Picking of content (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20221121 "Cherry Picking"))**.
|
**Update**\[December 12th, 2022\]**:** `CASLUDF` type for CASL user defined functions added to the framework. Utility macros for for loading content in proc IML and proc CAS added. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20221212 "New Type and Utility macros")).
|
||||||
|
|
||||||
**Update**\[September 30th, 2022\]**:** **New dedicated repository:** *SASPAC - the SAS Packages Archive* **is available as new location for packages storage**. Location of SASPAC is: [`https://github.com/SASPAC`](https://github.com/SASPAC)
|
**Update**\[November 21st, 2022\]**:** `%loadPackage()` macro allows Cherry Picking of content (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20221121 "Cherry Picking")).
|
||||||
|
|
||||||
**Update**\[November 11th, 2021\]**:** `%extendPackagesFileref()` **macro is available**.
|
**Update**\[September 30th, 2022\]**:** New dedicated repository: *SASPAC - the SAS Packages Archive* is available as new location for packages storage. Location of SASPAC is: [`https://github.com/SASPAC`](https://github.com/SASPAC)
|
||||||
|
|
||||||
**Update**\[October 15th, 2020\]**:** `%previewPackage()` **macro is available**.
|
**Update**\[November 11th, 2021\]**:** `%extendPackagesFileref()` macro is available.
|
||||||
|
|
||||||
**Update**\[September 11th, 2020\]**:** ` %loadPackageS()` and `%verifyPackage()` **macros are available**.
|
**Update**\[October 15th, 2020\]**:** `%previewPackage()` macro is available.
|
||||||
|
|
||||||
|
**Update**\[September 11th, 2020\]**:** ` %loadPackageS()` and `%verifyPackage()` macros are available.
|
||||||
|
|
||||||
**Update**\[July 30th, 2020\]**:** All components of SAS Packages Framework are now in one file `SPFinit.sas` (located in the `./SPF` directory). Documentation moved to `./SPF/Documentation` directory. Packages zip files moved to `./packages` directory.
|
**Update**\[July 30th, 2020\]**:** All components of SAS Packages Framework are now in one file `SPFinit.sas` (located in the `./SPF` directory). Documentation moved to `./SPF/Documentation` directory. Packages zip files moved to `./packages` directory.
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -8,7 +8,7 @@
|
|||||||
,packagesRef=packages
|
,packagesRef=packages
|
||||||
,ods= /* data set for report file */
|
,ods= /* data set for report file */
|
||||||
)/
|
)/
|
||||||
des='Macro to create a bundle of SAS packages, version 20260515. Run %bundlePackages(HELP) for help info.'
|
des='Macro to create a bundle of SAS packages, version 20260602. Run %bundlePackages(HELP) for help info.'
|
||||||
secure minoperator
|
secure minoperator
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ secure minoperator
|
|||||||
%put ### This is short help information for the `bundlePackages` macro #;
|
%put ### This is short help information for the `bundlePackages` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to *create bundles* of SAS packages, version `20260515` #;
|
%put # Macro to *create bundles* of SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
when empty the "packages" value is used */
|
when empty the "packages" value is used */
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to list directories pointed by "packages" fileref, version 20260515. Run %extendPackagesFileref(HELP) for help info.'
|
des = 'Macro to list directories pointed by "packages" fileref, version 20260602. Run %extendPackagesFileref(HELP) for help info.'
|
||||||
;
|
;
|
||||||
|
|
||||||
%if %QUPCASE(&packages.) = HELP %then
|
%if %QUPCASE(&packages.) = HELP %then
|
||||||
@@ -22,7 +22,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20260515
|
|||||||
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
||||||
%put #-----------------------------------------------------------------------------------------#;;
|
%put #-----------------------------------------------------------------------------------------#;;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to list directories pointed by 'packages' fileref, version `20260515` #;
|
%put # Macro to list directories pointed by 'packages' fileref, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Macro to generate SAS packages.
|
Macro to generate SAS packages.
|
||||||
|
|
||||||
Version 20260515
|
Version 20260602
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
when empty takes buildLocation */
|
when empty takes buildLocation */
|
||||||
)/ secure minoperator
|
)/ secure minoperator
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to generate SAS packages, version 20260515. Run %generatePackage() for help info.'
|
des = 'Macro to generate SAS packages, version 20260602. Run %generatePackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
|
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -68,7 +68,7 @@ des = 'Macro to generate SAS packages, version 20260515. Run %generatePackage()
|
|||||||
%put ### This is short help information for the `generatePackage` macro #;
|
%put ### This is short help information for the `generatePackage` macro #;
|
||||||
%put #------------------------------------------------------------------------------------#;
|
%put #------------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to generate SAS packages, version `20260515` #;
|
%put # Macro to generate SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%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.";
|
title&_titleNumber_. "Package ZIP file location is: &buildLocation.";
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
footnote1 "SAS Packages Framework, version 20260515";
|
footnote1 "SAS Packages Framework, version 20260602";
|
||||||
|
|
||||||
proc print
|
proc print
|
||||||
data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent)
|
data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent)
|
||||||
@@ -1775,7 +1775,7 @@ data _null_;
|
|||||||
%end;
|
%end;
|
||||||
put +(-1) '`.;'''
|
put +(-1) '`.;'''
|
||||||
/ ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"'
|
/ ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"'
|
||||||
/ ' !! '' %put with the SAS Packages Framework version 20260515.;'''
|
/ ' !! '' %put with the SAS Packages Framework version 20260602.;'''
|
||||||
/ ' !! '' %put ****************************************************************************;'''
|
/ ' !! '' %put ****************************************************************************;'''
|
||||||
/ ' !! '' %GOTO theEndOfTheMacro;'''
|
/ ' !! '' %GOTO theEndOfTheMacro;'''
|
||||||
/ ' !! '' %end;''' ;
|
/ ' !! '' %end;''' ;
|
||||||
@@ -1939,7 +1939,7 @@ data _null_;
|
|||||||
%end;
|
%end;
|
||||||
put +(-1) '`.; '' !!' /
|
put +(-1) '`.; '' !!' /
|
||||||
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' /
|
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' /
|
||||||
''' %put with the SAS Packages Framework version 20260515.; '' !! ' /
|
''' %put with the SAS Packages Framework version 20260602.; '' !! ' /
|
||||||
''' %put ****************************************************************************; '' !! ' /
|
''' %put ****************************************************************************; '' !! ' /
|
||||||
''' %GOTO theEndOfTheMacro; '' !! ' /
|
''' %GOTO theEndOfTheMacro; '' !! ' /
|
||||||
''' %end; '' !! ' /
|
''' %end; '' !! ' /
|
||||||
@@ -2811,7 +2811,7 @@ data _null_;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
put 'put " " / @3 "---------------------------------------------------------------------" / " ";'
|
put 'put " " / @3 "---------------------------------------------------------------------" / " ";'
|
||||||
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260515`*";'
|
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260602`*";'
|
||||||
/ "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';"
|
/ "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';"
|
||||||
/ "put @3 '*using SAS release: `&sysvlong4.`.*';"
|
/ "put @3 '*using SAS release: `&sysvlong4.`.*';"
|
||||||
/ 'put " " / @3 "---------------------------------------------------------------------";';
|
/ 'put " " / @3 "---------------------------------------------------------------------";';
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to get help about SAS package, version 20260515. Run %helpPackage() for help info.'
|
des = 'Macro to get help about SAS package, version 20260602. Run %helpPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -43,7 +43,7 @@ des = 'Macro to get help about SAS package, version 20260515. Run %helpPackage()
|
|||||||
%put ### This is short help information for the `helpPackage` macro #;
|
%put ### This is short help information for the `helpPackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to get help about SAS packages, version `20260515` #;
|
%put # Macro to get help about SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*+installPackage+*/
|
/*+installPackage+*/
|
||||||
/* Macros to install SAS packages, version 20260515 */
|
/* Macros to install SAS packages, version 20260602 */
|
||||||
/* A SAS package is a zip file containing a group of files
|
/* A SAS package is a zip file containing a group of files
|
||||||
with SAS code (macros, functions, data steps generating
|
with SAS code (macros, functions, data steps generating
|
||||||
data, etc.) wrapped up together and %INCLUDEed by
|
data, etc.) wrapped up together and %INCLUDEed by
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
default is 0 - means No, 1 means Yes */
|
default is 0 - means No, 1 means Yes */
|
||||||
, SFRCVN = /* name of a macro variable to store success-failure return code value */
|
, SFRCVN = /* name of a macro variable to store success-failure return code value */
|
||||||
, github = /* name of a user or an organization in GitHub, all characters except [A-z0-9_.-] are compressed */
|
, github = /* name of a user or an organization in GitHub, all characters except [A-z0-9_.-] are compressed */
|
||||||
, githubRepo = %sysfunc(lowcase(&packageName.)) /* repo name to be used, by default it is the package name, but can be altered */
|
, githubRepo = /* repo name to be used, by default it is the package name, but can be altered */
|
||||||
, githubToken = /* user's github fine-grained personal access token */
|
, githubToken = /* user's github fine-grained personal access token */
|
||||||
, githubTokenDebug = 0 /* debug values: 0,1,2,3 */
|
, githubTokenDebug = 0 /* debug values: 0,1,2,3 */
|
||||||
)
|
)
|
||||||
/secure
|
/secure
|
||||||
minoperator
|
minoperator
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to install SAS package, version 20260515. Run %%installPackage() for help info.'
|
des = 'Macro to install SAS package, version 20260602. Run %installPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -45,7 +45,7 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
%put ### This is short help information for the `installPackage` macro #;
|
%put ### This is short help information for the `installPackage` macro #;
|
||||||
%put #--------------------------------------------------------------------------------------------#;;
|
%put #--------------------------------------------------------------------------------------------#;;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to install SAS packages, version `20260515` #;
|
%put # Macro to install SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -220,11 +220,13 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
|
|
||||||
/* in case the 'packages' fileref is multi-directory the first directory will be selected as a destination */
|
/* in case the 'packages' fileref is multi-directory the first directory will be selected as a destination */
|
||||||
data _null_;
|
data _null_;
|
||||||
if "(" =: pathname("packages") then
|
length p $ 32767;
|
||||||
/* get the firstPackagesPath */
|
p = pathname("packages");
|
||||||
call symputX("firstPackagesPath", dequote(kscanx(pathname("packages"), 1, "()", "QS")), "L");
|
if "(" =: p then
|
||||||
|
/* get the firstPackagesPath */
|
||||||
|
call symputX("firstPackagesPath", dequote(kscanx(p, 1, "()", "QS")), "L");
|
||||||
else
|
else
|
||||||
call symputX("firstPackagesPath", pathname("packages"), "L");
|
call symputX("firstPackagesPath", p, "L");
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt)));
|
%let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt)));
|
||||||
@@ -336,6 +338,9 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
%Let PackagesInstalledSussess=;
|
%Let PackagesInstalledSussess=;
|
||||||
%let PackagesInstalledFail=;
|
%let PackagesInstalledFail=;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%do i = 1 %to %sysfunc(countw(&packagesNames., , S));
|
%do i = 1 %to %sysfunc(countw(&packagesNames., , S));
|
||||||
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
|
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
|
||||||
%local packageName packageSubDir vers versA versB;
|
%local packageName packageSubDir vers versA versB;
|
||||||
@@ -353,6 +358,11 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
%end;
|
%end;
|
||||||
%put ### &packageName.(&vers.) ###;
|
%put ### &packageName.(&vers.) ###;
|
||||||
|
|
||||||
|
/* if repo name is empty then use package name */
|
||||||
|
%local githubRepoLocal;
|
||||||
|
%if %sysevalf(%superq(githubRepo)=,boolean) %then %let githubRepoLocal=%sysfunc(lowcase(&packageName.));
|
||||||
|
%else %let githubRepoLocal=%superq(githubRepo);
|
||||||
|
|
||||||
%put *** %sysfunc(lowcase(&packageName.)) start *****************************************;
|
%put *** %sysfunc(lowcase(&packageName.)) start *****************************************;
|
||||||
%local in out inMD outMD bckp_ref bckplabel _IOFileref_;
|
%local in out inMD outMD bckp_ref bckplabel _IOFileref_;
|
||||||
data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run;
|
data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run;
|
||||||
@@ -399,12 +409,12 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
%do;
|
%do;
|
||||||
%if %superq(mirror) IN (0 3 4) %then /* SASPAC or PharmaForest or an arbitrary GitHub repo */
|
%if %superq(mirror) IN (0 3 4) %then /* SASPAC or PharmaForest or an arbitrary GitHub repo */
|
||||||
%do;
|
%do;
|
||||||
%let packageSubDir = &githubRepo./raw/main/;
|
%let packageSubDir = &githubRepoLocal./raw/main/;
|
||||||
|
|
||||||
%if %superq(vers) ne %then
|
%if %superq(vers) ne %then
|
||||||
%do;
|
%do;
|
||||||
/*%let packageSubDir = %sysfunc(lowcase(&packageName.))/main/hist/&version./;*/
|
/*%let packageSubDir = %sysfunc(lowcase(&packageName.))/main/hist/&version./;*/
|
||||||
%let packageSubDir = &githubRepo./raw/&vers./;
|
%let packageSubDir = &githubRepoLocal./raw/&vers./;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
%else
|
%else
|
||||||
@@ -633,7 +643,7 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
%if ¬RunHTTP.=0 %then
|
%if ¬RunHTTP.=0 %then
|
||||||
%do;
|
%do;
|
||||||
%put %str( )URL called by PROC HTTP is:;
|
%put %str( )URL called by PROC HTTP is:;
|
||||||
%put %str( )"https://api.github.com/repos/&github./&githubRepo./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref.";
|
%put %str( )"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref.";
|
||||||
%put %str( )Headers:;
|
%put %str( )Headers:;
|
||||||
%put %str( )Accept=application/vnd.github.raw+json;
|
%put %str( )Accept=application/vnd.github.raw+json;
|
||||||
%put %str( )X-GitHub-Api-Version=2026-03-10;
|
%put %str( )X-GitHub-Api-Version=2026-03-10;
|
||||||
@@ -648,7 +658,7 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
method="GET"
|
method="GET"
|
||||||
out=&out.
|
out=&out.
|
||||||
URL=
|
URL=
|
||||||
"https://api.github.com/repos/&github./&githubRepo./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref."
|
"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref."
|
||||||
CLEAR_CACHE
|
CLEAR_CACHE
|
||||||
;
|
;
|
||||||
headers
|
headers
|
||||||
@@ -693,7 +703,7 @@ des = 'Macro to install SAS package, version 20260515. Run %%installPackage() fo
|
|||||||
method="GET"
|
method="GET"
|
||||||
out=&outMD.
|
out=&outMD.
|
||||||
URL=
|
URL=
|
||||||
"https://api.github.com/repos/&github./&githubRepo./contents/%sysfunc(lowcase(&packageName.)).md?ref=&ref."
|
"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).md?ref=&ref."
|
||||||
CLEAR_CACHE
|
CLEAR_CACHE
|
||||||
;
|
;
|
||||||
headers
|
headers
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
vERRb /* indicates if macro should be verbose and report errors */
|
vERRb /* indicates if macro should be verbose and report errors */
|
||||||
)
|
)
|
||||||
/ minoperator PARMBUFF
|
/ minoperator PARMBUFF
|
||||||
des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260515.'
|
des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260602.'
|
||||||
;
|
;
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
%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 ### This is short help information for the `isPackagesFilerefOK` macro #;
|
||||||
%put #-----------------------------------------------------------------------------------------#;;
|
%put #-----------------------------------------------------------------------------------------#;;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to check if the `packages` fileref is "correct", version `20260515` #;
|
%put # Macro to check if the `packages` fileref is "correct", version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Macro to list SAS packages in packages folder.
|
Macro to list SAS packages in packages folder.
|
||||||
|
|
||||||
Version 20260515
|
Version 20260602
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
listDataSet /* Name of a data set to save results */
|
listDataSet /* Name of a data set to save results */
|
||||||
, quiet = 0 /* Indicate if results should be printed in log */
|
, quiet = 0 /* Indicate if results should be printed in log */
|
||||||
)/secure parmbuff
|
)/secure parmbuff
|
||||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260515.'
|
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260602.'
|
||||||
;
|
;
|
||||||
%if (%QUPCASE(&listDataSet.) = HELP) %then
|
%if (%QUPCASE(&listDataSet.) = HELP) %then
|
||||||
%do;
|
%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 ### This is short help information for the `listPackages` macro #;
|
||||||
%put #-----------------------------------------------------------------------------------------#;;
|
%put #-----------------------------------------------------------------------------------------#;;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to list available SAS packages, version `20260515` #;
|
%put # Macro to list available SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
+65
-30
@@ -34,9 +34,10 @@
|
|||||||
, DS2force=0 /* indicates if PROC DS2 packages and threads
|
, DS2force=0 /* indicates if PROC DS2 packages and threads
|
||||||
should be loaded if a data set exists, 0=do not load
|
should be loaded if a data set exists, 0=do not load
|
||||||
*/
|
*/
|
||||||
|
, force=0 /* force loading even if given version is already loaded */
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to load SAS package, version 20260515. Run %loadPackage() for help info.'
|
des = 'Macro to load SAS package, version 20260602. Run %loadPackage(HELP) for help info.'
|
||||||
minoperator
|
minoperator
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
@@ -52,7 +53,7 @@ minoperator
|
|||||||
%put ### This is short help information for the `loadPackage` macro #;
|
%put ### This is short help information for the `loadPackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to *load* SAS packages, version `20260515` #;
|
%put # Macro to *load* SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -116,6 +117,10 @@ minoperator
|
|||||||
%put # or threads should overwrite existing SAS data sets. #;
|
%put # or threads should overwrite existing SAS data sets. #;
|
||||||
%put # Default value of `0` means "do not overwrite". #;
|
%put # Default value of `0` means "do not overwrite". #;
|
||||||
%put # #;
|
%put # #;
|
||||||
|
%put # - `force=` *Optional.* Forces re-loading of a package, even if #;
|
||||||
|
%put # the given version is already loaded. #;
|
||||||
|
%put # Default value of `0` means "do not re-load". #;
|
||||||
|
%put # #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
||||||
@@ -197,7 +202,7 @@ minoperator
|
|||||||
if exists then leave;
|
if exists then leave;
|
||||||
end;
|
end;
|
||||||
if exists then call symputx("path", p, "L");
|
if exists then call symputx("path", p, "L");
|
||||||
/*run;*/ /* moved to line 272 */
|
/*run;*/ /* moved to line 276 */
|
||||||
|
|
||||||
/* convert cherryPick to lower case if needed */
|
/* convert cherryPick to lower case if needed */
|
||||||
%if NOT (%str(*) = %superq(cherryPick)) %then
|
%if NOT (%str(*) = %superq(cherryPick)) %then
|
||||||
@@ -206,28 +211,20 @@ minoperator
|
|||||||
call symputX("cherryPick",lowcase(compbl(compress(symget("cherryPick"),". _","KDA"))),"L");
|
call symputX("cherryPick",lowcase(compbl(compress(symget("cherryPick"),". _","KDA"))),"L");
|
||||||
/*run;*/
|
/*run;*/
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
run;
|
run;
|
||||||
|
|
||||||
/* empty list is equivalent to "*" */
|
/* empty list is equivalent to "*" */
|
||||||
%if %superq(cherryPick)= %then
|
%if %sysevalf(%superq(cherryPick)=,boolean) %then
|
||||||
%do;
|
%do;
|
||||||
%let cherryPick=*;
|
%let cherryPick=*;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if %superq(loadAddCnt) NE 1 %then
|
/* default is 0, anything else is 1 */
|
||||||
%do;
|
%let loadAddCnt =%sysevalf(NOT(%superq(loadAddCnt)=0),boolean);
|
||||||
%let loadAddCnt = 0;
|
%let suppressExec =%sysevalf(NOT(%superq(suppressExec)=0),boolean);
|
||||||
%end;
|
%let DS2force =%sysevalf(NOT(%superq(DS2force)=0),boolean);
|
||||||
|
%let force =%sysevalf(NOT(%superq(force)=0),boolean);
|
||||||
%if %superq(suppressExec) NE 1 %then
|
|
||||||
%do;
|
|
||||||
%let suppressExec = 0;
|
|
||||||
%end;
|
|
||||||
|
|
||||||
%if %superq(DS2force) NE 1 %then
|
|
||||||
%do;
|
|
||||||
%let DS2force = 0;
|
|
||||||
%end;
|
|
||||||
|
|
||||||
filename &_PackageFileref_. &ZIP.
|
filename &_PackageFileref_. &ZIP.
|
||||||
/* put location of package myPackageFile.zip here */
|
/* put location of package myPackageFile.zip here */
|
||||||
@@ -237,8 +234,10 @@ minoperator
|
|||||||
%do;
|
%do;
|
||||||
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
|
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
|
||||||
filename &_PackageFileref_. clear;
|
filename &_PackageFileref_. clear;
|
||||||
|
/**/
|
||||||
|
|
||||||
/* test if required version of package is "good enough" */
|
/* test if required version of package is "good enough" */
|
||||||
|
|
||||||
%local rV pV rV0 pV0 rVsign;
|
%local rV pV rV0 pV0 rVsign;
|
||||||
%let pV0 = %sysfunc(compress(&packageVersion.,.,kd));
|
%let pV0 = %sysfunc(compress(&packageVersion.,.,kd));
|
||||||
%let pV = %sysevalf((%scan(&pV0.,1,.,M)+0)*1e8
|
%let pV = %sysevalf((%scan(&pV0.,1,.,M)+0)*1e8
|
||||||
@@ -257,8 +256,33 @@ minoperator
|
|||||||
%let rV = %sysevalf((%scan(&rV0.,1,.,M)+0)*1e8
|
%let rV = %sysevalf((%scan(&rV0.,1,.,M)+0)*1e8
|
||||||
+ (%scan(&rV0.,2,.,M)+0)*1e4
|
+ (%scan(&rV0.,2,.,M)+0)*1e4
|
||||||
+ (%scan(&rV0.,3,.,M)+0)*1e0);
|
+ (%scan(&rV0.,3,.,M)+0)*1e0);
|
||||||
|
|
||||||
|
/* check if the package is already loaded */
|
||||||
|
/* conditions 1) cherrypick=* 2) sysloadedpackages exists and is global, */
|
||||||
|
|
||||||
%if NOT %sysevalf(&rV. &rVsign. &pV.) %then
|
%local aleradyLoaded pLV pLV0; /* flag for already laded package check */
|
||||||
|
%let aleradyLoaded = 0;
|
||||||
|
%if 0=&force. AND %SYMEXIST(sysloadedpackages) AND (%superq(cherrypick)=%str(*)) %then
|
||||||
|
%do;
|
||||||
|
%if %SYMGLOBL(sysloadedpackages) %then
|
||||||
|
%do;
|
||||||
|
%local findInLoaded;
|
||||||
|
%let findInLoaded = %qsysfunc(FIND(%superq(sysloadedpackages), %str(&packageName.%(), IT)); /* )-clocing */
|
||||||
|
|
||||||
|
%if &findInLoaded. %then
|
||||||
|
%let pLV0 = %scan(%substr(%superq(sysloadedpackages),&findInLoaded.),2,());
|
||||||
|
%else
|
||||||
|
%let pLV0 = .;
|
||||||
|
%let pLV = %sysevalf((%scan(&pLV0.,1,.,M)+0)*1e8
|
||||||
|
+ (%scan(&pLV0.,2,.,M)+0)*1e4
|
||||||
|
+ (%scan(&pLV0.,3,.,M)+0)*1e0);
|
||||||
|
|
||||||
|
/* if package name was found and version is ok set aleradyLoaded flag to 1 */
|
||||||
|
%let aleradyLoaded=%sysevalf(&findInLoaded. AND (&rV. &rVsign. &pLV.),boolean);
|
||||||
|
%end;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
%if (NOT &aleradyLoaded.) AND (NOT %sysevalf(&rV. &rVsign. &pV.)) %then
|
||||||
%do;
|
%do;
|
||||||
%put ERROR: Package &packageName. will not be loaded!;
|
%put ERROR: Package &packageName. will not be loaded!;
|
||||||
%put ERROR- Required version is &rV0.;
|
%put ERROR- Required version is &rV0.;
|
||||||
@@ -276,19 +300,30 @@ minoperator
|
|||||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||||
%else utf8 ;
|
%else utf8 ;
|
||||||
;
|
;
|
||||||
%if %superq(lazyData) = %then
|
%if %sysevalf(%superq(lazyData)=,boolean) %then
|
||||||
%do;
|
%do;
|
||||||
%local tempLoad_minoperator temp_noNotes_etc /* for hiding notes */ ;
|
%if NOT &aleradyLoaded. %then
|
||||||
%let tempLoad_minoperator = %sysfunc(getoption(minoperator));
|
|
||||||
options minoperator; /* MinOperator option is required for cherryPicking to work */
|
|
||||||
%include &_PackageFileref_.(load.sas) / &source2.;
|
|
||||||
options &tempLoad_minoperator.;
|
|
||||||
%if 1 = &loadAddCnt. %then
|
|
||||||
%do;
|
%do;
|
||||||
%put; %put - Additional content loading - Start -;
|
%local tempLoad_minoperator temp_noNotes_etc /* for hiding notes */ ;
|
||||||
%loadPackageAddCnt(&packageName.,
|
%let tempLoad_minoperator = %sysfunc(getoption(minoperator));
|
||||||
path=&path.)
|
options minoperator; /* MinOperator option is required for cherryPicking to work */
|
||||||
%put - Additional content loading - End -;
|
%include &_PackageFileref_.(load.sas) / &source2.;
|
||||||
|
options &tempLoad_minoperator.;
|
||||||
|
%if 1 = &loadAddCnt. %then
|
||||||
|
%do;
|
||||||
|
%put; %put - Additional content loading - Start -;
|
||||||
|
%loadPackageAddCnt(&packageName.,
|
||||||
|
path=&path.)
|
||||||
|
%put - Additional content loading - End -;
|
||||||
|
%end;
|
||||||
|
%end;
|
||||||
|
%else
|
||||||
|
%do;
|
||||||
|
%put NOTE- %str( );
|
||||||
|
%put NOTE: It looks like the &packageName.(&pLV0.) package already loaded! Nothing to do.;
|
||||||
|
%put NOTE- To force reloading use the force=1;
|
||||||
|
/* if package is already loaded with req version. */
|
||||||
|
%put NOTE- %str( );
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
%else
|
%else
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
is provided in required version */
|
is provided in required version */
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to load additional content for a SAS package, version 20260515. Run %loadPackageAddCnt() for help info.'
|
des = 'Macro to load additional content for a SAS package, version 20260602. Run %loadPackageAddCnt(HELP) for help info.'
|
||||||
minoperator
|
minoperator
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
@@ -35,7 +35,7 @@ minoperator
|
|||||||
%put ### This is short help information for the `loadPackageAddCnt` macro #;
|
%put ### This is short help information for the `loadPackageAddCnt` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to *load* additional content for a SAS package, version `20260515` #;
|
%put # Macro to *load* additional content for a SAS package, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to load multiple SAS packages at one run, version 20260515. Run %loadPackages() for help info.'
|
des = 'Macro to load multiple SAS packages at one run, version 20260602. Run %loadPackages(HELP) for help info.'
|
||||||
parmbuff
|
parmbuff
|
||||||
;
|
;
|
||||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||||
@@ -27,7 +27,7 @@ parmbuff
|
|||||||
%put ### This is short help information for the `loadPackageS` macro #;
|
%put ### This is short help information for the `loadPackageS` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro wrapper for the loadPackage macro, version `20260515` #;
|
%put # Macro wrapper for the loadPackage macro, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to preview content of a SAS package, version 20260515. Run %previewPackage() for help info.'
|
des = 'Macro to preview content of a SAS package, version 20260602. Run %previewPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -38,7 +38,7 @@ des = 'Macro to preview content of a SAS package, version 20260515. Run %preview
|
|||||||
%put ### This is short help information for the `previewPackage` macro #;
|
%put ### This is short help information for the `previewPackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to get preview of a SAS packages, version `20260515` #;
|
%put # Macro to get preview of a SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
,psMAX=MAX /* pageSise in case executed inside DoSubL() */
|
,psMAX=MAX /* pageSise in case executed inside DoSubL() */
|
||||||
,ods= /* a data set for results, e.g., work.relocatePackageReport */
|
,ods= /* a data set for results, e.g., work.relocatePackageReport */
|
||||||
)
|
)
|
||||||
/ des = 'Utility macro that locally Copies or Moves Packages, version 20260515. Run %relocatePackage() for help info.'
|
/ des = 'Utility macro that locally Copies or Moves Packages, version 20260602. Run %relocatePackage(HELP) for help info.'
|
||||||
secure
|
secure
|
||||||
minoperator
|
minoperator
|
||||||
;
|
;
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
%put ### This is short help information for the `relocatePackage` macro #;
|
%put ### This is short help information for the `relocatePackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to *locally copy or move* (relocate) SAS packages, version `20260515` #;
|
%put # Macro to *locally copy or move* (relocate) SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -0,0 +1,455 @@
|
|||||||
|
/*+requestPackage+*/
|
||||||
|
%macro requestPackage(
|
||||||
|
packageName
|
||||||
|
,requiredVersion=
|
||||||
|
/* technical parameters passed to installPackage macro */
|
||||||
|
, sourcePath = /* location of the package, e.g. "www.some.page/", mind the "/" at the end */
|
||||||
|
, mirror = 0 /* indicates which location for package source should be used */
|
||||||
|
, 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 */
|
||||||
|
, loadAddCnt=0 /* should the additional content be loaded?
|
||||||
|
default is 0 - means No, 1 means Yes */
|
||||||
|
, instDoc=0 /* should the markdown file with documentation be installed?
|
||||||
|
default is 0 - means No, 1 means Yes */
|
||||||
|
|
||||||
|
, github = /* name of a user or an organization in GitHub, all characters except [A-z0-9_.-] are compressed */
|
||||||
|
, githubRepo = /* repo name to be used, by default it is the package name, but can be altered */
|
||||||
|
, githubToken = /* user's github fine-grained personal access token */
|
||||||
|
, githubTokenDebug = 0 /* debug values: 0,1,2,3 */
|
||||||
|
|
||||||
|
, loadPackage=1 /* should the packages be installed after installing */
|
||||||
|
, force=0 /* force reloading even if already loaded */
|
||||||
|
, ignoreDepVer=0 /* should dependencies version be ignore so that only the latest could be installed */
|
||||||
|
, successDS= /* technical */
|
||||||
|
)
|
||||||
|
/secure
|
||||||
|
des = 'Macro to request SAS package installation and loading, version 20260602. Run %requestPackage(HELP) for help info.';
|
||||||
|
|
||||||
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
|
%do;
|
||||||
|
%local options_tmp ;
|
||||||
|
%let options_tmp = ls=%sysfunc(getoption(ls)) ps=%sysfunc(getoption(ps))
|
||||||
|
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
|
||||||
|
msglevel=%sysfunc(getoption(msglevel))
|
||||||
|
;
|
||||||
|
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
|
||||||
|
%put ;
|
||||||
|
%put ##############################################################################################;
|
||||||
|
%put ### This is short help information for the `requestPackage` macro #;
|
||||||
|
%put #--------------------------------------------------------------------------------------------#;;
|
||||||
|
%put # #;
|
||||||
|
%put # Macro to request (install and load) SAS packages, version `20260602` #;
|
||||||
|
%put # #;
|
||||||
|
%put # A SAS package is a zip file containing a group #;
|
||||||
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
%put # data, etc.) wrapped up together and embedded inside the zip. #;
|
||||||
|
%put # #;
|
||||||
|
%put # The `%nrstr(%%requestPackage())` macro installs and loads the package zip #;
|
||||||
|
%put # in the packages folder. The process takes care of installing or loading #;
|
||||||
|
%put # dependencies too. #;
|
||||||
|
%put # #;
|
||||||
|
%put # In case the packages fileref is a multi-directory one the first directory #;
|
||||||
|
%put # will be selected as a destination. #;
|
||||||
|
%put # #;
|
||||||
|
%put #--------------------------------------------------------------------------------------------#;
|
||||||
|
%put # #;
|
||||||
|
%put #### Parameters: #;
|
||||||
|
%put # #;
|
||||||
|
%put # 1. `packageName ` Name of a package _without_ the zip extension, e.g., myPackage1. #;
|
||||||
|
%put # Required and not null, default use case: #;
|
||||||
|
%put # `%nrstr(%%requestPackage(myPackage1))`. #;
|
||||||
|
%put # If empty displays this help information. #;
|
||||||
|
%put # #;
|
||||||
|
%put # **Installation options:** #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `requiredVersion=` *Optional.* Indicates which package version we want #;
|
||||||
|
%put # to be requested, default value: `.` means "the latest". #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `sourcePath=` Location of the package, e.g. "www.some.web.page/" #;
|
||||||
|
%put # Mind the "/" at the end of the path! #;
|
||||||
|
%put # Current default location for packages is: #;
|
||||||
|
%put # `https://github.com/SASPAC/` #;
|
||||||
|
%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 `0` or `SASPAC` indicates: #;
|
||||||
|
%put # `https://github.com/SASPAC/` #;
|
||||||
|
%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 # Value `3` or `PharmaForest` indicates: #;
|
||||||
|
%put # `https://github.com/PharmaForest/` #;
|
||||||
|
%put # Default value is `0`. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `version=` Indicates which historical version of a package to install. #;
|
||||||
|
%put # Historical version are currently available only if `mirror=0` is set. #;
|
||||||
|
%put # Default value is null which means "install the latest". #;
|
||||||
|
%put # When there are multiple packages to install the `version` variable #;
|
||||||
|
%put # is scan sequentially. #;
|
||||||
|
%put # #;
|
||||||
|
%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 # #;
|
||||||
|
%put # - `URLpass=` A password for the password protected URLs, no quotes needed. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `URLoptions=` Options for the `sourcePath` URLs filename. Consult the SAS #;
|
||||||
|
%put # documentation for the further details. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `loadAddCnt=` *Optional.* A package zip may contain additional #;
|
||||||
|
%put # content. The option indicates if it should be loaded #;
|
||||||
|
%put # Default value of zero (`0`) means "No", one (`1`) #;
|
||||||
|
%put # means "Yes". Content is extracted into the **packages** fileref #;
|
||||||
|
%put # directory in `<packageName>_AdditionalContent` folder. #;
|
||||||
|
%put # For other locations use `%nrstr(%%loadPackageAddCnt())` macro. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `instDoc=` *Optional.* A package may be provided with a markdown file #;
|
||||||
|
%put # containing combined documentation of the package. The option #;
|
||||||
|
%put # indicates if the `.md` file should be also downloaded. #;
|
||||||
|
%put # Default value of zero (`0`) means "No", one (`1`) means "Yes". #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `github=` *Optional.* A name of a user or an organization in GitHub. #;
|
||||||
|
%put # Allows an easy set of the search path for packages available on GitHub: #;
|
||||||
|
%put # `https://github.com/<github>/<githubRepo>/raw/.../` #;
|
||||||
|
%put # All characters except `[A-z0-9_.-]` are compressed. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `githubRepo=` *Optional.* A name of a repository in GitHub. #;
|
||||||
|
%put # Allows an easy set of the search path for packages available on GitHub: #;
|
||||||
|
%put # `https://github.com/<github>/<githubRepo>/raw/.../` #;
|
||||||
|
%put # By default lowercase name of installed package is used. #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `githubToken=` *Optional.* A fine-grained personal access token for GitHub. #;
|
||||||
|
%put # When the value is non-missing it triggers GitHub API access to #;
|
||||||
|
%put # private repositories. Of course the token used has to be configured #;
|
||||||
|
%put # properly for the access. #;
|
||||||
|
%put # Read GitHub documentation to learn how to create and setup your token: #;
|
||||||
|
%put # `https://docs.github.com/en/authentication/ #;
|
||||||
|
%put # keeping-your-account-and-data-secure/ #;
|
||||||
|
%put # managing-your-personal-access-tokens #;
|
||||||
|
%put # #creating-a-fine-grained-personal-access-token` #;
|
||||||
|
%put # (lines break added for easier reading) #;
|
||||||
|
%put # Public repos do not need authentication. #;
|
||||||
|
%put # [NOTE!] This feature is experimental in this release. #;
|
||||||
|
%put # #;
|
||||||
|
%put # **Loading options:** #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `loadPackage=` *Optional.* Indicates if requested package should be loaded too #;
|
||||||
|
%put # or only installed. Dependencies are only installed. #;
|
||||||
|
%put # Default value of zero (`0`) means "No", one (`1`) means "Yes". #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `force=` *Optional.* Indicates if requested package should be reloaded #;
|
||||||
|
%put # even if it was already loaded to the session. #;
|
||||||
|
%put # Default value of zero (`0`) means "No", one (`1`) means "Yes". #;
|
||||||
|
%put # #;
|
||||||
|
%put # - `ignoreDepVer=` *Optional.* Indicates if packages versions in dependencies list #;
|
||||||
|
%put # should be ignored and the latest available version be used. #;
|
||||||
|
%put # Default value of zero (`0`) means "No", one (`1`) means "Yes". #;
|
||||||
|
%put # #;
|
||||||
|
%put #--------------------------------------------------------------------------------------------#;
|
||||||
|
%put # #;
|
||||||
|
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
||||||
|
%put # to learn more. #;
|
||||||
|
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
|
||||||
|
%put # #;
|
||||||
|
%put #### Example #################################################################################;
|
||||||
|
%put # #;
|
||||||
|
%put # Enabling the SAS Package Framework #;
|
||||||
|
%put # from the local directory and requesting (installing & loading) #;
|
||||||
|
%put # the bpUTiL package from the Internet. #;
|
||||||
|
%put # #;
|
||||||
|
%put # Assume that the `SPFinit.sas` file #;
|
||||||
|
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
|
||||||
|
%put # #;
|
||||||
|
%put # Run the following code in your SAS session: #;
|
||||||
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
||||||
|
%put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
|
||||||
|
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
|
||||||
|
%put ;
|
||||||
|
%put %nrstr( %%requestPackage(bpUTiL) %%* install and load the package from the Internet; );
|
||||||
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||||
|
%put #### Example #################################################################################;
|
||||||
|
%put # #;
|
||||||
|
%put # Enabling the SAS Package Framework #;
|
||||||
|
%put # from the local directory and installing & loading #;
|
||||||
|
%put # a package with a particular version from the Internet. #;
|
||||||
|
%put # #;
|
||||||
|
%put # Assume that the `SPFinit.sas` file #;
|
||||||
|
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
|
||||||
|
%put # #;
|
||||||
|
%put # Run the following code in your SAS session: #;
|
||||||
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
||||||
|
%put %nrstr( filename packages "C:/SAS_PACKAGES"; );
|
||||||
|
%put %nrstr( %%include packages(SPFinit.sas); );
|
||||||
|
%put ;
|
||||||
|
%put %nrstr( %%requestPackage(LibnameZIP, requiredVersion=0.1.0) );
|
||||||
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||||
|
%put ##############################################################################################;
|
||||||
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
|
%GOTO ENDofrequestPackage;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
%local _rname_ _alreadyLoaded_ options_tmp ;
|
||||||
|
%let _rname_ = _requestPckg_%sysfunc(sleep(1,0.042),best1.)%sysfunc(datetime(),hex16.)_;
|
||||||
|
|
||||||
|
%let options_tmp = ls=%sysfunc(getoption(ls)) ps=%sysfunc(getoption(ps))
|
||||||
|
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
|
||||||
|
msglevel=%sysfunc(getoption(msglevel))
|
||||||
|
;
|
||||||
|
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
|
||||||
|
options source source2;
|
||||||
|
%let loadPackage = %sysevalf((1=%superq(loadPackage)),boolean);
|
||||||
|
%let replace = %sysevalf(1=%superq(replace),boolean);
|
||||||
|
|
||||||
|
%let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt)),boolean);
|
||||||
|
%let instDoc = %sysevalf(NOT(0=%superq(instDoc)),boolean);
|
||||||
|
%let backup = %sysevalf(NOT(0=%superq(backup)),boolean);
|
||||||
|
%let force = %sysevalf(NOT(0=%superq(force)),boolean);
|
||||||
|
|
||||||
|
%let ignoreDepVer = %sysevalf(NOT(0=%superq(ignoreDepVer)),boolean);
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
/* standardize input data */
|
||||||
|
length packageName $ 24 requiredVersion $ 24 sysloadedpackages $ 32767 vers verR $ 24 versN verRN 8;
|
||||||
|
packageName = scan(lowcase(symget('packageName')),1, " ");
|
||||||
|
sysloadedpackages = lowcase(symget('sysloadedpackages'));
|
||||||
|
requiredVersion = compress(symget('requiredVersion'),".","kd");
|
||||||
|
|
||||||
|
put "INFO: Requesting package " packageName @;
|
||||||
|
if requiredVersion NE " " then put "version " requiredVersion @;
|
||||||
|
put;
|
||||||
|
|
||||||
|
/* check if required version is already installed */
|
||||||
|
f = FIND(sysloadedpackages, cats(packageName,"("), "t");
|
||||||
|
if f then
|
||||||
|
do;
|
||||||
|
vers = scan(substr(sysloadedpackages,f),2,"()");
|
||||||
|
verR = requiredVersion;
|
||||||
|
|
||||||
|
array V verR vers ;
|
||||||
|
array VN verRN versN;
|
||||||
|
do over V;
|
||||||
|
VN = coalesce(input(scan(V,1,".","M"),?? best.),0)*1e8
|
||||||
|
+ coalesce(input(scan(V,2,".","M"),?? best.),0)*1e4
|
||||||
|
+ coalesce(input(scan(V,3,".","M"),?? best.),0)*1e0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/*put (_ALL_) (=/);*/
|
||||||
|
if (. <= verRN <= versN) then
|
||||||
|
do;
|
||||||
|
put / "INFO: It looks like the " packageName "package is already loaded. Enjoy!";
|
||||||
|
call symputX('_alreadyLoaded_', 1, "L");
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
put / "INFO: Searching for package file with requested version.";
|
||||||
|
end;
|
||||||
|
|
||||||
|
call symputX('packageName', packageName, "L");
|
||||||
|
call symputX('requiredVersion', requiredVersion, "L");
|
||||||
|
_error_=0;
|
||||||
|
stop;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
%if NOT &_alreadyLoaded_.0 %then
|
||||||
|
%do;
|
||||||
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||||
|
/* get list of packages */
|
||||||
|
%listPackages(work.&_rname_.,quiet=1)
|
||||||
|
|
||||||
|
/* check if minimum required version is available */
|
||||||
|
data work.&_rname_.;
|
||||||
|
set work.&_rname_.;
|
||||||
|
where tagNumber=3
|
||||||
|
and PackageZIP=lowcase("&packageName..zip")
|
||||||
|
;
|
||||||
|
|
||||||
|
length vers verR $ 24 versN verRN 8;
|
||||||
|
vers = value;
|
||||||
|
verR = symget("requiredVersion");
|
||||||
|
array V verR vers ;
|
||||||
|
array VN verRN versN;
|
||||||
|
do over V;
|
||||||
|
VN = coalesce(input(scan(V,1,".","M"),?? best.),0)*1e8
|
||||||
|
+ coalesce(input(scan(V,2,".","M"),?? best.),0)*1e4
|
||||||
|
+ coalesce(input(scan(V,3,".","M"),?? best.),0)*1e0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/*put (_ALL_) (=/);*/
|
||||||
|
if (.<= verRN <= versN) then output; /* output data only if proper version does not exist */
|
||||||
|
stop;
|
||||||
|
keep base PackageZIP;
|
||||||
|
run;
|
||||||
|
|
||||||
|
/* set global macro variable for installPackage macro*/
|
||||||
|
%global &_rname_.;
|
||||||
|
%let &_rname_.=1.0;
|
||||||
|
|
||||||
|
/* if package file does not exist or does not have required version then install package */
|
||||||
|
data _null_;
|
||||||
|
/*put nobs=;*/
|
||||||
|
length callValue $ 32767;
|
||||||
|
callValue=
|
||||||
|
'%nrstr(%installPackage(&packageName.'
|
||||||
|
!!',SFRCVN=&_rname_.'
|
||||||
|
!!',version=&requiredVersion.'
|
||||||
|
/* installPackages macro parameters*/
|
||||||
|
!!',sourcePath = &sourcePath.'
|
||||||
|
!!',mirror = &mirror.'
|
||||||
|
!!',replace = &replace.'
|
||||||
|
!!',backup = &backup.'
|
||||||
|
!!',URLuser = &URLuser.'
|
||||||
|
!!',URLpass = &URLpass.'
|
||||||
|
!!',URLoptions = &URLoptions.'
|
||||||
|
!!',loadAddCnt = &loadAddCnt.'
|
||||||
|
!!',instDoc = &instDoc.'
|
||||||
|
!!',github = &github.'
|
||||||
|
!!',githubRepo = &githubRepo.'
|
||||||
|
!!',githubToken = &githubToken.'
|
||||||
|
!!',githubTokenDebug = &githubTokenDebug.'
|
||||||
|
!!"))"
|
||||||
|
;
|
||||||
|
if NOT nobs then
|
||||||
|
do;
|
||||||
|
/*put "1) " callValue=;*/
|
||||||
|
call execute(callValue);
|
||||||
|
end;
|
||||||
|
stop;
|
||||||
|
set work.&_rname_. nobs=nobs;
|
||||||
|
run;
|
||||||
|
|
||||||
|
/* collect package installation status for upcoming checks */
|
||||||
|
%if %sysevalf(%superq(successDS)=,boolean) %then
|
||||||
|
%do;
|
||||||
|
%let successDS=work.&_rname_.; /* the name can be reused now */
|
||||||
|
data &successDS.;
|
||||||
|
length packageName $ 24 status 8;
|
||||||
|
packageName = symget('packageName');
|
||||||
|
status = &&&_rname_.;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
%else
|
||||||
|
%do;
|
||||||
|
data work.&_rname_.; /* this one is used in the recursive call so it is different name */
|
||||||
|
length packageName $ 24 status 8;
|
||||||
|
packageName = symget('packageName');
|
||||||
|
status = &&&_rname_.;
|
||||||
|
proc append base=&successDS. data=work.&_rname_.;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
/* after successful installation search for dependencies */
|
||||||
|
data _null_;
|
||||||
|
_E_=&&&_rname_.;
|
||||||
|
if NOT (1.0=_E_) then stop;
|
||||||
|
|
||||||
|
set sashelp.vextfl;
|
||||||
|
where fileref = "PACKAGES";
|
||||||
|
|
||||||
|
filevar=cats(xpath,"/&packageName..zip");
|
||||||
|
|
||||||
|
if fileexist(filevar); /* find the first package file, since it can be on lower level location */
|
||||||
|
_END_=0;
|
||||||
|
_cut_=1;
|
||||||
|
infile _dummy_ ZIP filevar=filevar member="description.sas";
|
||||||
|
|
||||||
|
do while(_E_);
|
||||||
|
/* run requestPackage(packageName,requiredVersion=) recursively for dependencies */
|
||||||
|
input;
|
||||||
|
if upcase(_infile_) =: "REQPACKAGES:" then
|
||||||
|
do;
|
||||||
|
putlog "INFO: Requesting dependencies...";
|
||||||
|
do until(NOT _cut_);
|
||||||
|
_cut_+1;
|
||||||
|
length rv $ 64 r v $ 24;
|
||||||
|
rv = dequote(strip(scan(_infile_,_cut_,":,")));
|
||||||
|
if rv =" " then _cut_=0;
|
||||||
|
else
|
||||||
|
do;
|
||||||
|
r = scan(rv,1,"()");
|
||||||
|
v = scan(rv,2,"()");
|
||||||
|
if 1=&ignoreDepVer. then v=""; /* ignore requested version and get the lates */
|
||||||
|
length callValue $ 32767;
|
||||||
|
callValue =
|
||||||
|
'%nrstr(%requestPackage(' !! strip(r)
|
||||||
|
!!',requiredVersion=' !! strip(v)
|
||||||
|
!!',loadPackage=0'
|
||||||
|
!!',successDS=&successDS.'
|
||||||
|
!!',ignoreDepVer=&ignoreDepVer.'
|
||||||
|
/* installPackages macro parameters*/
|
||||||
|
!!',sourcePath = &sourcePath.'
|
||||||
|
!!',mirror = &mirror.'
|
||||||
|
!!',replace = &replace.'
|
||||||
|
!!',backup = &backup.'
|
||||||
|
!!',URLuser = &URLuser.'
|
||||||
|
!!',URLpass = &URLpass.'
|
||||||
|
!!',URLoptions = &URLoptions.'
|
||||||
|
!!',loadAddCnt = &loadAddCnt.'
|
||||||
|
!!',instDoc = &instDoc.'
|
||||||
|
!!',github = &github.'
|
||||||
|
!!',githubRepo = &githubRepo.'
|
||||||
|
!!',githubToken = &githubToken.'
|
||||||
|
!!',githubTokenDebug = &githubTokenDebug.'
|
||||||
|
!!'))'
|
||||||
|
;
|
||||||
|
/*put "2) " callValue=;*/
|
||||||
|
call execute(strip(callValue));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if upcase(_infile_) in: ("REQPACKAGES:", "DESCRIPTION START:", "DESCRIPTION END:") then _E_=0;
|
||||||
|
end;
|
||||||
|
/*put _ALL_;*/
|
||||||
|
/*stop;*/
|
||||||
|
run;
|
||||||
|
|
||||||
|
/* execute loading if requested */
|
||||||
|
%if &loadPackage. %then
|
||||||
|
%do;
|
||||||
|
/*
|
||||||
|
proc print data=&successDS.;
|
||||||
|
run;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* check for installation errors */
|
||||||
|
data _null_;
|
||||||
|
set &successDS.;
|
||||||
|
where status < 1;
|
||||||
|
call symputX('loadPackage',0,"L");
|
||||||
|
put "ERROR: Installation of " &packageName. "package failed!";
|
||||||
|
run;
|
||||||
|
/*************/
|
||||||
|
%if ((1.0=&&&_rname_.) AND &loadPackage.) %then
|
||||||
|
%do;
|
||||||
|
options notes;
|
||||||
|
%loadPackage(&packageName.,requiredVersion=&requiredVersion.,force=&force.)
|
||||||
|
options nonotes;
|
||||||
|
%end;
|
||||||
|
/**************/
|
||||||
|
%end;
|
||||||
|
|
||||||
|
/* clean up */
|
||||||
|
%symdel &_rname_. / nowarn;
|
||||||
|
proc delete data=work.&_rname_.;
|
||||||
|
run;
|
||||||
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||||
|
%end;
|
||||||
|
options &options_tmp.;
|
||||||
|
%ENDofrequestPackage:
|
||||||
|
%mend requestPackage;
|
||||||
|
|
||||||
|
/* end of SPFinit.sas file */
|
||||||
@@ -5,7 +5,7 @@ SPFmacroName /* space separated list of names */
|
|||||||
/
|
/
|
||||||
minoperator
|
minoperator
|
||||||
secure
|
secure
|
||||||
des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260515. Run %SasPackagesFrameworkNotes(HELP) for help info.'
|
des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260602. Run %SasPackagesFrameworkNotes(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%local list N i element;
|
%local list N i element;
|
||||||
%let list=
|
%let list=
|
||||||
@@ -51,7 +51,7 @@ SasPackagesFrameworkNotes
|
|||||||
%put ### This is short help information for the `SasPackagesFrameworkNotes` macro #;
|
%put ### This is short help information for the `SasPackagesFrameworkNotes` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro prints help notes for SAS Packages Framework macros, version `20260515` #;
|
%put # Macro prints help notes for SAS Packages Framework macros, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
%macro SPFinit_intrnl_forceV7DSname(
|
%macro SPFinit_intrnl_forceV7DSname(
|
||||||
mcParam /* name of a macro parameter holding user provided data set name */
|
mcParam /* name of a macro parameter holding user provided data set name */
|
||||||
)/secure minoperator
|
)/secure minoperator
|
||||||
des='SAS Packages Framework internal macro. Executable only inside selected SPF macros. Macro generates 4GL code that forces V7 compatybility for user provided data set names. Version 20260515.';
|
des='SAS Packages Framework internal macro. Executable only inside selected SPF macros. Macro generates 4GL code that forces V7 compatybility for user provided data set names. Version 20260602.';
|
||||||
/* The macro can be called only inside a data step. */
|
/* The macro can be called only inside a data step. */
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
### Parameters:
|
### Parameters:
|
||||||
@@ -20,7 +20,7 @@ des='SAS Packages Framework internal macro. Executable only inside selected SPF
|
|||||||
data set name, the second to last chunk is SCANned for libname
|
data set name, the second to last chunk is SCANned for libname
|
||||||
(if empty then "work" is used). First character of LIB and DS
|
(if empty then "work" is used). First character of LIB and DS
|
||||||
variables is checked, if it is a digit, then underscore is added.
|
variables is checked, if it is a digit, then underscore is added.
|
||||||
At the end the LIB and DS are concatenated and casted to upper
|
At the end the LIB and DS are concatenated and upper cased.
|
||||||
case letters.
|
case letters.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@@ -91,4 +91,5 @@ des='SAS Packages Framework internal macro. Executable only inside selected SPF
|
|||||||
%end;
|
%end;
|
||||||
%mend SPFinit_intrnl_forceV7DSname;
|
%mend SPFinit_intrnl_forceV7DSname;
|
||||||
|
|
||||||
/* end of SPFinit.sas file */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*+SPFint_gnPckg_arch+*/
|
/*+SPFint_gnPckg_arch+*/
|
||||||
%macro SPFint_gnPckg_arch()/secure minoperator
|
%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 20260515.';
|
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260602.';
|
||||||
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
||||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||||
%do;
|
%do;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*+SPFint_gnPckg_markdown+*/
|
/*+SPFint_gnPckg_markdown+*/
|
||||||
%macro SPFint_gnPckg_markdown()/secure minoperator
|
%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 20260515.';
|
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260602.';
|
||||||
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
||||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -112,7 +112,7 @@ data &filesWithCodes.markdown;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
put " " / "---------------------------------------------------------------------" / " "
|
put " " / "---------------------------------------------------------------------" / " "
|
||||||
/ "*SAS package generated by SAS Package Framework, version `20260515`,*"
|
/ "*SAS package generated by SAS Package Framework, version `20260602`,*"
|
||||||
/ "*under `&sysscp.`(`&sysscpl.`) operating system,*"
|
/ "*under `&sysscp.`(`&sysscpl.`) operating system,*"
|
||||||
/ "*using SAS release: `&sysvlong4.`.*"
|
/ "*using SAS release: `&sysvlong4.`.*"
|
||||||
/ " " / "---------------------------------------------------------------------" / " ";
|
/ " " / "---------------------------------------------------------------------" / " ";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*+SPFint_gnPckg_tests+*/
|
/*+SPFint_gnPckg_tests+*/
|
||||||
%macro SPFint_gnPckg_tests()/secure minoperator
|
%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 20260515.';
|
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260602.';
|
||||||
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
/* macro picks up all macrovariables from external scope, so from the %generatePackage() macro */
|
||||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||||
%do;
|
%do;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
,nobs=0 /* technical parameter */
|
,nobs=0 /* technical parameter */
|
||||||
)
|
)
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260515. Run %splitCodeForPackage() for help info.'
|
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260602. Run %splitCodeForPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then
|
%if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Utility macro to *split* single file with SAS package code into multiple #;
|
%put # Utility macro to *split* single file with SAS package code into multiple #;
|
||||||
%put # files with separate snippets, version `20260515` #;
|
%put # files with separate snippets, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%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
|
if firstLine[j] then
|
||||||
do;
|
do;
|
||||||
put '/* File generated with help of SAS Packages Framework, version 20260515. */';
|
put '/* File generated with help of SAS Packages Framework, version 20260602. */';
|
||||||
firstLine[j]=0;
|
firstLine[j]=0;
|
||||||
end;
|
end;
|
||||||
put _infile_;
|
put _infile_;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
,verify=0
|
,verify=0
|
||||||
,quiet=0
|
,quiet=0
|
||||||
)/
|
)/
|
||||||
des='Macro to extract a bundle of SAS packages, version 20260515. Run %unbundlePackages(HELP) for help info.'
|
des='Macro to extract a bundle of SAS packages, version 20260602. Run %unbundlePackages(HELP) for help info.'
|
||||||
secure
|
secure
|
||||||
minoperator
|
minoperator
|
||||||
;
|
;
|
||||||
@@ -28,7 +28,7 @@ minoperator
|
|||||||
%put ### This is short help information for the `unbundlePackages` macro #;
|
%put ### This is short help information for the `unbundlePackages` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to *extract* SAS packages from a bundle, version `20260515` #;
|
%put # Macro to *extract* SAS packages from a bundle, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to unload SAS package, version 20260515. Run %unloadPackage() for help info.'
|
des = 'Macro to unload SAS package, version 20260602. Run %unloadPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -35,7 +35,7 @@ des = 'Macro to unload SAS package, version 20260515. Run %unloadPackage() for h
|
|||||||
%put ### This is short help information for the `unloadPackage` macro #;
|
%put ### This is short help information for the `unloadPackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to unload SAS packages, version `20260515` #;
|
%put # Macro to unload SAS packages, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -150,6 +150,9 @@ des = 'Macro to unload SAS package, version 20260515. Run %unloadPackage() for h
|
|||||||
%else utf8 ;
|
%else utf8 ;
|
||||||
;
|
;
|
||||||
%include &_PackageFileref_.(unload.sas) / &source2.;
|
%include &_PackageFileref_.(unload.sas) / &source2.;
|
||||||
|
|
||||||
|
/* clear possible unwanted multiple spaces or set to _null_ when missing */
|
||||||
|
options CMPLIB=%sysfunc(coalescec(%sysfunc(compbl(%sysfunc(getoption(CMPLIB)))),_null_));
|
||||||
%end;
|
%end;
|
||||||
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
|
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
|
||||||
filename &_PackageFileref_. clear;
|
filename &_PackageFileref_. clear;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
hashing_file() function, SAS 9.4M6 */
|
hashing_file() function, SAS 9.4M6 */
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to verify SAS package with the hash digest, version 20260515. Run %verifyPackage() for help info.'
|
des = 'Macro to verify SAS package with the hash digest, version 20260602. Run %verifyPackage(HELP) for help info.'
|
||||||
;
|
;
|
||||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||||
%do;
|
%do;
|
||||||
@@ -28,7 +28,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260515. Run %
|
|||||||
%put ### This is short help information for the `verifyPackage` macro #;
|
%put ### This is short help information for the `verifyPackage` macro #;
|
||||||
%put #-------------------------------------------------------------------------------#;
|
%put #-------------------------------------------------------------------------------#;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to verify SAS package with it hash digest, version `20260515` #;
|
%put # Macro to verify SAS package with it hash digest, version `20260602` #;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # A SAS package is a zip file containing a group #;
|
%put # A SAS package is a zip file containing a group #;
|
||||||
%put # of SAS codes (macros, functions, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
|
|||||||
+186
-19
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# SAS Packages Framework, version `20260515`
|
# SAS Packages Framework, version `20260602`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
* [the `generatePackage` macro](#generatepackage)
|
* [the `generatePackage` macro](#generatepackage)
|
||||||
* [the `extendPackagesFileref` macro](#extendpackagesfileref)
|
* [the `extendPackagesFileref` macro](#extendpackagesfileref)
|
||||||
* [the `loadPackageAddCnt` macro](#loadpackageaddcnt)
|
* [the `loadPackageAddCnt` macro](#loadpackageaddcnt)
|
||||||
|
* [the `requestPackage` macro](#requestpackage)
|
||||||
* [the `splitCodeForPackage` macro](#splitcodeforpackage)
|
* [the `splitCodeForPackage` macro](#splitcodeforpackage)
|
||||||
* [the `relocatePackage` macro](#relocatepackage)
|
* [the `relocatePackage` macro](#relocatepackage)
|
||||||
* [the `isPackagesFilerefOK` macro](#ispackagesfilerefok)
|
* [the `isPackagesFilerefOK` macro](#ispackagesfilerefok)
|
||||||
@@ -34,7 +35,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.
|
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 **`20260515`**.
|
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20260602`**.
|
||||||
|
|
||||||
**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).
|
**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 +58,7 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack
|
|||||||
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
|
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to install SAS packages, version `20260515`
|
Macro to install SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -210,7 +211,7 @@ filename packages "C:/SAS_PACKAGES";
|
|||||||
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
|
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to get help about SAS packages, version `20260515`
|
Macro to get help about SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -288,7 +289,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `loadPackage` macro <a name="loadpackage"></a>
|
## This is short help information for the `loadPackage` macro <a name="loadpackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to *load* SAS packages, version `20260515`
|
Macro to *load* SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -446,7 +447,7 @@ If created, those macros are automatically deleted when the `%unloadPackage()` m
|
|||||||
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
|
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro wrapper for the loadPackage macro, version `20260515`
|
Macro wrapper for the loadPackage macro, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -492,12 +493,13 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
%loadPackageS(SQLinDS, DFA) %* load packages content into the SAS session;
|
%loadPackageS(SQLinDS, DFA) %* load packages content into the SAS session;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
|
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to unload SAS packages, version `20260515`
|
Macro to unload SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -564,7 +566,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `listPackages` macro <a name="listpackages"></a>
|
## This is short help information for the `listPackages` macro <a name="listpackages"></a>
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to list available SAS packages, version `20260515`
|
Macro to list available SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -613,7 +615,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `verifyPackage` macro <a name="verifypackage"></a>
|
## This is short help information for the `verifyPackage` macro <a name="verifypackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to verify SAS package with it hash digest, version `20260515`
|
Macro to verify SAS package with it hash digest, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -669,7 +671,7 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
|
|||||||
## This is short help information for the `previewPackage` macro <a name="previewpackage"></a>
|
## This is short help information for the `previewPackage` macro <a name="previewpackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to get preview of a SAS packages, version `20260515`
|
Macro to get preview of a SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -738,7 +740,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `generatePackage` macro <a name="generatepackage"></a>
|
## This is short help information for the `generatePackage` macro <a name="generatepackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to generate SAS packages, version `20260515`
|
Macro to generate SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -971,7 +973,7 @@ All files have to have `.sas` extension. Other files are ignored.
|
|||||||
## This is short help information for the `extendPackagesFileref` macro <a name="extendpackagesfileref"></a>
|
## This is short help information for the `extendPackagesFileref` macro <a name="extendpackagesfileref"></a>
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to list directories pointed by 'packages' fileref, version `20260515`
|
Macro to list directories pointed by 'packages' fileref, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1013,7 +1015,7 @@ filename packages ("D:/NEW_DIR" %extendPackagesFileref()); %* add new directory;
|
|||||||
## This is short help information for the `loadPackageAddCnt` macro <a name="loadpackageaddcnt"></a>
|
## This is short help information for the `loadPackageAddCnt` macro <a name="loadpackageaddcnt"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to load *additional content* for a SAS package, version `20260515`
|
Macro to load *additional content* for a SAS package, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1103,11 +1105,176 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## This is short help information for the `requestPackage` macro <a name="requestpackage"></a>
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Macro to request (install and load) SAS packages, version `20260602`
|
||||||
|
|
||||||
|
A SAS package is a zip file containing a group
|
||||||
|
of SAS codes (macros, functions, data steps generating
|
||||||
|
data, etc.) wrapped up together and embedded inside the zip.
|
||||||
|
|
||||||
|
The `%requestPackage()` macro installs and loads the package zip
|
||||||
|
in the packages folder. The process takes care of installing or loading
|
||||||
|
dependencies too.
|
||||||
|
|
||||||
|
In case the packages fileref is a multi-directory one the first directory
|
||||||
|
will be selected as a destination.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
### Parameters:
|
||||||
|
|
||||||
|
1. `packageName ` Name of a package _without_ the zip extension, e.g., myPackage1.
|
||||||
|
Required and not null, default use case:
|
||||||
|
`%requestPackage(myPackage1)`.
|
||||||
|
If empty displays this help information.
|
||||||
|
|
||||||
|
**Installation options:**
|
||||||
|
|
||||||
|
- `requiredVersion=` *Optional.* Indicates which package version we want
|
||||||
|
to be requested, default value: `.` means "the latest".
|
||||||
|
|
||||||
|
- `sourcePath=` Location of the package, e.g. "www.some.web.page/"
|
||||||
|
Mind the "/" at the end of the path!
|
||||||
|
Current default location for packages is:
|
||||||
|
`https://github.com/SASPAC/`
|
||||||
|
Current default location for the framework is:
|
||||||
|
`https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/`
|
||||||
|
|
||||||
|
- `mirror=` Indicates which web location for packages installation is used.
|
||||||
|
Value `0` or `SASPAC` indicates:
|
||||||
|
`https://github.com/SASPAC/`
|
||||||
|
Value `1` indicates:
|
||||||
|
`https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main`
|
||||||
|
Value `2` indicates:
|
||||||
|
`https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES`
|
||||||
|
Value `3` or `PharmaForest` indicates:
|
||||||
|
`https://github.com/PharmaForest/`
|
||||||
|
Default value is `0`.
|
||||||
|
|
||||||
|
- `version=` Indicates which historical version of a package to install.
|
||||||
|
Historical version are currently available only if `mirror=0` is set.
|
||||||
|
Default value is null which means "install the latest".
|
||||||
|
When there are multiple packages to install the `version` variable
|
||||||
|
is scan sequentially.
|
||||||
|
|
||||||
|
- `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.
|
||||||
|
|
||||||
|
- `URLpass=` A password for the password protected URLs, no quotes needed.
|
||||||
|
|
||||||
|
- `URLoptions=` Options for the `sourcePath` URLs filename. Consult the SAS
|
||||||
|
documentation for the further details.
|
||||||
|
|
||||||
|
- `loadAddCnt=` *Optional.* A package zip may contain additional
|
||||||
|
content. The option indicates if it should be loaded
|
||||||
|
Default value of zero (`0`) means "No", one (`1`)
|
||||||
|
means "Yes". Content is extracted into the **packages** fileref
|
||||||
|
directory in `<packageName>_AdditionalContent` folder.
|
||||||
|
For other locations use `%loadPackageAddCnt()` macro.
|
||||||
|
|
||||||
|
- `instDoc=` *Optional.* A package may be provided with a markdown file
|
||||||
|
containing combined documentation of the package. The option
|
||||||
|
indicates if the `.md` file should be also downloaded.
|
||||||
|
Default value of zero (`0`) means "No", one (`1`) means "Yes".
|
||||||
|
|
||||||
|
- `github=` *Optional.* A name of a user or an organization in GitHub.
|
||||||
|
Allows an easy set of the search path for packages available on GitHub:
|
||||||
|
`https://github.com/<github>/<githubRepo>/raw/.../`
|
||||||
|
All characters except `[A-z0-9_.-]` are compressed.
|
||||||
|
|
||||||
|
- `githubRepo=` *Optional.* A name of a repository in GitHub.
|
||||||
|
Allows an easy set of the search path for packages available on GitHub:
|
||||||
|
`https://github.com/<github>/<githubRepo>/raw/.../`
|
||||||
|
By default lowercase name of installed package is used.
|
||||||
|
|
||||||
|
- `githubToken=` *Optional.* A fine-grained personal access token for GitHub.
|
||||||
|
When the value is non-missing it triggers GitHub API access to
|
||||||
|
private repositories. Of course the token used has to be configured
|
||||||
|
properly for the access.
|
||||||
|
Read GitHub documentation to learn how to create and setup your token:
|
||||||
|
`https://docs.github.com/en/authentication/
|
||||||
|
keeping-your-account-and-data-secure/
|
||||||
|
managing-your-personal-access-tokens
|
||||||
|
#creating-a-fine-grained-personal-access-token`
|
||||||
|
(lines break added for easier reading)
|
||||||
|
Public repos do not need authentication.
|
||||||
|
[NOTE!] This feature is experimental in this release.
|
||||||
|
|
||||||
|
**Loading options:**
|
||||||
|
|
||||||
|
- `loadPackage=` *Optional.* Indicates if requested package should be loaded too
|
||||||
|
or only installed. Dependencies are only installed.
|
||||||
|
Default value of zero (`0`) means "No", one (`1`) means "Yes".
|
||||||
|
|
||||||
|
- `force=` *Optional.* Indicates if requested package should be reloaded
|
||||||
|
even if it was already loaded to the session.
|
||||||
|
Default value of zero (`0`) means "No", one (`1`) means "Yes".
|
||||||
|
|
||||||
|
- `ignoreDepVer=` *Optional.* Indicates if packages versions in dependencies list
|
||||||
|
should be ignored and the latest available version be used.
|
||||||
|
Default value of zero (`0`) means "No", one (`1`) means "Yes".
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation`
|
||||||
|
to learn more.
|
||||||
|
Tutorials available at: `https://github.com/yabwon/HoW-SASPackages`
|
||||||
|
|
||||||
|
### Example ################################################################################
|
||||||
|
|
||||||
|
Enabling the SAS Package Framework
|
||||||
|
from the local directory and requesting (installing & loading)
|
||||||
|
the bpUTiL package from the Internet.
|
||||||
|
|
||||||
|
Assume that the `SPFinit.sas` file
|
||||||
|
is located in the "C:/SAS_PACKAGES/" folder.
|
||||||
|
|
||||||
|
Run the following code in your SAS session:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||||
|
%include packages(SPFinit.sas); %* enable the framework;
|
||||||
|
|
||||||
|
%requestPackage(bpUTiL) %* install and load the package from the Internet;
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
### Example #################################################################################
|
||||||
|
|
||||||
|
Enabling the SAS Package Framework
|
||||||
|
from the local directory and installing & loading
|
||||||
|
a package with a particular version from the Internet.
|
||||||
|
|
||||||
|
Assume that the `SPFinit.sas` file
|
||||||
|
is located in the "C:/SAS_PACKAGES/" folder.
|
||||||
|
|
||||||
|
Run the following code in your SAS session:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
filename packages "C:/SAS_PACKAGES";
|
||||||
|
%include packages(SPFinit.sas);
|
||||||
|
|
||||||
|
%requestPackage(LibnameZIP, requiredVersion=0.1.0)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
## This is short help information for the `splitCodeForPackage` macro <a name="splitcodeforpackage"></a>
|
## This is short help information for the `splitCodeForPackage` macro <a name="splitcodeforpackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Utility macro to *split* single file with SAS package code into multiple
|
Utility macro to *split* single file with SAS package code into multiple
|
||||||
files with separate snippets, version `20260515`
|
files with separate snippets, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1188,7 +1355,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `relocatePackage` macro <a name="relocatepackage"></a>
|
## This is short help information for the `relocatePackage` macro <a name="relocatepackage"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to *locally copy or move* (relocate) SAS packages, version `20260515`
|
Macro to *locally copy or move* (relocate) SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1300,7 +1467,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `isPackagesFilerefOK` macro <a name="ispackagesfilerefok"></a>
|
## This is short help information for the `isPackagesFilerefOK` macro <a name="ispackagesfilerefok"></a>
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to check if the `packages` fileref is "correct", version `20260515`
|
Macro to check if the `packages` fileref is "correct", version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1351,7 +1518,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `SasPackagesFrameworkNotes` macro <a name="saspackagesframeworknotes"></a>
|
## This is short help information for the `SasPackagesFrameworkNotes` macro <a name="saspackagesframeworknotes"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro prints help notes for SAS Packages Framework macros, version `20260515`
|
Macro prints help notes for SAS Packages Framework macros, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1401,7 +1568,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `bundlePackages` macro <a name="bundlepackages"></a>
|
## This is short help information for the `bundlePackages` macro <a name="bundlepackages"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to *create bundles* of SAS packages, version `20260515`
|
Macro to *create bundles* of SAS packages, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -1470,7 +1637,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
|||||||
## This is short help information for the `unbundlePackages` macro <a name="unbundlepackages"></a>
|
## This is short help information for the `unbundlePackages` macro <a name="unbundlepackages"></a>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Macro to *extract* SAS packages from a bundle, version `20260515`
|
Macro to *extract* SAS packages from a bundle, version `20260602`
|
||||||
|
|
||||||
A SAS package is a zip file containing a group
|
A SAS package is a zip file containing a group
|
||||||
of SAS codes (macros, functions, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
|
|||||||
+591
-87
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user