mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-06-09 03:30:22 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b5b1d18dc | |||
| 9a40f58d36 | |||
| 3f8fc96a6a | |||
| 474250c95d | |||
| b0654fe0eb | |||
| 49499a5f5a | |||
| 163dd066d5 | |||
| b2827b8d4c | |||
| 3119c4ba04 | |||
| 9e3d8c6da6 | |||
| b6e49567f9 | |||
| 9cbae7c931 | |||
| 8479a9b00b | |||
| 1dfbb52866 | |||
| 7317356ddc | |||
| c56ca48a02 | |||
| 170f36b82a | |||
| 3fccd63114 | |||
| d2ef89e2b7 | |||
| 29d1335e8a | |||
| 3906947225 | |||
| d7623839b2 | |||
| bf314227dc | |||
| d6da6d7232 | |||
| 0a3226f4d0 | |||
| fcdb3709c4 | |||
| d8f5b2ec91 | |||
| 75a1dcd287 | |||
| 3fbc55c01c |
@@ -17,7 +17,7 @@ Don't forget to give the repository a **STAR** and become [stargazer](https://gi
|
||||
|
||||
### Current version:
|
||||
|
||||
**The latest version** of the **SAS Packages Framework** is **`20260126`**.
|
||||
**The latest version** of the **SAS Packages Framework** is **`20260602**.
|
||||
|
||||
---
|
||||
|
||||
@@ -45,6 +45,11 @@ Videos presenting the SPF and packages, from various conferences and meetups (th
|
||||
- ["SAS Packages - State of the Union" - SaSensei International Dojo No. 13](https://www.youtube.com/watch?v=1GEldZYQjj0&t=0s "SID no. 13") (November 10th 2022, ~50 minutes, general overview with the latest technical details)
|
||||
- ["SAS Packages Framework - an easy code sharing medium for SAS" - Warsaw IT Days 2023](https://youtu.be/T52Omisi0dk&t=0s "Warsaw IT Days 2023") (March 31st 2023, ~60 minutes, general overview with technical details for user and developer)
|
||||
- ["SAS Package ー その共有、もっとスマートに" - SASユーザー総会 2025](https://youtu.be/4QRr7sUhO9E "SASユーザー総会2025") (September 25th 2025, ~22 minutes, general overview with the list of reasons: why is it worth to use SAS packages?)
|
||||
- ["SQLinDS and evExpress SAS packages - a tribute to SAS rock-stars!" - SAS Innovate 2026 Users Day](https://www.youtube.com/watch?v=ONSmt_l2TtU&t=6433s "SAS Innovate 2026 Users Day") (April 27th 2026, ~30 minutes, introduction to `SQLinDS` and `evExpress` SAS packages)
|
||||
- ["Introducing SAS Packages: A Modern Code Sharing Medium for SAS" - SAS Innovate 2026](https://youtu.be/0plCa_mcOMI?list=PLVBcK_IpFVi-BXicJ5ZMcXuPNQTphJuhv "SAS Innovate 2026") (April 28th 2026, ~36 minutes, general overview and itroduction to SAS packages)
|
||||
- ["Le petit SAS package - a workshop about the *Hello World* SAS package" - NJSUG 2026](https://drive.google.com/file/d/1y2_HO0tTnuiv3pk5swwETsd5Mi7EeFBP/view?usp=sharing "NJSUG 2026") (May 8ht, 2026, ~53 minutes, technical presentation about building a "Hello World"-style SAS packages from scratch)
|
||||
|
||||
|
||||
|
||||
|
||||
### Tutorials:
|
||||
@@ -57,9 +62,11 @@ Letter "D" indicates tutorial dedicated for developers and "U" materials for use
|
||||
|
||||
2) (D) Very simple ["Hello World" example](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/HelloWorldPackage.md) tutorial for developers. As a support a [walk-through video](https://youtu.be/T52Omisi0dk&t=2160s)
|
||||
|
||||
3) (D) Article and all required materials for ["My first SAS Package"](https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation/Paper_1079-2021) tutorial.
|
||||
3) (D) Video tutorial about ["Le Petit SAS Package"](https://drive.google.com/file/d/1y2_HO0tTnuiv3pk5swwETsd5Mi7EeFBP/view?usp=sharing), materials from the recording are [here](https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation/LePetitSASpackage).
|
||||
|
||||
4) (DU) Materials from Hands-on-Workshop (4+ hours) tutorial: [Share your code with SAS Packages](https://github.com/yabwon/HoW-SASPackages).
|
||||
4) (D) Article and all required materials for ["My first SAS Package"](https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation/Paper_1079-2021) tutorial.
|
||||
|
||||
5) (DU) Materials from Hands-on-Workshop (4+ hours) tutorial: [Share your code with SAS Packages](https://github.com/yabwon/HoW-SASPackages).
|
||||
It is a "zero to hero" tutorial that explains all the "bells and whistles" of using, and all the "nuts and bolts" of developing SAS packages.
|
||||
|
||||
---
|
||||
@@ -68,7 +75,7 @@ Letter "D" indicates tutorial dedicated for developers and "U" materials for use
|
||||
|
||||
### Initiative to add SAS Packages Framework to SAS Base/Viya:
|
||||
|
||||
A **SASware Ballot Idea** for adding *SAS Packages Framework* macros into Base SAS and Viya was submitted Friday, May 27th 2022. If you would like to support the idea visit this [**communities.sas.com post**](https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-SAS-Packages-Framework-to-the-SAS-Base-Viya/idi-p/815508) and up vote the idea! We have 48 likes from 46 supporters up to today (as of September 30, 2025)!
|
||||
A **SASware Ballot Idea** for adding *SAS Packages Framework* macros into Base SAS and Viya was submitted Friday, May 27th 2022. If you would like to support the idea visit this [**communities.sas.com post**](https://communities.sas.com/t5/SAS-Product-Suggestions/Add-SAS-Packages-Framework-to-the-SAS-Base-Viya/idi-p/815508) and up vote the idea! We have 49 likes from 47 supporters up to today (as of May 21, 2026)!
|
||||
|
||||
---
|
||||
|
||||
@@ -190,33 +197,37 @@ The SAS Packages Framework [(short) documentation](https://github.com/yabwon/SAS
|
||||
---
|
||||
|
||||
### Updates worth mentioning:
|
||||
**Update**\[December 31st, 2025\]**:** `%bundlePackages()` and `%unbundlePackages()` **macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241231 "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 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**\[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 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 31st, 2025\]**:** `%bundlePackages()` and `%unbundlePackages()` macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20251231 "Bundling Packages")).
|
||||
|
||||
**Update**\[October 27th, 2024\]**:** `%splitCodeForPackage()` **utility macro is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241027 "splitCodeForPackage"))**.
|
||||
**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 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**\[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 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 27th, 2024\]**:** `%splitCodeForPackage()` utility macro is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241027 "splitCodeForPackage")).
|
||||
|
||||
**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**\[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**\[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**\[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**\[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**\[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**\[November 21st, 2022\]**:** `%loadPackage()` **macro allows Cherry Picking of content (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20221121 "Cherry Picking"))**.
|
||||
**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**\[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**\[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**\[November 11th, 2021\]**:** `%extendPackagesFileref()` **macro is available**.
|
||||
**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**\[October 15th, 2020\]**:** `%previewPackage()` **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**\[September 11th, 2020\]**:** ` %loadPackageS()` and `%verifyPackage()` **macros are available**.
|
||||
**Update**\[November 11th, 2021\]**:** `%extendPackagesFileref()` macro is 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.
|
||||
|
||||
@@ -234,6 +245,7 @@ This is a list of locations where the SAS Packages Framework is used:
|
||||
- Warsaw (Poland)
|
||||
- Osaka (Japan)
|
||||
- Kyoto (Japan)
|
||||
- Boston (USA)
|
||||
|
||||
If you want to share that you are using the SPF let me know and I'll update the list.
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,735 @@
|
||||
/*
|
||||
# **Le petit SAS package**
|
||||
## a workshop about the "*Hello World*" SAS package.
|
||||
|
||||
by [**Bartosz Jabłoński**](https://linkedin.com/in/yabwon)
|
||||
|
||||
[LinkedIn](https://linkedin.com/in/yabwon)
|
||||
[GitHub](https://github.com/yabwon)
|
||||
|
||||
---
|
||||
|
||||
<!--  -->
|
||||
<img src="./le_petit_SAS_package.png" alt="Le petit SAS package" style="height:800px;"/>
|
||||
|
||||
|
||||
|
||||
---
|
||||
*/
|
||||
|
||||
/*
|
||||
---
|
||||
|
||||
## Links and locations
|
||||
|
||||
[**SAS Packages Framework**](https://github.com/yabwon/SAS_PACKAGES) - this is the place where the SAS Packages Framework lives.
|
||||
|
||||
|
||||
[**Hands on Workshop Materials**](https://github.com/yabwon/HoW-SASPackages) - this is the location for tutorial materials that will teach you how to work with SAS packages and that will take you "from 0 to hero" in SAS packages world.
|
||||
|
||||
[SPF's introductory video series](https://www.youtube.com/playlist?list=PLeMzGEImIT5eV13IGXQIgWmTFCJt_cLZG) - this is a YouTube introductory video series explaining the basics.
|
||||
|
||||
|
||||
[**SAS Packages Archive**](https://github.com/SASPAC) - some of publicly available SAS packages are located here.
|
||||
|
||||
[PharmaForest](https://github.com/PharmaForest) - pharma industry dedicated SAS packages are there.
|
||||
|
||||
---
|
||||
*/
|
||||
|
||||
options nofullstimer stimer nomprint nosymbolgen nomlogic;
|
||||
data _null_;
|
||||
put "WARNING- Welcome at NJSUG meetup!";
|
||||
run;
|
||||
|
||||
/*
|
||||
## autoexec.sas
|
||||
|
||||
I'm keeping my session setup in the `autoexec.sas` file.
|
||||
*/
|
||||
|
||||
/* this is an optional step - I basically have my session configuration in autoexec */
|
||||
/*
|
||||
%include "C:\SAS_WORK\autoexec.sas";
|
||||
|
||||
%put %workpath();
|
||||
|
||||
%put &sysLoadedPackages.;
|
||||
*/
|
||||
|
||||
/*
|
||||
But it can be replaced, for example, by something like this:
|
||||
*/
|
||||
|
||||
/* set "current working path" to WORK location */
|
||||
%put %sysfunc(DLGCDIR(%sysfunc(PATHNAME(work))));
|
||||
filename _ ".";
|
||||
filename _ list;
|
||||
filename _ clear;
|
||||
|
||||
|
||||
/* enable the SAS Packages Framework */
|
||||
filename packages "C:\SAS_WORK\SAS_PACKAGES"; /* filename packages "/sas/PACKAGES"; */
|
||||
%include packages(SPFinit.sas);
|
||||
|
||||
/* Load SAS packages */
|
||||
%loadPackageS(SQLinDS BasePlus)
|
||||
/* %loadPackageS(macroArray, DFA, GSM, bpUTiL, maxims4sas, evExpress) */
|
||||
|
||||
|
||||
resetline;
|
||||
/* List loaded packages */
|
||||
%put NOTE- SAS session with SAS Packages: &SYSLoadedPackages.;
|
||||
|
||||
%put NOTE- %workpath(); /* basePlus macro */
|
||||
|
||||
/*
|
||||
---
|
||||
|
||||
# Code types
|
||||
|
||||
SAS Packages can contain various code types, including:
|
||||
- macros,
|
||||
- FCMP functions,
|
||||
- formats & informats,
|
||||
- IML modules,
|
||||
- DS2 packages & threads,
|
||||
- CAS-L functions,
|
||||
- data sets,
|
||||
- libraries, etc.
|
||||
|
||||
Full list is provided in the [Training Materials](https://github.com/yabwon/HoW-SASPackages).
|
||||
|
||||
Today we will go with 3 basic: a macros, a function, and a format.
|
||||
*/
|
||||
|
||||
/*
|
||||
## A Macro
|
||||
|
||||
This macro prints the fox's quotes to the log.
|
||||
*/
|
||||
|
||||
resetline;
|
||||
|
||||
%macro fox(quote);
|
||||
%local n e w;
|
||||
%let n = NOTE;
|
||||
%let e = ERROR;
|
||||
%let w = WARNING;
|
||||
%if 1=%superq(quote) %then
|
||||
%do;
|
||||
%put &n.- And now here is my secret, a very simple secret:;
|
||||
%put &n.- It is only with the heart that one can see rightly%str(;);
|
||||
%put &n.- what is essential is invisible to the eye.;
|
||||
%end;
|
||||
%else
|
||||
%if 2=%superq(quote) %then
|
||||
%do;
|
||||
%put &w.- It is the time you have wasted for your rose;
|
||||
%put &w.- that makes your rose so important.;
|
||||
%put &w.- Men have forgotten this truth. But you must not forget it.;
|
||||
%put &w.- You become responsible, forever, for what you have tamed.;
|
||||
%put &w.- You are responsible for your rose...;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%put &e.- One only understands the things that one tames.;
|
||||
%put &e.- Men have no more time to understand anything.;
|
||||
%put &e.- They buy things all ready made at the shops.;
|
||||
%put &e.- But there is no shop anywhere where one can buy friendship,;
|
||||
%put &e.- and so men have no friends any more. If you want a friend, tame me...;
|
||||
%end;
|
||||
%mend fox;
|
||||
|
||||
%fox(1)
|
||||
%fox(2)
|
||||
%fox()
|
||||
|
||||
/*
|
||||
## A Format
|
||||
|
||||
This format displays values from 1 to 4 as rose's quotes.
|
||||
*/
|
||||
|
||||
resetline;
|
||||
|
||||
PROC FORMAT;
|
||||
value rose
|
||||
1="Ah! I am scarcely awake. I beg that you will excuse me. My petals are still all disarranged..."
|
||||
2="Of course I love you. It is my fault that you have not known it all the while. [...] Try to be happy..."
|
||||
3="My cold is not so bad as all that... The cool night air will do me good. I am a flower."
|
||||
4="Well, I must endure the presence of two or three caterpillars if I wish to become acquainted with the butterflies."
|
||||
other="ERROR: QUOTE OUT OF RANGE!"
|
||||
;
|
||||
RUN;
|
||||
|
||||
|
||||
data _null_;
|
||||
do i = 1 to 5;
|
||||
put "NOTE- " i rose. /;
|
||||
end;
|
||||
run;
|
||||
|
||||
/*
|
||||
## A Function
|
||||
|
||||
This FCMP function returns the prince's quote: "*If you please--draw me a sheep!*", and generates random rose's quote in the LOG.
|
||||
*/
|
||||
|
||||
resetline;
|
||||
|
||||
PROC FCMP outlib=work.little.prince;
|
||||
function prince() $ 42;
|
||||
file log;
|
||||
|
||||
length i $ 256;
|
||||
r=rand('integer',1,4);
|
||||
i = put(r, rose.);
|
||||
put @1 "RANDOM NOTE:" i /;
|
||||
|
||||
return("If you please--draw me a sheep!");
|
||||
endfunc;
|
||||
QUIT;
|
||||
|
||||
proc options option=cmplib;
|
||||
run;
|
||||
|
||||
/*
|
||||
For an FCMP function to work the `CMPLIB` option has to be updated.
|
||||
*/
|
||||
|
||||
options append=(cmplib=work.little);
|
||||
|
||||
proc options option=cmplib;
|
||||
run;
|
||||
|
||||
data _null_;
|
||||
do i = 1 to 5;
|
||||
prince=prince();
|
||||
rc=sleep(1,0.2);
|
||||
end;
|
||||
put prince=;
|
||||
run;
|
||||
|
||||
/*
|
||||
---
|
||||
|
||||
# **##############################**
|
||||
|
||||
# *If you please - build me a SAS package!*
|
||||
|
||||
# **##############################**
|
||||
|
||||
---
|
||||
*/
|
||||
|
||||
/*
|
||||
## The Directory
|
||||
|
||||
In the firs step, a directory for the package source has to be created.
|
||||
*/
|
||||
|
||||
options dlcreatedir;
|
||||
%let dir = R:\NJSUG\LePetitSASpackageDirectory;
|
||||
|
||||
libname p "&dir.";
|
||||
|
||||
libname p list;
|
||||
|
||||
/*
|
||||
## The Description
|
||||
|
||||
This is the **description** file for the package.
|
||||
|
||||
It should be named `description.sas` and located in the package source directory.
|
||||
|
||||
The colon (`:`) is a field separator and is restricted in lines of the header part.
|
||||
|
||||
The part between `DESCRIPTION START:` and `DESCRIPTION END:` is a "free format" text part where the developer provides package description, additional notes, information, etc.
|
||||
*/
|
||||
|
||||
/* **HEADER** */
|
||||
Type: Package
|
||||
Package: LePetitSASpackage
|
||||
Title: Le petit SAS package - a workshop about the "*Hello World*" SAS package.
|
||||
Version: 0.0.1
|
||||
Author: Bartosz Jablonski
|
||||
Maintainer: Bartosz Jablonski (yabwon@gmail.com)
|
||||
License: MIT
|
||||
Encoding: UTF8
|
||||
|
||||
Required: "Base SAS Software"
|
||||
ReqPackages: "SQLinDS(2.3.3)"
|
||||
|
||||
|
||||
/* **DESCRIPTION** */
|
||||
/* All the text below will be used for help notes */
|
||||
DESCRIPTION START:
|
||||
|
||||
The **LePetitSASpackage** package is an implementation
|
||||
of a little "*Hello World*" SAS package presented during
|
||||
**NJSUG** meetup.
|
||||
|
||||
It is build for fun, but also (or foremost) to show us
|
||||
how easy it is to build SAS packages.
|
||||
|
||||
*"I have serious reason to believe that the planet from which
|
||||
the little package came is the asteroid known as B612.
|
||||
This asteroid has only once been seen through the telescope.
|
||||
That was by a Turkish astronomer, in 1909."*
|
||||
|
||||
---
|
||||
|
||||
DESCRIPTION END:
|
||||
|
||||
/*
|
||||
[**NOTE**] The `SQLinDS` package is added as a dependency just to show the it can be done. In normal circumstances, when a package doesn't have dependencies the `ReqPackage:` tag is skipped. The `Required:` tag is also just for demonstration.
|
||||
*/
|
||||
|
||||
/*
|
||||
## The Directory, cont.
|
||||
*/
|
||||
|
||||
/*
|
||||
### Ordering
|
||||
|
||||
Code files have to be placed in proper type-directories. And ordered accordingly. In this case teh following setup will work.
|
||||
*/
|
||||
|
||||
/* 01_macro -> fox.sas */
|
||||
|
||||
/* 02_formats -> rose.sas */
|
||||
|
||||
/* 03_functions -> prince.sas */
|
||||
|
||||
/*
|
||||
Directories structure can be easily created by ourselves with the `dlcreatedir` option. If the option is not available, then it can be done by hand.
|
||||
*/
|
||||
|
||||
resetline;
|
||||
options dlcreatedir;
|
||||
|
||||
libname p "&dir.\01_macro";
|
||||
libname p "&dir.\02_formats";
|
||||
libname p "&dir.\03_functions";
|
||||
|
||||
libname p clear;
|
||||
|
||||
/*
|
||||
## Code Preparation
|
||||
*/
|
||||
|
||||
/*
|
||||
### Help Notes
|
||||
*/
|
||||
|
||||
/*** HELP START ***//*
|
||||
|
||||
This is a little help note.
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `%fox()` macro prints what does the fox says...
|
||||
|
||||
---
|
||||
|
||||
### Syntax: ###############################
|
||||
|
||||
~~~~~~~~~~sas
|
||||
%fox(<quote>)
|
||||
~~~~~~~~~~
|
||||
|
||||
### Arguments: ############################
|
||||
|
||||
- `quote` - The number of fox's quote.
|
||||
When missing or incorrect,
|
||||
the default quote is displayed.
|
||||
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Print quote number 1:
|
||||
~~~~~~~~~~sas
|
||||
%fox(1)
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `rose.` format prints what does the rose says...
|
||||
|
||||
---
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Print quote number 2:
|
||||
~~~~~~~~~~sas
|
||||
data _null_;
|
||||
r=2;
|
||||
put r rose.;
|
||||
run;
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `prince()` function asks to draw a sheep...
|
||||
|
||||
---
|
||||
|
||||
### Arguments: ############################
|
||||
|
||||
The function has no arguments.
|
||||
|
||||
### Dependencies: #########################
|
||||
|
||||
The `prince()` function requires
|
||||
the `rose.` format to work.
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Ask for a sheep:
|
||||
~~~~~~~~~~sas
|
||||
data _null_;
|
||||
s=prince();
|
||||
put s=;
|
||||
run;
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
/*
|
||||
### One file - one object
|
||||
*/
|
||||
|
||||
resetline;
|
||||
|
||||
/* 01_macro -> fox.sas */
|
||||
filename f "&dir.\01_macro\fox.sas";
|
||||
data _null_;
|
||||
file f;
|
||||
infile CARDS4;
|
||||
input;
|
||||
put _infile_;
|
||||
CARDS4;
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `%fox()` macro prints what does the fox says...
|
||||
|
||||
---
|
||||
|
||||
### Syntax: ###############################
|
||||
|
||||
~~~~~~~~~~sas
|
||||
%fox(<quote>)
|
||||
~~~~~~~~~~
|
||||
|
||||
### Arguments: ############################
|
||||
|
||||
- `quote` - The number of fox's quote.
|
||||
When missing or incorrect,
|
||||
the default quote is displayed.
|
||||
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Print quote number 1:
|
||||
~~~~~~~~~~sas
|
||||
%fox(1)
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
%macro fox(quote);
|
||||
%local n e w;
|
||||
%let n = NOTE;
|
||||
%let e = ERROR;
|
||||
%let w = WARNING;
|
||||
%if 1=%superq(quote) %then
|
||||
%do;
|
||||
%put &n.- And now here is my secret, a very simple secret:;
|
||||
%put &n.- It is only with the heart that one can see rightly%str(;);
|
||||
%put &n.- what is essential is invisible to the eye.;
|
||||
%end;
|
||||
%else
|
||||
%if 2=%superq(quote) %then
|
||||
%do;
|
||||
%put &w.- It is the time you have wasted for your rose;
|
||||
%put &w.- that makes your rose so important.;
|
||||
%put &w.- Men have forgotten this truth. But you must not forget it.;
|
||||
%put &w.- You become responsible, forever, for what you have tamed.;
|
||||
%put &w.- You are responsible for your rose...;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%put &e.- One only understands the things that one tames.;
|
||||
%put &e.- Men have no more time to understand anything.;
|
||||
%put &e.- They buy things all ready made at the shops.;
|
||||
%put &e.- But there is no shop anywhere where one can buy friendship,;
|
||||
%put &e.- and so men have no friends any more. If you want a friend, tame me...;
|
||||
%end;
|
||||
%mend fox;
|
||||
;;;;
|
||||
run;
|
||||
|
||||
/* 02_formats -> rose.sas */
|
||||
filename f "&dir.\02_formats\rose.sas";
|
||||
data _null_;
|
||||
file f;
|
||||
infile CARDS4;
|
||||
input;
|
||||
put _infile_;
|
||||
CARDS4;
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `rose.` format prints what does the rose says...
|
||||
|
||||
---
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Print quote number 2:
|
||||
~~~~~~~~~~sas
|
||||
data _null_;
|
||||
r=2;
|
||||
put r rose.;
|
||||
run;
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
value rose
|
||||
1="Ah! I am scarcely awake. I beg that you will excuse me. My petals are still all disarranged..."
|
||||
2="Of course I love you. It is my fault that you have not known it all the while. [...] Try to be happy..."
|
||||
3="My cold is not so bad as all that... The cool night air will do me good. I am a flower."
|
||||
4="Well, I must endure the presence of two or three caterpillars if I wish to become acquainted with the butterflies."
|
||||
other="ERROR: QUOTE OUT OF RANGE!"
|
||||
;
|
||||
;;;;
|
||||
run;
|
||||
|
||||
/* 03_functions -> prince.sas */
|
||||
filename f "&dir.\03_functions\prince.sas";
|
||||
data _null_;
|
||||
file f;
|
||||
infile CARDS4;
|
||||
input;
|
||||
put _infile_;
|
||||
CARDS4;
|
||||
/*** HELP START ***//*
|
||||
|
||||
The `prince()` function asks to draw a sheep...
|
||||
|
||||
---
|
||||
|
||||
### Arguments: ############################
|
||||
|
||||
The function has no arguments.
|
||||
|
||||
### Dependencies: #########################
|
||||
|
||||
The `prince()` function requires
|
||||
the `rose.` format to work.
|
||||
|
||||
### Example: ##############################
|
||||
|
||||
Ask for a sheep:
|
||||
~~~~~~~~~~sas
|
||||
data _null_;
|
||||
s=prince();
|
||||
put s=;
|
||||
run;
|
||||
~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
*//*** HELP END ***/
|
||||
|
||||
function prince() $ 42;
|
||||
file log;
|
||||
|
||||
length i $ 256;
|
||||
r=rand('integer',1,4);
|
||||
i = put(r, rose.);
|
||||
put @1 "RANDOM NOTE:" i /;
|
||||
|
||||
return("If you please--draw me a sheep!");
|
||||
endfunc;
|
||||
;;;;
|
||||
run;
|
||||
|
||||
/*
|
||||
### Tests
|
||||
|
||||
Tests are optionally available, i.e., they are available if the `XCMD` option is on.
|
||||
|
||||
One test of loading a package is always automatically executed. All other tests are developer's job to do.
|
||||
|
||||
The SPF automatically points to the package location for tests, developer doesn't have to worry.
|
||||
*/
|
||||
|
||||
resetline;
|
||||
options dlcreatedir;
|
||||
|
||||
libname p "&dir.\99_test";
|
||||
libname p clear;
|
||||
|
||||
/* 99_test -> test_success.sas */
|
||||
filename f "&dir.\99_test\test_success.sas";
|
||||
data _null_;
|
||||
file f;
|
||||
infile CARDS4;
|
||||
input;
|
||||
put _infile_;
|
||||
CARDS4;
|
||||
%put testing macro:;
|
||||
%fox(1)
|
||||
%fox(2)
|
||||
%fox()
|
||||
|
||||
data _null_;
|
||||
put "Testing format:";
|
||||
do i = 1 to 4;
|
||||
put "NOTE- " i rose. /;
|
||||
end;
|
||||
run;
|
||||
|
||||
data _null_;
|
||||
put "Testing function:";
|
||||
do i = 1 to 5;
|
||||
prince=prince();
|
||||
rc=sleep(1,0.2);
|
||||
end;
|
||||
put;
|
||||
run;
|
||||
;;;;
|
||||
run;
|
||||
|
||||
/* 99_test -> test_fail_e1w0.sas */
|
||||
filename f "&dir.\99_test\test_fail_e1w0.sas";
|
||||
data _null_;
|
||||
file f;
|
||||
infile CARDS4;
|
||||
input;
|
||||
put _infile_;
|
||||
CARDS4;
|
||||
data _null_;
|
||||
put "Testing format (should print error):";
|
||||
do i = 5;
|
||||
put i rose. /;
|
||||
end;
|
||||
run;
|
||||
;;;;
|
||||
run;
|
||||
|
||||
/*
|
||||
## Generate Package
|
||||
|
||||
In this session we already have the SPF enabled, but in the development process you have to point the location for packages and enable the framework.
|
||||
*/
|
||||
|
||||
filename packages "C:\SAS_WORK\SAS_PACKAGES";
|
||||
%include packages(SPFinit.sas);
|
||||
|
||||
/*
|
||||
Options can be easily reminded (in he LOG) by calling the macro with the `HELP` keyword.
|
||||
*/
|
||||
|
||||
%generatePackage(HELP)
|
||||
|
||||
resetline;
|
||||
|
||||
/* Generate Package */
|
||||
|
||||
%generatePackage(
|
||||
R:\NJSUG\LePetitSASpackageDirectory
|
||||
,markdownDoc=1
|
||||
,packages=C:\SAS_WORK\SAS_PACKAGES
|
||||
)
|
||||
|
||||
/* REMEMBER! Always check the log.*/
|
||||
|
||||
/*
|
||||
# --The End--
|
||||
|
||||
The package is ready! It can be shared with other SAS programmers now.
|
||||
|
||||
---
|
||||
*/
|
||||
|
||||
/*
|
||||
#
|
||||
|
||||
##
|
||||
|
||||
###
|
||||
|
||||
---
|
||||
|
||||
# Start New SAS Session
|
||||
|
||||
In a brand new SAS session try out how the created package works.
|
||||
*/
|
||||
|
||||
/* create directory for SAS packages */
|
||||
|
||||
resetline;
|
||||
options dlcreatedir;
|
||||
libname p "R:\NJSUG\trySASpackages";
|
||||
libname p clear;
|
||||
|
||||
/* install the SAS Packages Framework and the SQLinDS package */
|
||||
|
||||
filename packages "R:\NJSUG\trySASpackages";
|
||||
|
||||
filename SPFinit url "https://bit.ly/SPFinit";
|
||||
%include SPFinit; /* enable the framework */
|
||||
filename SPFinit clear;
|
||||
|
||||
%installPackage(SPFinit SQLinDS)
|
||||
|
||||
/*
|
||||
Copy, manually for now, the LePetitSASpackage (the zip file) to packages directory.
|
||||
*/
|
||||
|
||||
/* enable the SPF and load the LePetitSASpackage */
|
||||
|
||||
filename packages "R:\NJSUG\trySASpackages";
|
||||
%include packages(SPFinit.sas);
|
||||
%listPackages()
|
||||
|
||||
|
||||
%loadPackage(LePetitSASpackage)
|
||||
|
||||
/* try it */
|
||||
%fox(1)
|
||||
%fox(2)
|
||||
|
||||
%put %sysfunc(prince());
|
||||
|
||||
data _null_;
|
||||
p = prince();
|
||||
put p=;
|
||||
run;
|
||||
|
||||
/*
|
||||
---
|
||||
*/
|
||||
|
||||
/*
|
||||
---
|
||||
*/
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
@@ -8,7 +8,7 @@
|
||||
,packagesRef=packages
|
||||
,ods= /* data set for report file */
|
||||
)/
|
||||
des='Macro to create a bundle of SAS packages, version 20260126. 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
|
||||
;
|
||||
|
||||
@@ -25,7 +25,7 @@ secure minoperator
|
||||
%put ### This is short help information for the `bundlePackages` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *create bundles* of SAS packages, version `20260126` #;
|
||||
%put # Macro to *create bundles* of 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 #;
|
||||
@@ -62,7 +62,7 @@ secure minoperator
|
||||
%put # - `packagesRef=` *Optional.* Fileref to location of packages for the #;
|
||||
%put # bundle. Default value is `packages`. #;
|
||||
%put # #;
|
||||
%put # - `ods=` *Optional.* Name of SAS data set for the report. #;
|
||||
%put # - `ods=` *Optional.* V7 style name of SAS data set for report. #;
|
||||
%put # #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
@@ -126,6 +126,13 @@ secure minoperator
|
||||
%let datetime = %sysfunc(datetime());
|
||||
%let reportFile = WORK.tmpbundlefile%sysfunc(int(&datetime.), b8601dt15.)_;
|
||||
|
||||
%if NOT %sysevalf(%superq(ods)=,BOOLEAN) %then %do;
|
||||
data _null_; /* verify ods= value */
|
||||
%SPFinit_intrnl_forceV7DSname(ods);
|
||||
call symputX("ods",ods,"L");
|
||||
run;
|
||||
%end;
|
||||
|
||||
data _null_ %if %superq(ods) NE %then %do; &ods. %end;
|
||||
%else %do; &reportFile.1 %end;
|
||||
;
|
||||
@@ -399,8 +406,8 @@ put "INFO: The " bundleName "bundle creation ended.";
|
||||
;
|
||||
format datetime e8601dt.;
|
||||
output
|
||||
%if %superq(ods) NE %then %do; %scan(&ods.,1,()) %end;
|
||||
%else %do; &reportFile.1 %end;
|
||||
%if %superq(ods) NE %then %do; &ods. %end;
|
||||
%else %do; &reportFile.1 %end;
|
||||
;
|
||||
put " ";
|
||||
rc=sleep(1,1);
|
||||
@@ -408,13 +415,13 @@ stop;
|
||||
run;
|
||||
|
||||
title2 "Summary of the bundle file";;
|
||||
proc print
|
||||
data= %if %superq(ods) NE %then %do; %scan(&ods.,1,()) %end;
|
||||
%else %do; &reportFile.1 %end;
|
||||
noObs label;
|
||||
proc print noObs label
|
||||
data= %if %superq(ods) NE %then %do; &ods. %end;
|
||||
%else %do; &reportFile.1 %end;
|
||||
;
|
||||
var bundleName datetime BundleSHA256 path;
|
||||
run;
|
||||
%if %superq(ods) NE %then %do; %put INFO: Report file: %scan(&ods.,1,()); %end;
|
||||
%if %superq(ods) NE %then %do; %put INFO: Report file: &ods.; %end;
|
||||
%else %do; proc delete data=&reportFile.1; run; %end;
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
when empty the "packages" value is used */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20260126. 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
|
||||
@@ -22,7 +22,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20260126
|
||||
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20260126` #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Macro to generate SAS packages.
|
||||
|
||||
Version 20260126
|
||||
Version 20260602
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -53,7 +53,7 @@
|
||||
when empty takes buildLocation */
|
||||
)/ secure minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to generate SAS packages, version 20260126. 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
|
||||
%do;
|
||||
@@ -68,7 +68,7 @@ des = 'Macro to generate SAS packages, version 20260126. Run %generatePackage()
|
||||
%put ### This is short help information for the `generatePackage` macro #;
|
||||
%put #------------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to generate SAS packages, version `20260126` #;
|
||||
%put # Macro to generate 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 #;
|
||||
@@ -444,10 +444,10 @@ options NOquotelenmax NOstimer NOfullstimer;
|
||||
*/
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* test if version is a number */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
v = "&packageVersion.";
|
||||
version = coalesce(input(scan(v,1,".","M"), ?? best32.),0)*1e8
|
||||
+ coalesce(input(scan(v,2,".","M"), ?? best32.),0)*1e4
|
||||
@@ -950,7 +950,7 @@ title6 "MD5 hashed fileref of package lowcase name: &_PackageFileref_.";
|
||||
title&_titleNumber_. "Package ZIP file location is: &buildLocation.";
|
||||
%end;
|
||||
|
||||
footnote1 "SAS Packages Framework, version 20260126";
|
||||
footnote1 "SAS Packages Framework, version 20260602";
|
||||
|
||||
proc print
|
||||
data = &filesWithCodes.(drop=base build folderRef fileRef rc folderid _abort_ fileId additionalContent)
|
||||
@@ -1775,7 +1775,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.;'''
|
||||
/ ' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"'
|
||||
/ ' !! '' %put with the SAS Packages Framework version 20260126.;'''
|
||||
/ ' !! '' %put with the SAS Packages Framework version 20260602.;'''
|
||||
/ ' !! '' %put ****************************************************************************;'''
|
||||
/ ' !! '' %GOTO theEndOfTheMacro;'''
|
||||
/ ' !! '' %end;''' ;
|
||||
@@ -1939,7 +1939,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.; '' !!' /
|
||||
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !! ' /
|
||||
''' %put with the SAS Packages Framework version 20260126.; '' !! ' /
|
||||
''' %put with the SAS Packages Framework version 20260602.; '' !! ' /
|
||||
''' %put ****************************************************************************; '' !! ' /
|
||||
''' %GOTO theEndOfTheMacro; '' !! ' /
|
||||
''' %end; '' !! ' /
|
||||
@@ -2179,6 +2179,7 @@ data _null_;
|
||||
packageRequired = quote(strip(packageRequired));
|
||||
%end;
|
||||
|
||||
put '%if (%str(*)=%superq(cherryPick)) %then %do;'; /* cherryPick 4 ---*/
|
||||
put "proc fcmp outlib = work.&packageName.fcmp.packagemeta ; "
|
||||
/ " function &packageName.META(meta $) $ 32767;"
|
||||
/ ' m = char(upcase(meta),1);'
|
||||
@@ -2211,7 +2212,7 @@ data _null_;
|
||||
/ '%if %superq(meta) = %then %return;'
|
||||
/ '%do;%qsysfunc(strip(%qsysfunc(' "&packageName.META" '&syspbuff.)))%end;'
|
||||
/ '%mend;' / /;
|
||||
|
||||
put '%end;'; /* cherryPick 4 ---*/
|
||||
/*==========================================================================================*/
|
||||
|
||||
/* list cmplib for functions and fmtsearch for formats*/
|
||||
@@ -2271,7 +2272,7 @@ data _null_;
|
||||
|
||||
put 'options NOTES;'
|
||||
/ '%put NOTE- ;'
|
||||
/ '%put NOTE: '"Loading package &packageName., version "'%'"&packageName.META(V), license &packageLicense.;"
|
||||
/ '%put NOTE: '"Loading package &packageName., version &packageVersion., license &packageLicense.;"
|
||||
/ '%put NOTE- *** END ***;' /;
|
||||
|
||||
put 'options &temp_noNotes_etc.;'
|
||||
@@ -2810,7 +2811,7 @@ data _null_;
|
||||
%end;
|
||||
|
||||
put 'put " " / @3 "---------------------------------------------------------------------" / " ";'
|
||||
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260126`*";'
|
||||
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20260602`*";'
|
||||
/ "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';"
|
||||
/ "put @3 '*using SAS release: `&sysvlong4.`.*';"
|
||||
/ 'put " " / @3 "---------------------------------------------------------------------";';
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to get help about SAS package, version 20260126. 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
|
||||
%do;
|
||||
@@ -43,7 +43,7 @@ des = 'Macro to get help about SAS package, version 20260126. Run %helpPackage()
|
||||
%put ### This is short help information for the `helpPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get help about SAS packages, version `20260126` #;
|
||||
%put # Macro to get help about 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 #;
|
||||
@@ -133,18 +133,20 @@ des = 'Macro to get help about SAS package, version 20260126. Run %helpPackage()
|
||||
|
||||
%local _PackageFileref_;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
length packageName $ 32;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
exists + fileexist(catx("/", p, cats(packageName,".&zip.")));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
|
||||
+251
-19
@@ -1,5 +1,5 @@
|
||||
/*+installPackage+*/
|
||||
/* Macros to install SAS packages, version 20260126 */
|
||||
/* Macros to install SAS packages, version 20260602 */
|
||||
/* A SAS package is a zip file containing a group of files
|
||||
with SAS code (macros, functions, data steps generating
|
||||
data, etc.) wrapped up together and %INCLUDEed by
|
||||
@@ -13,6 +13,7 @@
|
||||
, mirror = 0 /* indicates which location for package source should be used */
|
||||
, version = /* indicates which version of a package to install */
|
||||
, replace = 1 /* 1 = replace if the package already exist, 0 = otherwise */
|
||||
, backup = 0 /* 1 = before replacing make a copy if the package already exist, 0 = do nothing */
|
||||
, URLuser = /* user name for the password protected URLs */
|
||||
, URLpass = /* password for the password protected URLs */
|
||||
, URLoptions = /* options for the `sourcePath` URLs */
|
||||
@@ -22,11 +23,14 @@
|
||||
default is 0 - means No, 1 means Yes */
|
||||
, 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 */
|
||||
, 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 */
|
||||
)
|
||||
/secure
|
||||
minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to install SAS package, version 20260126. 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
|
||||
%do;
|
||||
@@ -41,7 +45,7 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%put ### This is short help information for the `installPackage` macro #;
|
||||
%put #--------------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to install SAS packages, version `20260126` #;
|
||||
%put # Macro to install 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 #;
|
||||
@@ -90,8 +94,15 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%put # When there are multiple packages to install the `version` variable #;
|
||||
%put # is scan sequentially. #;
|
||||
%put # #;
|
||||
%put # - `replace=` With default value of `1`, it causes existing package file 0 #;
|
||||
%put # to be replaced by new downloaded file. #;
|
||||
%put # - `replace=` When set to `1` and a package file exists, it forces the package #;
|
||||
%put # file replacement by the new downloaded file. #;
|
||||
%put # It is a binary indicator ('0' or '1'). Default value is `1`. #;
|
||||
%put # #;
|
||||
%put # - `backup=` When set to `1` and a package file exists, it creates a backup copy #;
|
||||
%put # of the package file. The backup copy is created with a suffix of the #;
|
||||
%put # following format: `_BCKP_yyyymmddJJMMSS`. #;
|
||||
%put # If `replace=0` then `backup` is set to `0`. #;
|
||||
%put # It is a binary indicator ('0' or '1'). Default value is `0`. #;
|
||||
%put # #;
|
||||
%put # - `URLuser=` A user name for the password protected URLs, no quotes needed. #;
|
||||
%put # #;
|
||||
@@ -119,9 +130,27 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%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>/<packagename>/raw/.../` #;
|
||||
%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 #--------------------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
||||
@@ -191,18 +220,24 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
|
||||
/* in case the 'packages' fileref is multi-directory the first directory will be selected as a destination */
|
||||
data _null_;
|
||||
if "(" =: pathname("packages") then
|
||||
/* get the firstPackagesPath */
|
||||
call symputX("firstPackagesPath", dequote(kscanx(pathname("packages"), 1, "()", "QS")), "L");
|
||||
length p $ 32767;
|
||||
p = pathname("packages");
|
||||
if "(" =: p then
|
||||
/* get the firstPackagesPath */
|
||||
call symputX("firstPackagesPath", dequote(kscanx(p, 1, "()", "QS")), "L");
|
||||
else
|
||||
call symputX("firstPackagesPath", pathname("packages"), "L");
|
||||
call symputX("firstPackagesPath", p, "L");
|
||||
run;
|
||||
|
||||
%let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt)));
|
||||
%let instDoc = %sysevalf(NOT(0=%superq(instDoc)));
|
||||
%let backup = %sysevalf(NOT(0=%superq(backup)));
|
||||
|
||||
%let replace = %sysevalf(1=%superq(replace));
|
||||
|
||||
/* in case you do not replace then you also do not do a backup */
|
||||
%if 0=&replace. %then %let backup = 0;
|
||||
|
||||
%if %superq(sourcePath)= %then
|
||||
%do;
|
||||
%local SPFinitMirror SPFinitMirrorMD;
|
||||
@@ -259,7 +294,7 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
/* ingnore version support for pharmaForest for now */
|
||||
/* ingnore version support for github for now */
|
||||
%let github = %sysfunc(compress(%superq(github),%str(,.-),KAD));
|
||||
%put INFO: GitHub location used is: %superq(github).;
|
||||
%let sourcePath = https://github.com/&github./; /*users content*/
|
||||
@@ -303,6 +338,9 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%Let PackagesInstalledSussess=;
|
||||
%let PackagesInstalledFail=;
|
||||
|
||||
|
||||
|
||||
|
||||
%do i = 1 %to %sysfunc(countw(&packagesNames., , S));
|
||||
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
|
||||
%local packageName packageSubDir vers versA versB;
|
||||
@@ -320,14 +358,22 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%end;
|
||||
%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 *****************************************;
|
||||
%local in out inMD outMD _IOFileref_;
|
||||
%local in out inMD outMD bckp_ref bckplabel _IOFileref_;
|
||||
data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run;
|
||||
%let in = i&_IOFileref_.;
|
||||
%let out = o&_IOFileref_.;
|
||||
%let inMD = j&_IOFileref_.;
|
||||
%let outMD = u&_IOFileref_.;
|
||||
|
||||
%let bckp_ref = b&_IOFileref_.;
|
||||
%let bckplabel = _BCKP_%sysfunc(compress(%sysfunc(datetime(),b8601dt.),,KD));
|
||||
|
||||
/* %let in = i%sysfunc(md5(&packageName.),hex7.); */
|
||||
/* %let out = o%sysfunc(md5(&packageName.),hex7.); */
|
||||
|
||||
@@ -340,7 +386,7 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.md;
|
||||
%end;
|
||||
%if %superq(mirror) > 1 %then
|
||||
%if NOT (%superq(mirror) in (0 1 4)) %then
|
||||
%put %str( )Mirror %superq(mirror) does not support versioning.;
|
||||
|
||||
/* source code file */
|
||||
@@ -363,12 +409,12 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
%do;
|
||||
%if %superq(mirror) IN (0 3 4) %then /* SASPAC or PharmaForest or an arbitrary GitHub repo */
|
||||
%do;
|
||||
%let packageSubDir = %sysfunc(lowcase(&packageName.))/raw/main/;
|
||||
%let packageSubDir = &githubRepoLocal./raw/main/;
|
||||
|
||||
%if %superq(vers) ne %then
|
||||
%do;
|
||||
/*%let packageSubDir = %sysfunc(lowcase(&packageName.))/main/hist/&version./;*/
|
||||
%let packageSubDir = %sysfunc(lowcase(&packageName.))/raw/&vers./;
|
||||
%let packageSubDir = &githubRepoLocal./raw/&vers./;
|
||||
%end;
|
||||
%end;
|
||||
%else
|
||||
@@ -405,6 +451,13 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
/* copy the file byte-by-byte */
|
||||
%local installationRC;
|
||||
%let installationRC=1;
|
||||
|
||||
%if (%superq(githubToken)= )
|
||||
OR
|
||||
(%upcase(&packageName.) in (SPFINIT SASPACKAGEFRAMEWORK SASPACKAGESFRAMEWORK))
|
||||
%then
|
||||
%do;
|
||||
/* public repo, location with URL access, or SPFinit */
|
||||
data _null_;
|
||||
length filein fileinMD 8
|
||||
out_path in_path out_pathMD in_pathMD rcTXT $ 4096
|
||||
@@ -451,12 +504,34 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
do;
|
||||
if symgetn("replace")=1 then
|
||||
do;
|
||||
rc = 0;
|
||||
put @2 "The following file will be replaced during "
|
||||
/ @2 "installation of the &packageName. package: "
|
||||
/ @5 out_path;
|
||||
rc = FDELETE(out_ref);
|
||||
rc = FCOPY(in_ref, out_ref);
|
||||
rcTXT=sysmsg();
|
||||
|
||||
/* backup package file */
|
||||
if symgetn("backup")=1 then
|
||||
do;
|
||||
length bckp_ref $ 8 bckplabel $ 32;
|
||||
bckplabel = "&bckplabel.";
|
||||
rc = filename(bckp_ref, cats(out_path, bckplabel), "DISK", "recfm=N lrecl=1");
|
||||
put / @2 "The following backup file will be created:"
|
||||
/ @5 out_path +(-1) bckplabel;
|
||||
rc + FCOPY(out_ref, bckp_ref);
|
||||
rcTXT=sysmsg();
|
||||
if rc then put "WARNING: [&packageName.] Backup failed... ";
|
||||
_N_ = filename(bckp_ref);
|
||||
end;
|
||||
|
||||
/* replace package file */
|
||||
if rc=0 then
|
||||
do;
|
||||
rc + FDELETE(out_ref);
|
||||
if 0=rc then
|
||||
rc + FCOPY(in_ref, out_ref);
|
||||
rcTXT=sysmsg();
|
||||
if rc then put "WARNING: [&packageName.] Installation failed... ";
|
||||
end;
|
||||
end;
|
||||
else
|
||||
do;
|
||||
@@ -484,6 +559,9 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
end;
|
||||
else if 1=FEXIST(out_refMD) and 1=symgetn("replace") then
|
||||
do;
|
||||
if symgetn("backup")=1 then
|
||||
put @2 "No backup done for documentation file.";
|
||||
|
||||
rcMD = FDELETE(out_refMD);
|
||||
if rcMD=0 then
|
||||
rcMD2 = FCOPY(in_refMD, out_refMD);
|
||||
@@ -495,7 +573,161 @@ des = 'Macro to install SAS package, version 20260126. Run %%installPackage() fo
|
||||
put @2 "Package documentation in markdown format not available." ; /* / out_pathMD / in_pathMD;*/
|
||||
end;
|
||||
run;
|
||||
|
||||
/************************************************************************************************************/
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
/* when githubToken= is not null then a "private repo" case is assumed */
|
||||
/* except for SPFinit.sas that is always installed from SAS_PACKAGES public repo */
|
||||
|
||||
%put [NOTE!] This feature is experimental in this release!;
|
||||
%local ref notRunHTTP;
|
||||
%let notRunHTTP=1;
|
||||
%if %superq(vers)= %then %let ref = main;
|
||||
%else %let ref = &vers.;
|
||||
|
||||
%if NOT(%superq(githubTokenDebug) in (0 1 2 3)) %then %let githubTokenDebug = 0;
|
||||
|
||||
%if %sysfunc(FEXIST(&out.)) = 0 %then
|
||||
%do;
|
||||
%put %str( )Installing the &packageName. package;
|
||||
%put %str( )in the &firstPackagesPath. directory.;
|
||||
%let notRunHTTP=0;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%if 1=&replace. %then
|
||||
%do;
|
||||
%put %str( )The following file will be replaced during;
|
||||
%put %str( )installation of the &packageName. package:;
|
||||
%put %str( )%sysfunc(pathname(&out.));
|
||||
|
||||
/* backup package file */
|
||||
%if 1=&backup. %then
|
||||
%do;
|
||||
filename &bckp_ref. "&firstPackagesPath./%sysfunc(lowcase(&packageName.)).zip&bckplabel." recfm=N lrecl=1;
|
||||
|
||||
%put %str( )The following backup file will be created:;
|
||||
%put %str( )%sysfunc(pathname(&bckp_ref.));
|
||||
|
||||
%let notRunHTTP = %sysfunc(FCOPY(&out., &bckp_ref.));
|
||||
%put %sysfunc(sysmsg());
|
||||
|
||||
filename &bckp_ref. clear;
|
||||
|
||||
%let notRunHTTP = %sysevalf(¬RunHTTP. + %sysfunc(FDELETE(&out.)));
|
||||
%put %sysfunc(sysmsg());
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%let notRunHTTP = %sysfunc(FDELETE(&out.));
|
||||
%put %sysfunc(sysmsg());
|
||||
%end;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%put %str( )The following file will NOT be replaced:;
|
||||
%put %str( )%sysfunc(pathname(&out.));
|
||||
%let notRunHTTP = 1;
|
||||
%end;
|
||||
%end;
|
||||
|
||||
%if %superq(githubToken) NE %qsysfunc(compress(%superq(githubToken),%str( _),KAD)) %then
|
||||
%do;
|
||||
%put WARNING: The githubToken= parameter contains illegal symbols;
|
||||
%put WARNING- Allowed symbols are letters A to Z and a to z, digits 0 to 9, and underscore(_);
|
||||
%put WARNING- Verify your token. Installation aborted.;
|
||||
%let notRunHTTP = 1;
|
||||
%end;
|
||||
|
||||
%if ¬RunHTTP.=0 %then
|
||||
%do;
|
||||
%put %str( )URL called by PROC HTTP is:;
|
||||
%put %str( )"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref.";
|
||||
%put %str( )Headers:;
|
||||
%put %str( )Accept=application/vnd.github.raw+json;
|
||||
%put %str( )X-GitHub-Api-Version=2026-03-10;
|
||||
%put %str( )Authorization=Bearer *****************;
|
||||
%put %str( );
|
||||
|
||||
|
||||
/* proc http setup based on:
|
||||
https://docs.github.com/en/rest/repos/contents?apiVersion=2026-03-10#get-repository-content
|
||||
*/
|
||||
proc http
|
||||
method="GET"
|
||||
out=&out.
|
||||
URL=
|
||||
"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).zip?ref=&ref."
|
||||
CLEAR_CACHE
|
||||
;
|
||||
headers
|
||||
"Accept"="application/vnd.github.raw+json"
|
||||
"X-GitHub-Api-Version"="2026-03-10"
|
||||
"Authorization"="Bearer &githubToken."
|
||||
;
|
||||
debug level=&githubTokenDebug.;
|
||||
run;
|
||||
|
||||
%if %sysfunc(FEXIST(&out.)) AND &SYS_PROCHTTP_STATUS_CODE.=200 %then
|
||||
%do;
|
||||
%let installationRC=0;
|
||||
%put %str( )Done with return code rc=0 (zero = success);
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%let installationRC=1;
|
||||
%put %str( )Done with return code rc=&SYS_PROCHTTP_STATUS_CODE. (zero = success);
|
||||
%put %str( )Message: &SYS_PROCHTTP_STATUS_PHRASE.;
|
||||
%end;
|
||||
|
||||
%let notRunHTTP=1;
|
||||
%if 1=&instDoc. AND 0=&installationRC. %then
|
||||
%do;
|
||||
%if %sysfunc(FEXIST(&outMD.)) = 0 %then
|
||||
%do;
|
||||
%put %str( )Package documentation installation on request:;
|
||||
%let notRunHTTP = 0;
|
||||
%end;
|
||||
%else %if 1=&replace. %then
|
||||
%do;
|
||||
%if 1=&backup. %then %put %str( )No backup done for documentation file.;
|
||||
%put %str( )Package documentation installation on demand:;
|
||||
%let notRunHTTP = %sysfunc(FDELETE(&outMD.));
|
||||
%if ¬RunHTTP. %then %put %sysfunc(sysmsg());
|
||||
%end;
|
||||
|
||||
%if ¬RunHTTP.=0 %then
|
||||
%do;
|
||||
proc http
|
||||
method="GET"
|
||||
out=&outMD.
|
||||
URL=
|
||||
"https://api.github.com/repos/&github./&githubRepoLocal./contents/%sysfunc(lowcase(&packageName.)).md?ref=&ref."
|
||||
CLEAR_CACHE
|
||||
;
|
||||
headers
|
||||
"Accept"="application/vnd.github.raw+json"
|
||||
"X-GitHub-Api-Version"="2026-03-10"
|
||||
"Authorization"="Bearer &githubToken."
|
||||
;
|
||||
debug level=&githubTokenDebug.;
|
||||
run;
|
||||
%if %sysfunc(FEXIST(&outMD.)) AND &SYS_PROCHTTP_STATUS_CODE.=200
|
||||
%then %put %str( )status successful!;
|
||||
%else %put %str( )status unsuccessful!;
|
||||
|
||||
%end;
|
||||
%end;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%let installationRC=1;
|
||||
%put %str( )Done with return code rc=1 (zero = success);
|
||||
%end;
|
||||
/************************************************************************************************************/
|
||||
%end;
|
||||
|
||||
filename &in. clear;
|
||||
filename &out. clear;
|
||||
filename &inMD. clear;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
vERRb /* indicates if macro should be verbose and report errors */
|
||||
)
|
||||
/ minoperator PARMBUFF
|
||||
des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260126.'
|
||||
des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20260602.'
|
||||
;
|
||||
/*** HELP END ***/
|
||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
||||
@@ -20,7 +20,7 @@ des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFile
|
||||
%put ### This is short help information for the `isPackagesFilerefOK` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to check if the `packages` fileref is "correct", version `20260126` #;
|
||||
%put # Macro to check if the `packages` fileref is "correct", version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
+15
-12
@@ -3,7 +3,7 @@
|
||||
|
||||
Macro to list SAS packages in packages folder.
|
||||
|
||||
Version 20260126
|
||||
Version 20260602
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -25,7 +25,7 @@
|
||||
listDataSet /* Name of a data set to save results */
|
||||
, quiet = 0 /* Indicate if results should be printed in log */
|
||||
)/secure parmbuff
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260126.'
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20260602.'
|
||||
;
|
||||
%if (%QUPCASE(&listDataSet.) = HELP) %then
|
||||
%do;
|
||||
@@ -40,7 +40,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
|
||||
%put ### This is short help information for the `listPackages` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list available SAS packages, version `20260126` #;
|
||||
%put # Macro to list available 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 #;
|
||||
@@ -101,14 +101,17 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
|
||||
|
||||
options NOnotes NOsource ls=MAX ps=MAX;
|
||||
|
||||
data _null_;
|
||||
length listDataSet $ 41;
|
||||
listDataSet = strip(scan(symget('listDataSet'),1,'( )'));
|
||||
call symputX('listDataSet',listDataSet,"L");
|
||||
if not (listDataSet = " ") then
|
||||
call symputX('listDataSetCheck',1,"L");
|
||||
else call symputX('quiet',0,"L");
|
||||
run;
|
||||
%if %superq(listDataSet) NE %then
|
||||
%do;
|
||||
data _null_; /* verify listDataSet compatibility with V7 naming */
|
||||
%SPFinit_intrnl_forceV7DSname(listDataSet);
|
||||
|
||||
call symputX('listDataSet',listDataSet,"L");
|
||||
if not (listDataSet = " ") then
|
||||
call symputX('listDataSetCheck',1,"L");
|
||||
else call symputX('quiet',0,"L");
|
||||
run;
|
||||
%end;
|
||||
|
||||
data _null_
|
||||
%if 1=&listDataSetCheck. %then
|
||||
@@ -250,7 +253,7 @@ run;
|
||||
%if 0=&quiet. %then
|
||||
%do;
|
||||
%put %str( );
|
||||
%put # Results ptovided in the &listDataSet. data set. #;
|
||||
%put # Results provided in the &listDataSet. data set. #;
|
||||
%put %str( );
|
||||
%end;
|
||||
%end;
|
||||
|
||||
+75
-36
@@ -34,9 +34,10 @@
|
||||
, DS2force=0 /* indicates if PROC DS2 packages and threads
|
||||
should be loaded if a data set exists, 0=do not load
|
||||
*/
|
||||
, force=0 /* force loading even if given version is already loaded */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load SAS package, version 20260126. Run %loadPackage() for help info.'
|
||||
des = 'Macro to load SAS package, version 20260602. Run %loadPackage(HELP) for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -52,7 +53,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* SAS packages, version `20260126` #;
|
||||
%put # Macro to *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 #;
|
||||
@@ -116,6 +117,10 @@ minoperator
|
||||
%put # or threads should overwrite existing SAS data sets. #;
|
||||
%put # Default value of `0` means "do not overwrite". #;
|
||||
%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 # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
||||
@@ -180,50 +185,46 @@ minoperator
|
||||
|
||||
%local _PackageFileref_;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
length packageName $ 32;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
exists + fileexist(catx("/", p, cats(packageName,".&zip.")));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
run;
|
||||
/*run;*/ /* moved to line 276 */
|
||||
|
||||
/* convert cherryPick to lower case if needed */
|
||||
%if NOT (%str(*) = %superq(cherryPick)) %then
|
||||
%do;
|
||||
data _null_;
|
||||
/*data _null_;*/
|
||||
call symputX("cherryPick",lowcase(compbl(compress(symget("cherryPick"),". _","KDA"))),"L");
|
||||
run;
|
||||
/*run;*/
|
||||
%end;
|
||||
|
||||
run;
|
||||
|
||||
/* empty list is equivalent to "*" */
|
||||
%if %superq(cherryPick)= %then
|
||||
%if %sysevalf(%superq(cherryPick)=,boolean) %then
|
||||
%do;
|
||||
%let cherryPick=*;
|
||||
%end;
|
||||
|
||||
%if %superq(loadAddCnt) NE 1 %then
|
||||
%do;
|
||||
%let loadAddCnt = 0;
|
||||
%end;
|
||||
|
||||
%if %superq(suppressExec) NE 1 %then
|
||||
%do;
|
||||
%let suppressExec = 0;
|
||||
%end;
|
||||
|
||||
%if %superq(DS2force) NE 1 %then
|
||||
%do;
|
||||
%let DS2force = 0;
|
||||
%end;
|
||||
/* default is 0, anything else is 1 */
|
||||
%let loadAddCnt =%sysevalf(NOT(%superq(loadAddCnt)=0),boolean);
|
||||
%let suppressExec =%sysevalf(NOT(%superq(suppressExec)=0),boolean);
|
||||
%let DS2force =%sysevalf(NOT(%superq(DS2force)=0),boolean);
|
||||
%let force =%sysevalf(NOT(%superq(force)=0),boolean);
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
@@ -233,8 +234,10 @@ minoperator
|
||||
%do;
|
||||
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
|
||||
filename &_PackageFileref_. clear;
|
||||
/**/
|
||||
|
||||
/* test if required version of package is "good enough" */
|
||||
|
||||
%local rV pV rV0 pV0 rVsign;
|
||||
%let pV0 = %sysfunc(compress(&packageVersion.,.,kd));
|
||||
%let pV = %sysevalf((%scan(&pV0.,1,.,M)+0)*1e8
|
||||
@@ -253,8 +256,33 @@ minoperator
|
||||
%let rV = %sysevalf((%scan(&rV0.,1,.,M)+0)*1e8
|
||||
+ (%scan(&rV0.,2,.,M)+0)*1e4
|
||||
+ (%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;
|
||||
%put ERROR: Package &packageName. will not be loaded!;
|
||||
%put ERROR- Required version is &rV0.;
|
||||
@@ -272,19 +300,30 @@ minoperator
|
||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||
%else utf8 ;
|
||||
;
|
||||
%if %superq(lazyData) = %then
|
||||
%if %sysevalf(%superq(lazyData)=,boolean) %then
|
||||
%do;
|
||||
%local tempLoad_minoperator temp_noNotes_etc /* for hiding notes */ ;
|
||||
%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
|
||||
%if NOT &aleradyLoaded. %then
|
||||
%do;
|
||||
%put; %put - Additional content loading - Start -;
|
||||
%loadPackageAddCnt(&packageName.,
|
||||
path=&path.)
|
||||
%put - Additional content loading - End -;
|
||||
%local tempLoad_minoperator temp_noNotes_etc /* for hiding notes */ ;
|
||||
%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;
|
||||
%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;
|
||||
%else
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
is provided in required version */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load additional content for a SAS package, version 20260126. Run %loadPackageAddCnt() for help info.'
|
||||
des = 'Macro to load additional content for a SAS package, version 20260602. Run %loadPackageAddCnt(HELP) for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -35,7 +35,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackageAddCnt` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20260126` #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -116,20 +116,22 @@ minoperator
|
||||
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "A" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
call symputX("_TargetFileref_", "T" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
data _null_;
|
||||
length packageName $ 32;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "A" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
call symputX("_TargetFileref_", "T" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
exists + fileexist(catx("/", p, cats(packageName,".&zip.")));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20260126. Run %loadPackages() for help info.'
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20260602. Run %loadPackages(HELP) for help info.'
|
||||
parmbuff
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
@@ -27,7 +27,7 @@ parmbuff
|
||||
%put ### This is short help information for the `loadPackageS` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20260126` #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to preview content of a SAS package, version 20260126. 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
|
||||
%do;
|
||||
@@ -38,7 +38,7 @@ des = 'Macro to preview content of a SAS package, version 20260126. Run %preview
|
||||
%put ### This is short help information for the `previewPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get preview of a SAS packages, version `20260126` #;
|
||||
%put # Macro to get preview of a 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 #;
|
||||
@@ -119,18 +119,20 @@ des = 'Macro to preview content of a SAS package, version 20260126. Run %preview
|
||||
|
||||
%local _PackageFileref_;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
length packageName $ 32;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
exists + fileexist(catx("/", p, cats(packageName,".&zip.")));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
,psMAX=MAX /* pageSise in case executed inside DoSubL() */
|
||||
,ods= /* a data set for results, e.g., work.relocatePackageReport */
|
||||
)
|
||||
/ des = 'Utility macro that locally Copies or Moves Packages, version 20260126. Run %relocatePackage() for help info.'
|
||||
/ des = 'Utility macro that locally Copies or Moves Packages, version 20260602. Run %relocatePackage(HELP) for help info.'
|
||||
secure
|
||||
minoperator
|
||||
;
|
||||
@@ -33,7 +33,7 @@
|
||||
%put ### This is short help information for the `relocatePackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *locally copy or move* (relocate) SAS packages, version `20260126` #;
|
||||
%put # Macro to *locally copy or move* (relocate) 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 #;
|
||||
@@ -185,7 +185,14 @@
|
||||
%put WARNING: Checksum verification impossible! Minimum SAS version required for the process is 9.4M6. ;
|
||||
%end;
|
||||
|
||||
data _null_ %if %superq(ods) NE %then %do; &ods. %end;
|
||||
%if NOT %sysevalf(%superq(ods)=,BOOLEAN) %then %do;
|
||||
data _null_; /* verify ods= value */
|
||||
%SPFinit_intrnl_forceV7DSname(ods);
|
||||
call symputX("ods",ods,"L");
|
||||
run;
|
||||
%end;
|
||||
|
||||
data _null_ &ods. /* the &ods. will be used if not missing */
|
||||
;
|
||||
putlog 52*"*" 24*"=" 52*"*";
|
||||
length packages source target $ 32767 sDevice tDevice $ 32;
|
||||
@@ -565,7 +572,7 @@
|
||||
/ "WARNING- Source is: " s_HASHING
|
||||
/ "WARNING- Target is: " t_HASHING
|
||||
/ "WARNING- There could be errors during copying. Check your files.";
|
||||
%if %superq(ods) NE %then %do; output %scan(&ods.,1,()) ; %end;
|
||||
output &ods.; /* the &ods. will be used if not missing */
|
||||
end;
|
||||
%end;
|
||||
|
||||
|
||||
@@ -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
|
||||
secure
|
||||
des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260126. 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;
|
||||
%let list=
|
||||
@@ -51,7 +51,7 @@ SasPackagesFrameworkNotes
|
||||
%put ### This is short help information for the `SasPackagesFrameworkNotes` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro prints help notes for SAS Packages Framework macros, version `20260126` #;
|
||||
%put # Macro prints help notes for SAS Packages Framework macros, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*+SPFinit_intrnl_forceV7DSname+*/
|
||||
%macro SPFinit_intrnl_forceV7DSname(
|
||||
mcParam /* name of a macro parameter holding user provided data set name */
|
||||
)/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 20260602.';
|
||||
/* The macro can be called only inside a data step. */
|
||||
/****************************************************************************
|
||||
### Parameters:
|
||||
|
||||
`mcParam` - name of a macro parameter holding user provided data set name
|
||||
|
||||
### Behavior:
|
||||
|
||||
Description:
|
||||
The 4GL code SYMGETs macro variable value, SCANs only first
|
||||
part of the string in case there are parenthesis "()" in it.
|
||||
Then it COMPRESSes the string and keep _only_ digits, letters,
|
||||
underscore, and period. All periods are TRANSLATEd to spaces.
|
||||
If created string is not empty its last chunk is SCANned for
|
||||
data set name, the second to last chunk is SCANned for libname
|
||||
(if empty then "work" is used). First character of LIB and DS
|
||||
variables is checked, if it is a digit, then underscore is added.
|
||||
At the end the LIB and DS are concatenated and upper cased.
|
||||
case letters.
|
||||
|
||||
Examples:
|
||||
|
||||
abc.xyz -> ABC.XYZ
|
||||
ABC.XYZ(obs=42) -> ABC.XYZ
|
||||
XYZ -> WORK.XYZ
|
||||
abc. -> WORK.ABC
|
||||
.XYZ -> WORK.XYZ
|
||||
123.456 -> _123._456
|
||||
A#B.x$y -> AB.XY
|
||||
|
||||
Usecase:
|
||||
Inside a macro for value check
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%macro A(ods);
|
||||
data _null_;
|
||||
%SPDinit_intrnl_forceV7DSname(ods);
|
||||
call symputX("ods",ods,"L");
|
||||
run;
|
||||
|
||||
%if %superq(ods) ne %then
|
||||
%do;
|
||||
data &ods.;
|
||||
...
|
||||
run;
|
||||
%end;
|
||||
%mend;
|
||||
|
||||
%A()
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
****************************************************************************/
|
||||
%local allowedSPFmacrosList;
|
||||
%let allowedSPFmacrosList=LISTPACKAGES RELOCATEPACKAGE UNBUNDLEPACKAGES BUNDLEPACKAGES;
|
||||
%if %sysmexecname(%sysmexecdepth-1) in (&allowedSPFmacrosList.) %then
|
||||
%do;
|
||||
/*=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/
|
||||
length &mcParam. $ 41 lib $ 8 ds $ 32;
|
||||
/* force only V7 valid symbols */
|
||||
&mcParam. = symget("&mcParam.");
|
||||
if NOT (&mcParam. = " ") then
|
||||
do;
|
||||
/* drop every illegal character */
|
||||
&mcParam. = compress(scan(&mcParam,1,'()'),'_.','kad');
|
||||
&mcParam. = cats(translate(&mcParam.," ","."));
|
||||
if NOT (&mcParam.=" ") then
|
||||
do;
|
||||
/* use 2 last blocks of symbols */
|
||||
lib = coalescec(scan(&mcParam.,-2),"work");
|
||||
ds = scan(&mcParam.,-1);
|
||||
/* check first symbol, in case leading digit add _ */
|
||||
if ("0" <=: lib <=: "9")
|
||||
then lib=cats("_",lib);
|
||||
if ("0" <=: ds <=: "9")
|
||||
then ds=cats("_",ds);
|
||||
|
||||
&mcParam. = upcase(catx(".",lib,ds));
|
||||
end;
|
||||
end;
|
||||
/*=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%put INFO: SAS Packages Framework internal macro.;
|
||||
%put INFO: Executable only inside &allowedSPFmacrosList. macros.;
|
||||
%end;
|
||||
%mend SPFinit_intrnl_forceV7DSname;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*+SPFint_gnPckg_arch+*/
|
||||
%macro SPFint_gnPckg_arch()/secure minoperator
|
||||
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the archive version generation part of the process. Version 20260126.';
|
||||
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 */
|
||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||
%do;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*+SPFint_gnPckg_markdown+*/
|
||||
%macro SPFint_gnPckg_markdown()/secure minoperator
|
||||
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the markdown documentation part of the process. Version 20260126.';
|
||||
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 */
|
||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||
%do;
|
||||
@@ -112,7 +112,7 @@ data &filesWithCodes.markdown;
|
||||
%end;
|
||||
|
||||
put " " / "---------------------------------------------------------------------" / " "
|
||||
/ "*SAS package generated by SAS Package Framework, version `20260126`,*"
|
||||
/ "*SAS package generated by SAS Package Framework, version `20260602`,*"
|
||||
/ "*under `&sysscp.`(`&sysscpl.`) operating system,*"
|
||||
/ "*using SAS release: `&sysvlong4.`.*"
|
||||
/ " " / "---------------------------------------------------------------------" / " ";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*+SPFint_gnPckg_tests+*/
|
||||
%macro SPFint_gnPckg_tests()/secure minoperator
|
||||
des='SAS Packages Framework internal macro. Executable only inside the %generatePackage() macro. The macro encapsulates the test part of the process. Version 20260126.';
|
||||
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 */
|
||||
%if %sysmexecname(%sysmexecdepth-1) in (GENERATEPACKAGE) %then
|
||||
%do;
|
||||
@@ -85,6 +85,10 @@ run;
|
||||
@n '%put >>>%'"&packageName."'META(P)<<<;'/
|
||||
@n '%put >>>%'"&packageName."'META(S)<<<;'/;
|
||||
|
||||
/* verify */
|
||||
put @n '%verifyPackage'"(&packageName.,";
|
||||
put @n " path=&buildLocation.)" /;
|
||||
|
||||
/* help */
|
||||
put @n '%helpPackage'"(&packageName.,";
|
||||
put @n " path=&buildLocation.)" /;
|
||||
@@ -317,6 +321,10 @@ data _null_;
|
||||
'%put >>req packages>%'"&packageName."'META(P)<<<;'/
|
||||
'%put >>req SAS >%'"&packageName."'META(S)<<<;'/;
|
||||
|
||||
/* verify */
|
||||
put '%verifyPackage'"(&packageName.,";
|
||||
put " path=&buildLocation.)" /;
|
||||
|
||||
/* help */
|
||||
put '%helpPackage'"(&packageName.,"
|
||||
/ " path=&buildLocation.)" /;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
,nobs=0 /* technical parameter */
|
||||
)
|
||||
/*** HELP END ***/
|
||||
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20260126. 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
|
||||
%do;
|
||||
@@ -24,7 +24,7 @@
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Utility macro to *split* single file with SAS package code into multiple #;
|
||||
%put # files with separate snippets, version `20260126` #;
|
||||
%put # files with separate snippets, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -400,7 +400,7 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ;
|
||||
*/
|
||||
if firstLine[j] then
|
||||
do;
|
||||
put '/* File generated with help of SAS Packages Framework, version 20260126. */';
|
||||
put '/* File generated with help of SAS Packages Framework, version 20260602. */';
|
||||
firstLine[j]=0;
|
||||
end;
|
||||
put _infile_;
|
||||
|
||||
+133
-62
@@ -6,9 +6,11 @@
|
||||
,packagesPath=
|
||||
,packagesRef=packages
|
||||
,ods= /* data set for report file */
|
||||
,reportOnly=0
|
||||
,verify=0
|
||||
,quiet=0
|
||||
)/
|
||||
des='Macro to extract a bundle of SAS packages, version 20260126. Run %unbundlePackages(HELP) for help info.'
|
||||
des='Macro to extract a bundle of SAS packages, version 20260602. Run %unbundlePackages(HELP) for help info.'
|
||||
secure
|
||||
minoperator
|
||||
;
|
||||
@@ -26,7 +28,7 @@ minoperator
|
||||
%put ### This is short help information for the `unbundlePackages` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *extract* SAS packages from a bundle, version `20260126` #;
|
||||
%put # Macro to *extract* SAS packages from a bundle, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -58,11 +60,20 @@ minoperator
|
||||
%put # - `packagesRef=` *Optional.* Fileref to location where packages will #;
|
||||
%put # be extracted. Default value is `packages`. #;
|
||||
%put # #;
|
||||
%put # - `ods=` *Optional.* Name of SAS data set for the report. #;
|
||||
%put # - `ods=` *Optional.* V7 style name of SAS data set for report. #;
|
||||
%put # #;
|
||||
%put # - `verify=` *Optional.* Indicates if verification code should #;
|
||||
%put # be executed after bundle extraction. #;
|
||||
%put # Value `1` means yes, Value `0` means no. #;
|
||||
%put # Value `1` means yes, Value `0` (default) means no. #;
|
||||
%put # #;
|
||||
%put # - `reportOnly=` *Optional.* Indicates if packages unbundling should #;
|
||||
%put # be suspended and only a report with bundle content #;
|
||||
%put # be produced and printed. #;
|
||||
%put # Value `1` means yes, Value `0` (default) means no. #;
|
||||
%put # #;
|
||||
%put # - `quiet=` *Optional.* Indicates if printout of the summary #;
|
||||
%put # report should be suspended. #;
|
||||
%put # Value `1` means yes, Value `0` (default) means no. #;
|
||||
%put # #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
@@ -110,6 +121,11 @@ minoperator
|
||||
/*===================================================================================================*/
|
||||
|
||||
%if NOT(%superq(verify) in (0 1)) %then %let verify=0;
|
||||
%if NOT(%superq(quiet) in (0 1)) %then %let quiet=0;
|
||||
|
||||
%if NOT(%superq(reportOnly) in (0 1)) %then %let reportOnly=0;
|
||||
/* no verification when reporting */
|
||||
%if 1=&reportOnly. %then %let verify=0;
|
||||
|
||||
%local HASHING_FILE_exist;
|
||||
%let HASHING_FILE_exist = 0;
|
||||
@@ -128,11 +144,17 @@ minoperator
|
||||
%let datetime = %sysfunc(datetime());
|
||||
%let reportFile = WORK.tmpbundlefile%sysfunc(int(&datetime.), b8601dt15.)_;
|
||||
|
||||
data _null_ ;
|
||||
%if NOT %sysevalf(%superq(ods)=,BOOLEAN) %then %do;
|
||||
data _null_; /* verify ods= value */
|
||||
%SPFinit_intrnl_forceV7DSname(ods);
|
||||
call symputX("ods",ods,"L");
|
||||
run;
|
||||
%end;
|
||||
|
||||
data _null_;
|
||||
datetime=symgetn('datetime');
|
||||
|
||||
length packagesList $ 32767 bundleName $ 128;
|
||||
|
||||
bundleName = compress(symget('bundleName'),"_.","KAD"); /* bundle name is letters, digits, and underscore, up to 128 symbols */
|
||||
|
||||
if bundleName NE symget('bundleName') then /* warn about illegal characters */
|
||||
@@ -140,12 +162,12 @@ if bundleName NE symget('bundleName') then /* warn about illegal characters */
|
||||
put "ERROR: Bundle name contains illegal characters. Exiting";
|
||||
stop;
|
||||
end;
|
||||
|
||||
bundleName=lowcase(bundleName);
|
||||
lbn = length(bundleName); /* to cover lengths < 7 & 11 */
|
||||
/* if there is ".bundle.zip" extension added, remove it */
|
||||
if substr(strip(reverse(bundleName)),1,11) = 'piz.eldnub.' then bundleName=scan(bundleName,-3,".");
|
||||
if substr(strip(reverse(bundleName)),1,min(11,lbn)) = 'piz.eldnub.' then bundleName=scan(bundleName,-3,".");
|
||||
else /* if there is ".bundle" extension added, remove it */
|
||||
if substr(strip(reverse(bundleName)),1,7) = 'eldnub.' then bundleName=scan(bundleName,-2,".");
|
||||
if substr(strip(reverse(bundleName)),1,min(7,lbn)) = 'eldnub.' then bundleName=scan(bundleName,-2,".");
|
||||
|
||||
put / "INFO: Bundle name is: " bundleName / ;
|
||||
|
||||
@@ -153,43 +175,47 @@ length packagesPath $ 32767 packagesRef $ 8;
|
||||
packagesPath = dequote(symget('packagesPath'));
|
||||
packagesRef = upcase(strip(symget('packagesRef')));
|
||||
|
||||
if 0 then set SASHELP.VEXTFL(keep=level xpath xengine fileref exists);
|
||||
|
||||
/* organize target path (location for packages) */
|
||||
if " "=packagesPath then
|
||||
do;
|
||||
if 0 then set SASHELP.VEXTFL(keep=level xpath xengine fileref exists);
|
||||
DECLARE HASH sH(dataset:'SASHELP.VEXTFL(where=(fileref=' !! quote(packagesRef) !! '))', ordered: "A");
|
||||
sH.DefineKey("level");
|
||||
sH.DefineData("xpath","xengine","exists");
|
||||
sH.DefineDone();
|
||||
|
||||
if sH.NUM_ITEMS=0 then
|
||||
/* ignore target check when only report is requested */
|
||||
%if 0=&reportOnly. %then
|
||||
%do;
|
||||
/* organize target path (location for packages) */
|
||||
if " "=packagesPath then
|
||||
do;
|
||||
put "ERROR: Fileref in packagesRef= does NOT exist. Exiting!";
|
||||
stop;
|
||||
DECLARE HASH sH(dataset:'SASHELP.VEXTFL(where=(fileref=' !! quote(packagesRef) !! '))', ordered: "A");
|
||||
sH.DefineKey("level");
|
||||
sH.DefineData("xpath","xengine","exists");
|
||||
sH.DefineDone();
|
||||
|
||||
if sH.NUM_ITEMS=0 then
|
||||
do;
|
||||
put "ERROR: Fileref in packagesRef= does NOT exist. Exiting!";
|
||||
stop;
|
||||
end;
|
||||
|
||||
packagesPath=" ";
|
||||
|
||||
rc = sH.FIND(key:NOT(1=sH.NUM_ITEMS)); /* if only 1 element select level 0, if more than 1 select level 1 */
|
||||
if xengine = "DISK" AND exists='yes' then
|
||||
packagesPath=quote(strip(xpath)); /* add quotes to the packagesPath */
|
||||
else
|
||||
do;
|
||||
put "ERROR: Path: " xpath "in packagesRef= is invalid! Exiting!";
|
||||
stop;
|
||||
end;
|
||||
end;
|
||||
|
||||
packagesPath=" ";
|
||||
|
||||
rc = sH.FIND(key:NOT(1=sH.NUM_ITEMS)); /* if only 1 element select level 0, if more than 1 select level 1 */
|
||||
if xengine = "DISK" AND exists='yes' then
|
||||
packagesPath=quote(strip(xpath)); /* add quotes to the packagesPath */
|
||||
else
|
||||
do;
|
||||
put "ERROR: Path: " xpath "in packagesRef= is invalid! Exiting!";
|
||||
stop;
|
||||
rcPckPath = fileexist(strip(packagesPath));
|
||||
if 0=rcPckPath then
|
||||
do;
|
||||
put "ERROR: Path in packagesPath= does NOT exist. Exiting!";
|
||||
stop;
|
||||
end;
|
||||
else packagesPath=quote(strip(packagesPath)); /* add quotes to the packagesPath */
|
||||
end;
|
||||
end;
|
||||
else
|
||||
do;
|
||||
rcPckPath = fileexist(strip(packagesPath));
|
||||
if 0=rcPckPath then
|
||||
do;
|
||||
put "ERROR: Path in packagesPath= does NOT exist. Exiting!";
|
||||
stop;
|
||||
end;
|
||||
else packagesPath=quote(strip(packagesPath)); /* add quotes to the packagesPath */
|
||||
end;
|
||||
%end;
|
||||
|
||||
length path $ 32767 pathRef $ 8;
|
||||
path = dequote(symget('path'));
|
||||
@@ -272,7 +298,7 @@ DECLARE HITER IQ("Q");
|
||||
|
||||
/*--------------------------------------------------*/
|
||||
do until(EOF);
|
||||
input package :$32. pckVer :$16. pckDtm :$16. hash :$128.;
|
||||
input package :$32. pckVer :$16. pckDtm :$24. hash :$128.;
|
||||
if " " NE package then rc = Q.ADD();
|
||||
end;
|
||||
label package="Package name"
|
||||
@@ -281,7 +307,6 @@ label package="Package name"
|
||||
hash="SHA256 for the Package";
|
||||
/*--------------------------------------------------*/
|
||||
|
||||
|
||||
if 0=Q.NUM_ITEMS then /* ... if empty then exit */
|
||||
do;
|
||||
put "WARNING: No packages to unbundle. Exiting!";
|
||||
@@ -292,22 +317,31 @@ else
|
||||
packagesList = catx(" ", packagesList, package);
|
||||
end;
|
||||
|
||||
rc = Q.output(dataset:"&reportFile.1");
|
||||
|
||||
rc = Q.output(dataset: /* create propper tag */
|
||||
%if %superq(ods) NE %then %do; "&ods.(label='Bundle: " !! strip(bundleName) !! "')" %end;
|
||||
%else %do; "&reportFile.1" %end;
|
||||
);
|
||||
|
||||
|
||||
/* code executed for unbundling */
|
||||
length code1 code2 $ 32767;
|
||||
code1=
|
||||
'options ps=min nofullstimer nostimer msglevel=N; filename PACKAGES ' !! strip(packagesPath) !! ';' !!
|
||||
'%relocatePackage(' !! strip(packagesList) !! ',source=' !! catx("/", path, bundleName) !!
|
||||
'.bundle.zip, sDevice=ZIP,psMAX=MIN)';
|
||||
%if 0=&reportOnly. %then
|
||||
%do;
|
||||
code1=
|
||||
'options ps=min nofullstimer nostimer msglevel=N; filename PACKAGES ' !! strip(packagesPath) !! ';' !!
|
||||
'%relocatePackage(' !! strip(packagesList) !! ',source=' !! catx("/", path, bundleName) !!
|
||||
'.bundle.zip, sDevice=ZIP,psMAX=MIN)';
|
||||
|
||||
/*put code=;*/
|
||||
/*put code=;*/
|
||||
|
||||
put / "INFO: The " bundleName "bundle extraction in progress...";
|
||||
put / "INFO: The " bundleName "bundle extraction in progress...";
|
||||
|
||||
rc = doSubL(code1);
|
||||
rc = doSubL(code1);
|
||||
|
||||
put / "INFO: The " bundleName "bundle extraction ended.";
|
||||
%end;
|
||||
|
||||
put / "INFO: The " bundleName "bundle extraction ended.";
|
||||
|
||||
/* code executed for verification */
|
||||
%if 1=&verify. %then
|
||||
@@ -320,21 +354,22 @@ put / "INFO: The " bundleName "bundle extraction ended.";
|
||||
rc = doSubL(code2);
|
||||
put / "INFO: The " bundleName "bundle verification ended.";
|
||||
%end;
|
||||
|
||||
put " ";
|
||||
rc=sleep(1,1);
|
||||
|
||||
rc = doSubL("title 'Summary of the extracted bundle file';" !!
|
||||
"proc print data=" !!
|
||||
rc = doSubL(
|
||||
%if 0=&quiet. %then /* do not print report */
|
||||
%do;
|
||||
"title 'Summary of the bundle file: " !! strip(bundleName) !! "';" !!
|
||||
"proc print label data=" !!
|
||||
%if %superq(ods) NE %then %do; "&ods." %end;
|
||||
%else %do; "&reportFile.1" %end; !!
|
||||
"; var package pckVer pckDtm hash; run;" !!
|
||||
%end;
|
||||
%if %superq(ods) NE %then
|
||||
%do; "%scan(&ods.,1,())" %end;
|
||||
%do; %put INFO: Report file: &ods.; %end;
|
||||
%else
|
||||
%do; "&reportFile.1" %end; !!
|
||||
" label; var package pckVer pckDtm hash; run;" !!
|
||||
%if %superq(ods) NE %then
|
||||
%do; %put INFO: Report file: %scan(&ods.,1,()); %end;
|
||||
%else
|
||||
%do; "proc delete data=&reportFile.1; run;" %end; !!
|
||||
%do; "proc delete data=&reportFile.1; run;" !! %end;
|
||||
"title;");
|
||||
|
||||
stop;
|
||||
@@ -363,6 +398,7 @@ options mprint;
|
||||
,path=R:\
|
||||
,packagesPath=R:\check2
|
||||
,verify=1
|
||||
,ods=WORK.bundlenametest124_reportDS
|
||||
)
|
||||
|
||||
%unbundlePackages(
|
||||
@@ -385,7 +421,42 @@ options mprint;
|
||||
,packagesPath=R:\check
|
||||
,verify=1
|
||||
)
|
||||
*/
|
||||
|
||||
/* reportOnly & quiet
|
||||
|
||||
%bundlePackages(myLittleBundle
|
||||
,path=R:\
|
||||
,packagesList=basePlus SQLinDS macroarray
|
||||
,packagesRef=PACKAGES)
|
||||
|
||||
option dlcreatedir;
|
||||
libname _ "R:\check5";
|
||||
|
||||
%unbundlePackages(myLittleBundle
|
||||
,path=R:\
|
||||
,reportOnly=1
|
||||
,ods=work.bundleReport1)
|
||||
|
||||
%unbundlePackages(myLittleBundle
|
||||
,path=R:\
|
||||
,reportOnly=1
|
||||
,ods=work.bundleReport2
|
||||
,quiet=1)
|
||||
|
||||
%unbundlePackages(myLittleBundle
|
||||
,path=R:\
|
||||
,packagesPath=R:\check5
|
||||
,ods=work.bundleReport3
|
||||
,quiet=1, verify=1)
|
||||
|
||||
%unbundlePackages(myLittleBundle
|
||||
,path=R:\
|
||||
,packagesPath=R:\check5
|
||||
,ods=work.bundleReport4
|
||||
,quiet=0, verify=1)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* end of SPFinit.sas file */
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to unload SAS package, version 20260126. 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
|
||||
%do;
|
||||
@@ -35,7 +35,7 @@ des = 'Macro to unload SAS package, version 20260126. Run %unloadPackage() for h
|
||||
%put ### This is short help information for the `unloadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to unload SAS packages, version `20260126` #;
|
||||
%put # Macro to unload 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 #;
|
||||
@@ -115,18 +115,20 @@ des = 'Macro to unload SAS package, version 20260126. Run %unloadPackage() for h
|
||||
|
||||
%local _PackageFileref_;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
length packageName $ 32;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
exists + fileexist(catx("/", p, cats(packageName,".&zip.")));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -148,6 +150,9 @@ des = 'Macro to unload SAS package, version 20260126. Run %unloadPackage() for h
|
||||
%else utf8 ;
|
||||
;
|
||||
%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;
|
||||
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
|
||||
filename &_PackageFileref_. clear;
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
, path = %sysfunc(pathname(packages)) /* location of a package,
|
||||
by default it looks for
|
||||
location of "packages" fileref */
|
||||
, hash = /* The SHA256 hash digest for
|
||||
, hash = F* /* The SHA256 hash digest for
|
||||
the package generated by
|
||||
hashing_file() function, SAS 9.4M6 */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20260126. 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
|
||||
%do;
|
||||
@@ -28,7 +28,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260126. Run %
|
||||
%put ### This is short help information for the `verifyPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20260126` #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20260602` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -48,7 +48,9 @@ des = 'Macro to verify SAS package with the hash digest, version 20260126. Run %
|
||||
%put # If empty displays this help information. #;
|
||||
%put # #;
|
||||
%put # - `hash=` A value of the package `SHA256` hash. #;
|
||||
%put # Provided by the user. #;
|
||||
%put # Provided by the user. When the value is not provided #;
|
||||
%put # then macro calculates `SHA256`, `SHA1`, and `MD5` #;
|
||||
%put # digests and display then in the log. #;
|
||||
%put # #;
|
||||
%put # - `path=` Location of a package. By default it looks for #;
|
||||
%put # location of the "packages" fileref, i.e. #;
|
||||
@@ -76,7 +78,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20260126. Run %
|
||||
%put ;
|
||||
%put %nrstr( %%installPackage(SQLinDS) %%* install the package from the Internet; );
|
||||
%put %nrstr( %%verifyPackage%(SQLinDS, %%* verify the package with provided hash; );
|
||||
%put %nrstr( hash=HDA478ANJ3HKHRY327FGE88HF89VH89HFFFV73GCV98RF390VB4%) );
|
||||
%put %nrstr( hash=HDA478ANJ3HKHRY327FGE88HF89VH89HFFFV73GCV98RF390VB4%) );
|
||||
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
%put #################################################################################;
|
||||
%put ;
|
||||
@@ -97,19 +99,21 @@ des = 'Macro to verify SAS package with the hash digest, version 20260126. Run %
|
||||
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_ checkExist;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
data _null_;
|
||||
length packageName $ 140;
|
||||
packageName = lowcase(symget("packageName"));
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(strip(packageName)), hex7. -L), "L");
|
||||
/*run;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
/*data _null_;*/ /* <- comment out, because it can be 1 data step, not 2 */
|
||||
exists = 0;
|
||||
length packages $ 32767 p $ 4096;
|
||||
packages = resolve(symget("path"));
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".zip")); /* check on zip files only! */
|
||||
exists + fileexist(catx("/", p, cats(packageName,".zip"))); /* check on zip files only! */
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -142,31 +146,60 @@ des = 'Macro to verify SAS package with the hash digest, version 20260126. Run %
|
||||
filename &_PackageFileref_. list;
|
||||
|
||||
data _null_;
|
||||
length providedHash $ 128;
|
||||
length providedHash $ 128 packageName $ 140;
|
||||
providedHash = strip(symget("hash"));
|
||||
select;
|
||||
when ( 'F*' = upcase(substr(providedHash,1,2)) ) /* F = file digest */
|
||||
SHA256 = 'F*' !! HASHING_FILE("SHA256", pathname("&_PackageFileref_.",'F'), 0);
|
||||
when ( 'C*' = upcase(substr(providedHash,1,2)) ) /* C = content digest */
|
||||
SHA256 = 'C*' !! HASHING_FILE("SHA256", "&_PackageFileref_.", 4);
|
||||
otherwise /* legacy approach, without C or F, digest value equivalent to C */
|
||||
SHA256 = HASHING_FILE("SHA256", "&_PackageFileref_.", 4);
|
||||
end;
|
||||
put "Provided Hash: " providedHash;
|
||||
put "SHA256 digest: " SHA256;
|
||||
put " ";
|
||||
|
||||
if upcase(SHA256) = upcase(providedHash) then
|
||||
do;
|
||||
put "NOTE: Package verification SUCCESSFUL.";
|
||||
put "NOTE- Generated hash is EQUAL to the provided one.";
|
||||
packageName = strip(symget("packageName"));
|
||||
|
||||
emptyHash = (providedHash = " " OR providedHash in ("F*" "f*" "C*" "c*"));
|
||||
|
||||
put 82*"-" / @2 packageName / 82*"-" /;
|
||||
|
||||
if NOT emptyHash then put "Provided Hash: " providedHash;
|
||||
|
||||
length method $ 8 digest $ 128;
|
||||
/* calculate SHA256 */
|
||||
method="SHA256";
|
||||
LINK CalcualteHashDigest; /* go to Link 1 */
|
||||
|
||||
if NOT emptyHash then
|
||||
do; /* step for veryfication */
|
||||
if upcase(digest) = upcase(providedHash) then
|
||||
do;
|
||||
put "NOTE: Verification SUCCESSFUL."
|
||||
/ "NOTE- Generated hash is EQUAL to the provided one." / ;
|
||||
end;
|
||||
else
|
||||
do;
|
||||
pos = 0;
|
||||
do i = 1 to max(lengthn(digest),lengthn(providedHash)) while(pos=0);
|
||||
if char(digest,i) NE char(providedHash,i) then pos = i;
|
||||
end;
|
||||
put "ERROR- " @(pos+15)"^"/"ERROR- " @(pos+15)"| diff @" pos/"ERROR- ";
|
||||
put "ERROR: Verification FAILED!!"
|
||||
/ "ERROR- Generated hash is DIFFERENT than the provided one."
|
||||
/ "ERROR- Check if the ZIP is genuine." / ;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
do;
|
||||
put "ERROR: Package verification FAILED!!";
|
||||
put "ERROR- Generated hash is DIFFERENT than the provided one.";
|
||||
put "ERROR- Confirm if the package is genuine.";
|
||||
do method = "SHA1", "MD5"; /* step for digest display, calcualte also SHA1 and MD5 */
|
||||
LINK CalcualteHashDigest; /* go to Link 1 */
|
||||
end;
|
||||
put 82*"-" /;
|
||||
stop;
|
||||
return;
|
||||
CalcualteHashDigest: /* Link 1 */
|
||||
|
||||
select;
|
||||
when ( 'F*' = upcase(substr(providedHash,1,2)) ) /* F = file digest */
|
||||
digest = 'F*' !! HASHING_FILE(method, pathname("&_PackageFileref_.",'F'), 0);
|
||||
when ( 'C*' = upcase(substr(providedHash,1,2)) ) /* C = content digest */
|
||||
digest = 'C*' !! HASHING_FILE(method, "&_PackageFileref_.", 4);
|
||||
otherwise /* legacy approach, without C or F, digest value equivalent to C */
|
||||
digest = HASHING_FILE(method, "&_PackageFileref_.", 4);
|
||||
end;
|
||||
put method "digest: " digest /;
|
||||
|
||||
return;
|
||||
run;
|
||||
%let HASHING_FILE_exist = 0;
|
||||
%end;
|
||||
|
||||
+229
-26
@@ -1,7 +1,7 @@
|
||||
|
||||
---
|
||||
|
||||
# SAS Packages Framework, version `20260126`
|
||||
# SAS Packages Framework, version `20260602`
|
||||
|
||||
---
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* [the `generatePackage` macro](#generatepackage)
|
||||
* [the `extendPackagesFileref` macro](#extendpackagesfileref)
|
||||
* [the `loadPackageAddCnt` macro](#loadpackageaddcnt)
|
||||
* [the `requestPackage` macro](#requestpackage)
|
||||
* [the `splitCodeForPackage` macro](#splitcodeforpackage)
|
||||
* [the `relocatePackage` macro](#relocatepackage)
|
||||
* [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.
|
||||
|
||||
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20260126`**.
|
||||
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).
|
||||
|
||||
@@ -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>
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
Macro to install SAS packages, version `20260126`
|
||||
Macro to install SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -105,8 +106,15 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack
|
||||
When there are multiple packages to install version variable
|
||||
is scan sequentially.
|
||||
|
||||
- `replace=` With default value of `1` it causes existing package file
|
||||
to be replaced by new downloaded file.
|
||||
- `replace=` When set to `1` and a package file exists, it forces the package
|
||||
file replacement by the new downloaded file.
|
||||
It is a binary indicator ('0' or '1'). Default value is `1`.
|
||||
|
||||
- `backup=` When set to `1` and a package file exists, it creates a backup copy
|
||||
of the package file. The backup copy is created with a suffix of the
|
||||
following format: `_BCKP_yyyymmddJJMMSS`.
|
||||
If `replace=0` then `backup` is set to `0`.
|
||||
It is a binary indicator ('0' or '1'). Default value is `0`.
|
||||
|
||||
- `URLuser=` A user name for the password protected URLs, no quotes needed.
|
||||
|
||||
@@ -137,6 +145,24 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack
|
||||
`https://github.com/<github>/<packagename>/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.
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` to learn more.
|
||||
@@ -185,7 +211,7 @@ filename packages "C:/SAS_PACKAGES";
|
||||
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to get help about SAS packages, version `20260126`
|
||||
Macro to get help about SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -263,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *load* SAS packages, version `20260126`
|
||||
Macro to *load* SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -421,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro wrapper for the loadPackage macro, version `20260126`
|
||||
Macro wrapper for the loadPackage macro, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -467,12 +493,13 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
%loadPackageS(SQLinDS, DFA) %* load packages content into the SAS session;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to unload SAS packages, version `20260126`
|
||||
Macro to unload SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -539,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>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to list available SAS packages, version `20260126`
|
||||
Macro to list available SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -588,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to verify SAS package with it hash digest, version `20260126`
|
||||
Macro to verify SAS package with it hash digest, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -609,7 +636,9 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
If empty displays this help information.
|
||||
|
||||
- `hash=` A value of the package `SHA256` hash.
|
||||
Provided by the user.
|
||||
Provided by the user. When the value is not provided
|
||||
then macro calculates `SHA256`, `SHA1`, and `MD5`
|
||||
digests and display then in the log.
|
||||
|
||||
- `path=` Location of a package. By default it looks for
|
||||
location of the "packages" fileref, i.e.
|
||||
@@ -636,13 +665,13 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
|
||||
|
||||
%installPackage(SQLinDS) %* install the package from the Internet;
|
||||
%verifyPackage(SQLinDS, %* verify the package with provided hash;
|
||||
hash=HDA478ANJ3HKHRY327FGE88HF89VH89HFFFV73GCV98RF390VB4)
|
||||
hash=HDA478ANJ3HKHRY327FGE88HF89VH89HFFFV73GCV98RF390VB4)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
## This is short help information for the `previewPackage` macro <a name="previewpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to get preview of a SAS packages, version `20260126`
|
||||
Macro to get preview of a SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -711,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to generate SAS packages, version `20260126`
|
||||
Macro to generate SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -944,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>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to list directories pointed by 'packages' fileref, version `20260126`
|
||||
Macro to list directories pointed by 'packages' fileref, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -986,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to load *additional content* for a SAS package, version `20260126`
|
||||
Macro to load *additional content* for a SAS package, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1076,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Utility macro to *split* single file with SAS package code into multiple
|
||||
files with separate snippets, version `20260126`
|
||||
files with separate snippets, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1161,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *locally copy or move* (relocate) SAS packages, version `20260126`
|
||||
Macro to *locally copy or move* (relocate) SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1273,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>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to check if the `packages` fileref is "correct", version `20260126`
|
||||
Macro to check if the `packages` fileref is "correct", version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1324,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro prints help notes for SAS Packages Framework macros, version `20260126`
|
||||
Macro prints help notes for SAS Packages Framework macros, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1374,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *create bundles* of SAS packages, version `20260126`
|
||||
Macro to *create bundles* of SAS packages, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1411,7 +1605,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
- `packagesRef=` *Optional.* Fileref to location of packages for the
|
||||
bundle. Default value is `packages`.
|
||||
|
||||
- `ods=` *Optional.* Name of SAS data set for the report.
|
||||
- `ods=` *Optional.* V7 style name of SAS data set for report.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@@ -1443,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>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *extract* SAS packages from a bundle, version `20260126`
|
||||
Macro to *extract* SAS packages from a bundle, version `20260602`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1475,11 +1669,20 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
- `packagesRef=` *Optional.* Fileref to location where packages will
|
||||
be extracted. Default value is `packages`.
|
||||
|
||||
- `ods=` *Optional.* Name of SAS data set for the report.
|
||||
- `ods=` *Optional.* V7 style name of SAS data set for report.
|
||||
|
||||
- `verify=` *Optional.* Indicates if verification code should
|
||||
be executed after bundle extraction.
|
||||
Value `1` means yes, Value `0` means no.
|
||||
Value `1` means yes, Value `0` (default) means no.
|
||||
|
||||
- `reportOnly=` *Optional.* Indicates if packages unbundling should
|
||||
be suspended and only a report with bundle content
|
||||
be produced and printed.
|
||||
Value `1` means yes, Value `0` (default) means no.
|
||||
|
||||
- `quiet=` *Optional.* Indicates if printout of the summary report
|
||||
should be suspended.
|
||||
Value `1` means yes, Value `0` (default) means no.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
+1188
-226
File diff suppressed because it is too large
Load Diff
+15
-15
@@ -10,7 +10,7 @@ Packages:
|
||||
|
||||
---
|
||||
|
||||
- **SQLinDS**\[2.3.2\], based on Mike Rhoads' article *Use the Full Power of SAS in Your Function-Style Macros*. The package allows to write SQL queries in the data step, e.g.
|
||||
- **SQLinDS**\[2.4.0\], based on Mike Rhoads' article *Use the Full Power of SAS in Your Function-Style Macros*. The package allows to write SQL queries in the data step, e.g.
|
||||
```sas
|
||||
data class;
|
||||
set %SQL(
|
||||
@@ -22,13 +22,13 @@ data class;
|
||||
WH = weight + height;
|
||||
run;
|
||||
```
|
||||
SHA256 digest for SQLinDS: F*CEAA4C90515F6E8AACBFFD55ABA6544E399EDBE0A7081107B62DCEE6F5430A1D
|
||||
SHA256 digest for SQLinDS: F*A3DC9400DEF1403DC9E191611790244A8B0FB23303D3A98D29777E46A1D4E8B4
|
||||
|
||||
[Documentation for SQLinDS](https://github.com/SASPAC/blob/main/sqlinds.md "Documentation for SQLinDS")
|
||||
[Documentation for SQLinDS](https://github.com/SASPAC/sqlinds/blob/main/sqlinds.md "Documentation for SQLinDS")
|
||||
|
||||
---
|
||||
|
||||
- **DFA** (Dynamic Function Arrays)\[0.5.8\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
- **DFA** (Dynamic Function Arrays)\[0.5.10\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
```sas
|
||||
%createDFArray(ArrDynamic, resizefactor=17);
|
||||
|
||||
@@ -55,13 +55,13 @@ data _null_;
|
||||
end;
|
||||
run;
|
||||
```
|
||||
SHA256 digest for DFA: F*643FBE2B7AE1425FC0240139813B93AE2C6BCFFDF6A0CFAEBEC11F83D3548E57
|
||||
SHA256 digest for DFA: F*C1E5126D8EDE050A758BCB5DCCA56A37125B3646CE75F1CF41EDE00890901AD9
|
||||
|
||||
[Documentation for DFA](https://github.com/SASPAC/blob/main/dfa.md "Documentation for DFA")
|
||||
[Documentation for DFA](https://github.com/SASPAC/dfa/blob/main/dfa.md "Documentation for DFA")
|
||||
|
||||
---
|
||||
|
||||
- **macroArray**\[1.3.1\], implementation of an array concept in a macro language, e.g.
|
||||
- **macroArray**\[1.3.2\], implementation of an array concept in a macro language, e.g.
|
||||
```sas
|
||||
%array(ABC[17] (111:127), macarray=Y);
|
||||
|
||||
@@ -80,13 +80,13 @@ SHA256 digest for DFA: F*643FBE2B7AE1425FC0240139813B93AE2C6BCFFDF6A0CFAEBEC11F8
|
||||
which = 1:H:2
|
||||
);
|
||||
```
|
||||
SHA256 digest for macroArray: F*9DA64CA9A745E1DB7176F7AF4459BB014F61F71626473ABF6471A32689E14FF1
|
||||
SHA256 digest for macroArray: F*35A657517CD2B1AB86C4E7C5320B5EDDDFBA9348075AE31DDAF875CF0CC193C9
|
||||
|
||||
[Documentation for macroArray](https://github.com/SASPAC/blob/main/macroarray.md "Documentation for macroArray")
|
||||
[Documentation for macroArray](https://github.com/SASPAC/macroarray/blob/main/macroarray.md "Documentation for macroArray")
|
||||
|
||||
---
|
||||
|
||||
- **BasePlus**\[3.1.2\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
- **BasePlus**\[3.2.0\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
```sas
|
||||
call arrMissToRight(myArray);
|
||||
call arrFillMiss(17, myArray);
|
||||
@@ -120,13 +120,13 @@ format x bool.;
|
||||
|
||||
%workLib(ABC)
|
||||
```
|
||||
SHA256 digest for BasePlus: F*91A5AD4709A418704315EF37DDCF954522D4FB42808D406B3ED4DA560F6864C6
|
||||
SHA256 digest for BasePlus: F*F85189F1AF33755A7C9F05673A8094AE3245A21C8B602E02C20170A4DCF73890
|
||||
|
||||
[Documentation for BasePlus](https://github.com/SASPAC/blob/main/baseplus.md "Documentation for BasePlus")
|
||||
[Documentation for BasePlus](https://github.com/SASPAC/baseplus/blob/main/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
---
|
||||
|
||||
- **GSM** (Generate Secure Macros)\[0.22.2\], package allows
|
||||
- **GSM** (Generate Secure Macros)\[0.22.3\], package allows
|
||||
to create secured macros stored in SAS Proc FCMP functions.
|
||||
The dataset with functions can be shared between different operating systems
|
||||
and allows to generate macros on site without showing their code.
|
||||
@@ -135,9 +135,9 @@ SHA256 digest for BasePlus: F*91A5AD4709A418704315EF37DDCF954522D4FB42808D406B3E
|
||||
|
||||
[The WUSS 2023 Conference article describing the idea](https://www.wuss.org/proceedings/2023/WUSS-2023-Paper-189.pdf "Article about the idea GSM")
|
||||
|
||||
SHA256 digest for GSM: F*7A4FEC410DEB921613A33F154FBBE332D7EC4C4DAC1351A4E611D986489EE848
|
||||
SHA256 digest for GSM: F*411452E8388C181800023A01A3B7DC7904A80A915D506D9606638F27CBC282B1
|
||||
|
||||
[Documentation for GSM](https://github.com/SASPAC/blob/main/gsm.md "Documentation for GSM")
|
||||
[Documentation for GSM](https://github.com/SASPAC/gsm/blob/main/gsm.md "Documentation for GSM")
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/* 20260528 */
|
||||
BasePlus: F*F85189F1AF33755A7C9F05673A8094AE3245A21C8B602E02C20170A4DCF73890
|
||||
|
||||
/* 20260512 */
|
||||
BasePlus: F*2308959251D1BF9259B693EB8C60D30D24D5D7E06AED05A03639A7C7E458658F
|
||||
|
||||
/* 20260511 */
|
||||
SQLinDS: F*A3DC9400DEF1403DC9E191611790244A8B0FB23303D3A98D29777E46A1D4E8B4
|
||||
|
||||
/* 20260217 */
|
||||
BasePlus: F*BD248E5F8CBD94B5F45467B723A73D97D646CD665BA98679F87C7A03A484E83E
|
||||
DFA: F*C1E5126D8EDE050A758BCB5DCCA56A37125B3646CE75F1CF41EDE00890901AD9
|
||||
GSM: F*411452E8388C181800023A01A3B7DC7904A80A915D506D9606638F27CBC282B1
|
||||
macroArray: F*35A657517CD2B1AB86C4E7C5320B5EDDDFBA9348075AE31DDAF875CF0CC193C9
|
||||
SQLinDS: F*6CC51325BDCE164B2E811896DD1C3A6D44242F50CC313D0721350CA49975F628
|
||||
|
||||
/* 20260202 */
|
||||
BasePlus: F*B762F900EEFF7035880891D89416C0F973E4D377BCB75486283363A9BDADBA82
|
||||
DFA: F*17C88537F5FA9BCFAA1AC4803D0F1EF47665C8446A44C82B5558A08315DF0C49
|
||||
|
||||
/* 20260126 */
|
||||
BasePlus: F*91A5AD4709A418704315EF37DDCF954522D4FB42808D406B3ED4DA560F6864C6
|
||||
DFA: F*643FBE2B7AE1425FC0240139813B93AE2C6BCFFDF6A0CFAEBEC11F83D3548E57
|
||||
|
||||
+12
-11
@@ -9,23 +9,21 @@
|
||||
### Version information:
|
||||
|
||||
- Package: BasePlus
|
||||
- Version: 3.1.2
|
||||
- Generated: 2026-01-26T15:57:25
|
||||
- Version: 3.2.0
|
||||
- Generated: 2026-05-28T12:00:14
|
||||
- Author(s): Bartosz Jablonski (yabwon@gmail.com), contributors are Quentin McMullen (qmcmullen@gmail.com) and Ryo Nakaya (nakaya.ryou@gmail.com)
|
||||
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- License: MIT
|
||||
- File SHA256: `F*91A5AD4709A418704315EF37DDCF954522D4FB42808D406B3ED4DA560F6864C6` for this version
|
||||
- Content SHA256: `C*BB61DE3ECA8293AD1CFCE9A6BF5E175B7CFDB75DF063D6070783B75F7B97CE61` for this version
|
||||
- File SHA256: `F*F85189F1AF33755A7C9F05673A8094AE3245A21C8B602E02C20170A4DCF73890` for this version
|
||||
- Content SHA256: `C*2216D9556FF51EDABAACBBFED7D30D5B46519083F7217A647A505C2F9FAB3634` for this version
|
||||
|
||||
---
|
||||
|
||||
# The `BasePlus` package, version: `3.1.2`;
|
||||
# The `BasePlus` package, version: `3.2.0`;
|
||||
|
||||
---
|
||||
|
||||
|
||||
# The BasePlus package [ver. 3.1.2] <a name="baseplus-package"></a> ###############################################
|
||||
|
||||
The **BasePlus** package implements useful
|
||||
functions and functionalities I miss in the BASE SAS.
|
||||
|
||||
@@ -409,9 +407,9 @@ localization (only if additional content was deployed during the installation pr
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
*SAS package generated by SAS Package Framework, version `20260125`,*
|
||||
*SAS package generated by SAS Package Framework, version `20260515`,*
|
||||
*under `WIN`(`X64_10PRO`) operating system,*
|
||||
*using SAS release: `9.04.01M9P06042025`.*
|
||||
*using SAS release: `9.04.01M9P06052025`.*
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -880,8 +878,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
|
||||
* `backslashSens=0` - *Optional*, if not zero then it indicates
|
||||
that backslash(`\`) symbol in files and dirs
|
||||
names is detectable under Linux. Accepted
|
||||
values: `0` and `1`. Ignored under Windows.
|
||||
names is detectable under Linux. Additionally,
|
||||
for a square-bracket (`[` or `]`), it turns
|
||||
off their special meaning under Linux.
|
||||
Accepted values: `0` and `1`.
|
||||
Ignored under Windows.
|
||||
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
Binary file not shown.
+6
-8
@@ -9,23 +9,21 @@
|
||||
### Version information:
|
||||
|
||||
- Package: DFA
|
||||
- Version: 0.5.8
|
||||
- Generated: 2026-01-26T15:19:02
|
||||
- Version: 0.5.10
|
||||
- Generated: 2026-02-17T12:17:54
|
||||
- Author(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- License: MIT
|
||||
- File SHA256: `F*643FBE2B7AE1425FC0240139813B93AE2C6BCFFDF6A0CFAEBEC11F83D3548E57` for this version
|
||||
- Content SHA256: `C*E2E883D8F8A7F7FCB97C2B7240FD5E70A8A6F2A6B3F0F75119F47886338C6B0C` for this version
|
||||
- File SHA256: `F*C1E5126D8EDE050A758BCB5DCCA56A37125B3646CE75F1CF41EDE00890901AD9` for this version
|
||||
- Content SHA256: `C*EE048846A8155C317867DCDB8EE1AE9E0352235DC247E4379D101A7296BD0C07` for this version
|
||||
|
||||
---
|
||||
|
||||
# The `DFA` package, version: `0.5.8`;
|
||||
# The `DFA` package, version: `0.5.10`;
|
||||
|
||||
---
|
||||
|
||||
|
||||
# The DFA package [ver. 0.5.8] <a name="dfa-package"></a> ###############################################
|
||||
|
||||
The **DFA** (a.k.a. *Dynamic Function Array*) package implements:
|
||||
- dynamic numeric and character arrays,
|
||||
- dynamic stacks (filo),
|
||||
@@ -56,7 +54,7 @@ Required SAS Components:
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
*SAS package generated by SAS Package Framework, version `20260125`,*
|
||||
*SAS package generated by SAS Package Framework, version `20260216`,*
|
||||
*under `WIN`(`X64_10PRO`) operating system,*
|
||||
*using SAS release: `9.04.01M9P06042025`.*
|
||||
|
||||
|
||||
Binary file not shown.
+6
-8
@@ -9,23 +9,21 @@
|
||||
### Version information:
|
||||
|
||||
- Package: GSM
|
||||
- Version: 0.22.2
|
||||
- Generated: 2026-01-26T16:44:38
|
||||
- Version: 0.22.3
|
||||
- Generated: 2026-02-17T12:08:56
|
||||
- Author(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- License: MIT
|
||||
- File SHA256: `F*7A4FEC410DEB921613A33F154FBBE332D7EC4C4DAC1351A4E611D986489EE848` for this version
|
||||
- Content SHA256: `C*99444DE5A473D3F92374ACE917E29E77C1F94BF77E06436695B06B85705606C7` for this version
|
||||
- File SHA256: `F*411452E8388C181800023A01A3B7DC7904A80A915D506D9606638F27CBC282B1` for this version
|
||||
- Content SHA256: `C*1955721DDAAE32A631A8071BEE3BC6CF83761C2280DA5F823D4E4CFD96838FD3` for this version
|
||||
|
||||
---
|
||||
|
||||
# The `GSM` package, version: `0.22.2`;
|
||||
# The `GSM` package, version: `0.22.3`;
|
||||
|
||||
---
|
||||
|
||||
|
||||
# The GSM package [ver. 0.22.2] <a name="gsm-package"></a> ###############################################
|
||||
|
||||
The **GSM** (a.k.a. *Generate Secure Macros*) package allows
|
||||
to create secured macros stored in SAS Proc FCMP functions.
|
||||
The dataset with functions can be shared and allows to generate
|
||||
@@ -122,7 +120,7 @@ localization (only if additional content was deployed during the installation pr
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
*SAS package generated by SAS Package Framework, version `20260126`,*
|
||||
*SAS package generated by SAS Package Framework, version `20260216`,*
|
||||
*under `WIN`(`X64_10PRO`) operating system,*
|
||||
*using SAS release: `9.04.01M9P06042025`.*
|
||||
|
||||
|
||||
Binary file not shown.
+14
-6
@@ -9,17 +9,17 @@
|
||||
### Version information:
|
||||
|
||||
- Package: macroArray
|
||||
- Version: 1.3.1
|
||||
- Generated: 2026-01-26T15:33:03
|
||||
- Version: 1.3.2
|
||||
- Generated: 2026-02-17T08:51:01
|
||||
- Author(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- License: MIT
|
||||
- File SHA256: `F*9DA64CA9A745E1DB7176F7AF4459BB014F61F71626473ABF6471A32689E14FF1` for this version
|
||||
- Content SHA256: `C*15A52658C8CBF9AB36AB1CA847FA628CCC6E9C67F625FFD3A959EB191445F780` for this version
|
||||
- File SHA256: `F*35A657517CD2B1AB86C4E7C5320B5EDDDFBA9348075AE31DDAF875CF0CC193C9` for this version
|
||||
- Content SHA256: `C*DE477F4E280D438B364320F324C88DA3D336F102BA37810C60BDE15398DE84E9` for this version
|
||||
|
||||
---
|
||||
|
||||
# The `macroArray` package, version: `1.3.1`;
|
||||
# The `macroArray` package, version: `1.3.2`;
|
||||
|
||||
---
|
||||
|
||||
@@ -43,6 +43,14 @@ Some of components are:
|
||||
- `%mcDictionary()`,
|
||||
- etc.
|
||||
|
||||
Read this article to learn more:
|
||||
"Macro Variable Arrays Made Easy with macroArray SAS Package"
|
||||
|
||||
Link to the text:
|
||||
`https://www.lexjansen.com/pharmasug/2024/AP/PharmaSUG-2024-AP-108.pdf`
|
||||
or
|
||||
`https://www.lexjansen.com/wuss/2024/124_FINAL_paper_pdf.pdf`
|
||||
|
||||
*Note:*
|
||||
If you are working with BIG macroarrays do not
|
||||
forget to verify your session setting for macro
|
||||
@@ -75,7 +83,7 @@ Required SAS Components:
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
*SAS package generated by SAS Package Framework, version `20260126`,*
|
||||
*SAS package generated by SAS Package Framework, version `20260216`,*
|
||||
*under `WIN`(`X64_10PRO`) operating system,*
|
||||
*using SAS release: `9.04.01M9P06042025`.*
|
||||
|
||||
|
||||
Binary file not shown.
+28
-14
@@ -9,23 +9,21 @@
|
||||
### Version information:
|
||||
|
||||
- Package: SQLinDS
|
||||
- Version: 2.3.2
|
||||
- Generated: 2026-01-26T15:36:16
|
||||
- Version: 2.4.0
|
||||
- Generated: 2026-05-11T14:15:07
|
||||
- Author(s): Mike Rhoads (RhoadsM1@Westat.com), contributor Bartosz Jablonski
|
||||
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
|
||||
- License: MIT
|
||||
- File SHA256: `F*CEAA4C90515F6E8AACBFFD55ABA6544E399EDBE0A7081107B62DCEE6F5430A1D` for this version
|
||||
- Content SHA256: `C*BD9C8A88831541082BEFC07954D5CDB4A6827D1A7902B911221AC6FE712A087E` for this version
|
||||
- File SHA256: `F*A3DC9400DEF1403DC9E191611790244A8B0FB23303D3A98D29777E46A1D4E8B4` for this version
|
||||
- Content SHA256: `C*4A49F365C4EF8C5523393FDC1E11C344B023F449B3F1759BA27CFC6C1293A499` for this version
|
||||
|
||||
---
|
||||
|
||||
# The `SQLinDS` package, version: `2.3.2`;
|
||||
# The `SQLinDS` package, version: `2.4.0`;
|
||||
|
||||
---
|
||||
|
||||
|
||||
### The SQLinDS package [ver. 2.3.2]
|
||||
|
||||
The **SQLinDS** package is an implementation of
|
||||
the *macro-function-sandwich* concept introduced in the
|
||||
*"Use the Full Power of SAS in Your Function-Style Macros"*,
|
||||
@@ -77,9 +75,9 @@ localization (only if additional content was deployed during the installation pr
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
*SAS package generated by SAS Package Framework, version `20260126`,*
|
||||
*SAS package generated by SAS Package Framework, version `20260411`,*
|
||||
*under `WIN`(`X64_10PRO`) operating system,*
|
||||
*using SAS release: `9.04.01M9P06042025`.*
|
||||
*using SAS release: `9.04.01M9P06052025`.*
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -157,18 +155,18 @@ Copy of the article can also be found in *additional content* directory.
|
||||
%sql(<nonempty Proc SQL query code>)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The THE query code is limited to approximately *32000* bytes.
|
||||
The query code is limited to approximately *32000* bytes.
|
||||
|
||||
### EXAMPLES: #################################################################
|
||||
|
||||
**EXAMPLE 1**: simple SQL query
|
||||
**EXAMPLE 1**: A simple SQL query.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data class_subset;
|
||||
set %SQL(select name, sex, height from sashelp.class where age > 12);
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 2**: query with dataset options
|
||||
**EXAMPLE 2**: A query with dataset options.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data renamed;
|
||||
set %SQL(select name, age from sashelp.class
|
||||
@@ -177,12 +175,28 @@ data renamed;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 3**: Proc SQL dictionaries in the data step
|
||||
**EXAMPLE 3**: Proc SQL dictionaries in the data step.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data dictionary;
|
||||
set %SQL(select dict.* from dictionary.macros as dict);
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 4**: Use Proc SQL to populate hash table.
|
||||
Call to `%SQL()` has to be in double-quotes.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data _null_;
|
||||
if 0 then set %SQL(SELECT name, age FROM sashelp.class);
|
||||
|
||||
declare hash H (dataset: "%SQL(SELECT name, age FROM sashelp.class)") ;
|
||||
H.defineKey("age");
|
||||
H.defineKey("name");
|
||||
H.defineDone();
|
||||
|
||||
H.output(dataset:"output");
|
||||
stop;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
---
|
||||
|
||||
|
||||
@@ -235,7 +249,7 @@ run he following:
|
||||
|
||||
# License <a name="license"></a> ######
|
||||
|
||||
Copyright (c) 2012 Mike Rhoads
|
||||
Copyright (c) since 2012 onward, Mike Rhoads
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user