Compare commits

...

10 Commits

Author SHA1 Message Date
Bartosz Jablonski
35e6ff8d5e SAS Packages Framework, ver. 20221112
SAS Packages Framework, ver. 20221112

Changes in `%generatePackage()` macro:
- refactoring of package metadata extraction and metadata file preparation,
- in a package folder all subfolders which name starts with `!` are ignored in the package generation process,
- in a package folder all subfolders with unknown code types are ignored in the package generation process,
- bug fix in package version extraction for required package list,
- new test added to loading test,
- documentation updated.

---

The following packages were regenerated:
- BasePlus [1.17.1]
- DFA [0.5.1]
- dynMacroArray [0.2.1]
- GSM [0.20.1]
- macroArray [1.0.1]
- SQLinDS [2.2.1]
2022-11-12 17:27:00 +01:00
Bart Jablonski
5bd013c925 "Hello World" example tutorial
"Hello World" example tutorial.
2022-11-12 00:43:12 +01:00
Bart Jablonski
2ad317db01 Create HelloWorldPackage.md 2022-11-12 00:39:23 +01:00
Bartosz Jablonski
6c38872ee2 SAS Packages Framework, ver. 20221107
**SAS Packages Framework**, ver. 20221107

- Minor update on the `%generatePackage()` macro log look.
2022-11-07 10:45:29 +01:00
Bartosz Jablonski
d35ac328cc SAS Packages Framework, ver. 20221107
**SAS Packages Framework**, ver. 20221107

- Minor update on the `%generatePackage()` macro log look.
2022-11-07 10:42:30 +01:00
Bartosz Jablonski
e3a813b257 Link to recording from the SAS Explore 2022 conference: "A BasePlus Package for SAS"
Link to recording from the SAS Explore 2022 conference: "A BasePlus Package for SAS"
2022-11-01 17:43:31 +01:00
Bartosz Jablonski
67bd3abd58 SAS Packages Framework, ver. 20221022
**SAS Packages Framework**, ver. `20221022`

In the `%generatePackage()` macro additional quality checks for files of EXEC and CLEAN types were added.
Each EXEC file should have a CLEAN file counterpart and vice versa.
- If the number of EXECs and CLEANs differs but both are positive macro issues a Warning.
- If EXECs are positive but CLEANs are zero (or other way around) macro issues an Error!

Documentation updated.
2022-10-22 22:13:50 +02:00
Bart Jablonski (yabwon)
1968330049 SAS Packages Framework, version 20221002
**SAS Packages Framework**, version `20221002`

- Modifications in the `%installPackage()` macro it is allowed to call installation of packages with version number (if used with `mirror=0`), for example: `%installPackage(baseplus(1.17) macroarray(1.0) dfa(0.5) GSM)`,

- For the `%installPackage()` and in the `%loadPackageS()` macros the list of packages standardised before execution to the form `package1(ver1) package2(ver2) package3(ver3)`,

- Fix for directories "with spaces" for `%installPackage()`.

- Documentation updated.
2022-10-01 12:11:40 +02:00
Bart Jablonski (yabwon)
7e202f81ff SAS Packages Framework, version 20221001
**SAS Packages Framework**, version 20221001

Update in setting package version.
- Modified macros: `%loadPackage()` and `%generatePackage()`.
- The `major.minor.patch` approach is also accepted accepted. Now package version can be: `X`, `X.Y`, or `X.Y.Z`. Missing parts are treated as 0, e.g. 1 is equivalent with 1.0.0, 1.2 is 1.2.0, and .2 is 0.2.0.

Modification in path for mirror 0 in the `%installPackage()` macro, it is `https://github.com/SASPAC/` now.
2022-10-01 01:02:59 +02:00
Bart Jablonski (yabwon)
26d9c735fe **SAS Packages Framework**, version 20220930.
**SAS Packages Framework**, version 20220930.

- In `%installPackage()` macro:
  - New parameter  `version=`  added. Indicates which historical version of a package to install. Historical version are available only if `mirror=0` is set. Default value is null which means "install the latest".
  - New default value for `mirror` parameter set to 0
- New repository dedicated for SAS Packages created: the *SASPAC - SAS Packages Archive* introduced under: `https://github.com/SASPAC`. Each package has its own project with historical versions in it.
- Documentation updated.
2022-09-30 20:27:23 +02:00
29 changed files with 1079 additions and 304 deletions

127
README.md
View File

@@ -8,7 +8,13 @@ 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 **`20220925`**.
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages.
---
### Current version:
**The latest version** of SPF is **`20221112`**.
To get started with SAS Packages try this [**`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).
@@ -16,13 +22,18 @@ The documentation and more advance reading would be the [**`SAS(r) packages - th
Short description of the SAS Packages Framework macros can be found [here](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/SPFinit.md "Short description of the SAS Packages Framework macros")
**Videos** (the newer the better):
### Recordings and Presentations:
- [SAS Global Forum 2020 V.E.](https://www.youtube.com/watch?v=qCkb-bx0Dv8&t=0s "SGF2020") (April 2020)
- [Sasensei International Dojo](https://www.youtube.com/watch?v=BFhdUBQgjYQ&t=0s "SID no. 1") (April 2020)
- [SAS dla Administratorów i Praktyków 2020](https://www.youtube.com/watch?v=mXuep2k48Z8&feature=youtu.be&t=0s "SASAiP2020") (October 2020, in Polish)
- [Boston Area SAS Users Group webinar](https://www.basug.org/videos?wix-vod-video-id=78067e61413d43d3a6951974b3bc3014&wix-vod-comp-id=comp-klv807gt "BASUG") (November 2020)
- [SAS Global Forum 2021 V.E.](https://www.youtube.com/watch?v=hqexaQtGw88 "SGF2021") (May 20th, 2021)
Videos presenting the SPF and packages, from various conferences and meetups (the newer the better):
- ["SAS Packages: The Way to Share" - SAS Global Forum 2020 V.E.](https://www.youtube.com/watch?v=qCkb-bx0Dv8&t=0s "SGF2020") (April 2020, ~20 minutes, general overview but with a bit obsolete technical details)
- ["SAS Packages: The Way to Share" - SaSensei International Dojo No. 1](https://www.youtube.com/watch?v=BFhdUBQgjYQ&t=0s "SID no. 1") (April 2020, ~28 minutes, general overview but with a bit obsolete technical details)
- ["Co nowego z pakietami SAS?" - SAS dla Administratorów i Praktyków 2020](https://www.youtube.com/watch?v=mXuep2k48Z8&feature=youtu.be&t=0s "SASAiP2020") (October 2020, in Polish, ~41 minutes, general overview and technical details how to use SPF)
- ["SAS Packages - The Way to Share" - Boston Area SAS Users Group webinar](https://www.basug.org/videos?wix-vod-video-id=78067e61413d43d3a6951974b3bc3014&wix-vod-comp-id=comp-klv807gt "BASUG") (November 2020, ~59 minutes, general overview and technical details how to use SPF)
- ["My First SAS Package: A How-To" - SAS Global Forum 2021 V.E.](https://www.youtube.com/watch?v=hqexaQtGw88 "SGF2021") (May 20th 2021, ~59 minutes, technical workshop on how to create a package)
- ["Kod SASowy ukryty na widoku" - SAS dla Administratorów i Praktyków 2021](https://www.youtube.com/watch?v=LtaWPe2sgRY&t=1s) (November 24th 2021, in Polish, ~34 minutes, technical presentation with details about the GSM package)
- ["A BasePlus Package for SAS" - SAS Explore 2022](https://communities.sas.com/t5/SAS-Explore-Presentations/A-BasePlus-Package-for-SAS/ta-p/838246 "SASexplore2022") (September 27th-29th 2022, ~28 minutes, technical presentation with details about the BasePlus package)
- ["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, ~28 minutes, general overview but with a bit obsolete technical details)
---
@@ -33,53 +44,96 @@ A **SASware Ballot Idea** for adding *SAS Packages Framework* macros into Base S
---
### The User:
To use a package:
- Create a folder for your packages, under Windows OS family, e.g. `C:/SAS_PACKAGES` or under Linux/UNIX OS family, e.g. `/home/<username>/SAS_PACKAGES`.
The first step to use a package with the SAS Packages Framework:
- Create a folder for your packages, under Windows OS family e.g., `C:/SAS_PACKAGES` or under Linux/UNIX OS family e.g., `/home/<username>/SAS_PACKAGES`.
and then either:
- Download the `SPFinit.sas` file (the SAS Packages Framework) into the local packages folder.
- Manually download the `SPFinit.sas` file (the SAS Packages Framework) into the local packages folder.
- \[Optional\] Manually download the `<packageName>.zip` file into the local packages folder.
- and Execute:
```sas
filename packages "<directory/containing/packages/>"; /* setup directory for packages */
%include packages(SPFinit.sas); /* enable the framework */
filename packages "<directory/containing/packages/>"; /* setup directory for packages */
%include packages(SPFinit.sas); /* enable the framework */
/* %installPackage(packageName) */ /* install the package, unless you downloaded it manually */
/* %installPackage(packageName) */ /* install the package, unless you downloaded it manually */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
```
or if you need it just for "one time" only Execute:
or if you need it just for "one time" only:
- Execute:
```sas
filename packages "%sysfunc(pathname(work))"; /* setup temporary directory for packages in the WORK */
filename packages "%sysfunc(pathname(work))"; /* setup WORK as temporary directory for packages */
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */
%installPackage(packageName) /* install the package */
%installPackage(packageName) /* install a package */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
```
[**Workshop video for the User**](https://youtu.be/qX_-HJ76g8Y) \[May 6th, 2020\] [a bit outdated but gives the idea how it works]
or do it pragmatically:
- Enable the framework [first time only]:
```sas
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */
```
- Install the framework on your machine in the folder you created:
```sas
filename packages "<directory/containing/packages/>";
%installPackage(SPFinit) /* install the framework */
```
- And from now on run it like this:
```sas
filename packages "<directory/containing/packages/>";
%include packages(SPFinit.sas);
%installPackage(packageName) /* install a package */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
```
---
[**Workshop video for the User**](https://youtu.be/qX_-HJ76g8Y) \[May 6th, 2020\] [~86 minutes, a bit outdated (installPackage macro was not there yet) but gives the idea how it works especially load, help, unload, ICEload, and other details]
---
### The Developer:
To create your own package:
- Download (and use) the `SPFinit.sas` file (the SAS Packages Framework), the part of the framework required for *testing* is there too.
- See this ["Hello World" example tutorial.](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/HelloWorldPackage.md "Hello World")
- Read the [**`SAS Packages - The Way to Share (a How-To) - Paper 4725-2020 - extended version`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") article to learn more details.
- Read the **`My First SAS Package: A How-To - Paper 1079-2021`** article available at communities.sas.com [**`here`**](https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/My-First-SAS-Package-A-How-To/ta-p/726319 "My First SAS Package: A How-To") or locally [**`here`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Paper_1079-2021/My%20First%20SAS%20Package%20-%20a%20How%20To.pdf "My First SAS Package: A How-To")
- Download and use the `SPFinit.sas` file (the SAS Packages Framework), the part of the framework required for *testing* is there too.
---
#### If you have any questions, suggestions, or ideas do not hesitate to contact me!
### If you have any questions, suggestions, or ideas do not hesitate to contact me!
---
### Updates worth mentioning:
**Update**\[September 30th, 2022\]**:** **New dedicated repository:** *SASPAC - the SAS Packages Archive* **is available as new location for packages storage**. Location of SASPAC is: [`https://github.com/SASPAC`](https://github.com/SASPAC)
**Update**\[November 11th, 2021\]**:** `%extendPackagesFileref()` **macro is available**.
**Update**\[October 15th, 2020\]**:** `%previewPackage()` **macro is available**.
@@ -105,15 +159,20 @@ If you find the SPF useful **share info** about it or **give it a [star](https:/
---
## Available packages:
Currently the following packages are available (see the `./packages` directory):
- **SQLinDS**\[2.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.
**(!)** For "backward compatibility"/historical point of view the following packages are available under the `./packages` directory.
**(!)** Since *September 2022* the default location for packages is **SASPAC - the SAS Packages Archive** located under: [`https://github.com/SASPAC`](https://github.com/SASPAC) where each package is stored as a separate repository with historical versions too.
Packages:
- **SQLinDS**\[2.2.1\], 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(select * from sashelp.class order by age);
run;
```
SHA256 digest for SQLinDS: 96D0EFE02DF1AE0D7D875A10CAF7EF63CDEF85DD0CF9418934BEFAF0C067D453
SHA256 digest for SQLinDS: A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/sqlinds.md "Documentation for SQLinDS")
@@ -123,13 +182,13 @@ SHA256 digest for MacroCore: A23C29529F3CE7D0C8BEE9545C5D22D5B5594907547374A5135
[Documentation for MacroCore](https://core.sasjs.io "Documentation for MacroCore")
- **DFA** (Dynamic Function Arrays)\[0.5\], 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.1\], 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.
SHA256 digest for DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491
SHA256 digest for DFA: 5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6
[Documentation for DFA](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/dfa.md "Documentation for DFA")
- **macroArray**\[1.0\], implementation of an array concept in a macrolanguage, e.g.
- **macroArray**\[1.0.1\], implementation of an array concept in a macrolanguage, e.g.
```sas
%array(ABC[17] (111:127), macarray=Y);
@@ -148,12 +207,12 @@ SHA256 digest for DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC353
which = 1:H:2
);
```
SHA256 digest for macroArray: ED12BC96F8A4E9E7C4D651EC1E15479DB9B55D98B274B63C507ED842081F7AB7
SHA256 digest for macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
- **BasePlus**\[1.17\] adds a bunch of functionalities I am missing in BASE SAS, such as:
- **BasePlus**\[1.17.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
```sas
call arrMissToRight(myArray);
call arrFillMiss(17, myArray);
@@ -171,21 +230,21 @@ format x bool.;
%zipLibrary(sashelp,libOut=work)
```
SHA256 digest for BasePlus: 56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C
SHA256 digest for BasePlus: A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
- **GSM** (Generate Secure Macros)\[0.20\], package allows
- **GSM** (Generate Secure Macros)\[0.20.1\], 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.
SHA256 digest for GSM: 2AEBC150FBA99A4AAB0265A21C57E89200BFD96B633B898F32743D1C8831A159
SHA256 digest for GSM: 5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922
[Documentation for GSM](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md "Documentation for GSM")
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
- **dynMacroArray**\[0.2.1\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA). Development of this package is currently on hold.
SHA256 digest for dynMacroArray: D7E0B8F85C05EBF8622204E0D2F3E990D48D0A9B3911051C3AD44DC98954DDCF
SHA256 digest for dynMacroArray: C987C08615A53D7BD7AEC3911EADF436C676EAB3E233E7E422E42995B890E169
### ======

View File

@@ -0,0 +1,131 @@
## The "Hello World" Package
---
This is a "Hello World" example on how to build your first package with help of the SAS Packages Framework.
We will generate a `HelloWorld` package.
Follow the step by step instruction below.
---
`Step 1.` Create a folder for the framework e.g.,
`/home/<myUserName>/SASpackages` or `C:/SASpackages`
`Step 2.` Run the following code to install The SAS Packages Framework
in the folder you created in the `Step 1.`
```sas
filename packages "<put/folder/from/the/step/one/here>";
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit;
%installPackage(SPFinit)
```
Check out the *log* to verify if the `Step 2.` was successful.
If it was - then continue.
`Step 3.` Create a folder for the content of the package we will generate e.g.,
`/home/<myUserName>/HelloWorldPackage` or `C:/HelloWorldPackage`
`Step 4.` Inside the directory from the `Step 3.` create two sub-folders: `01_formats`
and `02_macros`. Remember to use *lower case letters* only!
`Step 5.` Inside the `01_formats` folder create a `helloworldformat.sas` file.
Remember to use lower case letters in the file name. Copy-paste below code
into that file:
```sas
/*** HELP START ***//*
This is a help info for the HelloWorldFormat. format
*//*** HELP END ***/
value HelloWorldFormat
1 = " Hello"
2 = " SAS"
3 = " Packages"
4 = " World"
other = "!"
;
```
`Step 6.` Inside the `02_macros` folder create a `helloworldmacro.sas` file.
Remember to use lower case letters in the file name. Copy-paste below code
into that file:
```sas
/*** HELP START ***//*
This is a help info for the helloWorldMacro() macro
*//*** HELP END ***/
%macro HelloWorldMacro(n);
data _null_;
do i = 1 to &n.;
put i HelloWorldFormat. @;
end;
run;
%mend HelloWorldMacro;
```
`Step 7.` Inside the directory from the `Step 3.` create a `description.sas` file.
Remember to use lower case letters in the file name. Copy-paste below text
into that file, adjust lines 5 and 6:
```txt
Type: Package
Package: helloWorld
Title: My Hello World SAS package.
Version: 1.0
Author: <myFirstname> <myLastname> (my@mail.com)
Maintainer: <myFirstname> <myLastname> (my@mail.com)
License: MIT
Encoding: UTF8
Required: "Base SAS Software"
DESCRIPTION START:
## My "Hello World" SAS package ##
The "Hello World" is my first SAS package and
for sure it will not be the last package one!
DESCRIPTION END:
```
`Step 8.` Execute the following code and check the log
to read the `%generatePackage()` macro help info.
```sas
%generatePackage()
```
`Step 9.` Execute the following code using the folder
from the `Step 3.` and check the log to see how
the process of package generation went.
```sas
%generatePackage(
filesLocation=<put/folder/from/the/step/three/here>
)
```
`Step 10.` See the information in the output window and in the log.
The `WARNING:[License] No license.sas file provided, default (MIT) licence file will be generated.` can be ignored.
`Step 11.` Check the directory from the `Step 3.` and look for the `helloworld.zip` package file.
---
`Step 12.` Start a new SAS session, run the following code, and investigate the log:
```sas
filename packages ("<put/folder/from/the/step/one/here>" "<put/folder/from/the/step/three/here>");
%include packages(SPFinit.sas);
%loadPackage(HelloWorld)
%HelloWorldMacro(7)
```
### Congratulations!! You created your first HelloWorld package.

View File

@@ -6,7 +6,7 @@
when empty the "packages" value is used */
)/secure
/*** HELP END ***/
des = 'Macro to list directories pointed by "packages" fileref, version 20220925. Run %extendPackagesFileref(HELP) for help info.'
des = 'Macro to list directories pointed by "packages" fileref, version 20221112. 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 20220925
%put ### This is short help information for the `extendPackagesFileref` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to list directories pointed by 'packages' fileref, version `20220925` #;
%put # Macro to list directories pointed by 'packages' fileref, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -23,7 +23,7 @@
default value 1 means "delete tests work" */
)/secure minoperator
/*** HELP END ***/
des = 'Macro to generate SAS packages, version 20220925. Run %generatePackage() for help info.'
des = 'Macro to generate SAS packages, version 20221112. Run %generatePackage() for help info.'
;
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
%do;
@@ -38,7 +38,7 @@ des = 'Macro to generate SAS packages, version 20220925. Run %generatePackage()
%put ### This is short help information for the `generatePackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to generate SAS packages, version `20220925` #;
%put # Macro to generate SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -95,6 +95,7 @@ des = 'Macro to generate SAS packages, version 20220925. Run %generatePackage()
%GOTO ENDofgeneratePackage;
%end;
%put --- generatePackage START ---;
%local zipReferrence filesWithCodes _DESCR_ _LIC_ _DUMMY_ _RC_ _PackageFileref_;
%let zipReferrence = _%sysfunc(datetime(), hex6.)_;
%let filesWithCodes = WORK._%sysfunc(datetime(), hex16.)_;
@@ -132,16 +133,19 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 1024;
infile &_DESCR_.;
input;
%local metaExtStr; /* metadata Extraction String; */
%let metaExtStr=kscanx(_INFILE_, 2, ":");
select( strip(upcase(kscanx(_INFILE_, 1, ":"))) );
when("PACKAGE") call symputX("packageName", kscanx(_INFILE_, 2, ":"),"L");
when("VERSION") call symputX("packageVersion", kscanx(_INFILE_, 2, ":"),"L");
when("AUTHOR") call symputX("packageAuthor", kscanx(_INFILE_, 2, ":"),"L");
when("MAINTAINER") call symputX("packageMaintainer", kscanx(_INFILE_, 2, ":"),"L");
when("TITLE") call symputX("packageTitle", kscanx(_INFILE_, 2, ":"),"L");
when("ENCODING") call symputX("packageEncoding", kscanx(_INFILE_, 2, ":"),"L");
when("LICENSE") call symputX("packageLicense", kscanx(_INFILE_, 2, ":"),"L");
when("REQUIRED") call symputX("packageRequired", kscanx(_INFILE_, 2, ":"),"L");
when("REQPACKAGES") call symputX("packageReqPackages", kscanx(_INFILE_, 2, ":"),"L");
when("PACKAGE") call symputX("packageName", &metaExtStr., "L");
when("VERSION") call symputX("packageVersion", &metaExtStr., "L");
when("AUTHOR") call symputX("packageAuthor", &metaExtStr., "L");
when("MAINTAINER") call symputX("packageMaintainer", &metaExtStr., "L");
when("TITLE") call symputX("packageTitle", &metaExtStr., "L");
when("ENCODING") call symputX("packageEncoding", &metaExtStr., "L");
when("LICENSE") call symputX("packageLicense", &metaExtStr., "L");
when("REQUIRED") call symputX("packageRequired", &metaExtStr., "L");
when("REQPACKAGES") call symputX("packageReqPackages", &metaExtStr., "L");
/* stop at the beginning of description */
when("DESCRIPTION START") stop;
@@ -162,13 +166,13 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 1024;
%do;
%put ERROR: At least one of descriptors is missing!;
%put ERROR- They are required to create a package.;
%put ERROR- &=packageName.;
%put ERROR- &=packageTitle.;
%put ERROR- &=packageVersion.;
%put ERROR- &=packageAuthor.;
%put ERROR- &=packageMaintainer.;
%put ERROR- &=packageEncoding.;
%put ERROR- &=packageLicense.;
%put ERROR- packageName=%superq(packageName);
%put ERROR- packageTitle=%superq(packageTitle);
%put ERROR- packageVersion=%superq(packageVersion);
%put ERROR- packageAuthor=%superq(packageAuthor);
%put ERROR- packageMaintainer=%superq(packageMaintainer);
%put ERROR- packageEncoding=%superq(packageEncoding);
%put ERROR- packageLicense=%superq(packageLicense);
%put ERROR- ;
%put ERROR- Aborting.;
%abort;
@@ -250,7 +254,7 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 1024;
put 'ERROR- ' R;
end;
else
rc = dosubl('title; options nonotes nosource ps=max ls=99 nodate nonumber nostimer;
rc = dosubl('title; options nonotes nosource ps=min ls=99 nodate nonumber nostimer;
data _null_;
length rq $ 64; put "Required:";
do rq = &packageRequired.;
@@ -300,7 +304,7 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 1024;
put 'ERROR- ' R;
end;
else
rc = dosubl('title; options nonotes nosource ps=max ls=66 nodate nonumber nostimer;
rc = dosubl('title; options nonotes nosource ps=min ls=66 nodate nonumber nostimer;
data _null_;
length rq $ 64; put "ReqPackages:";
do rq = &packageReqPackages.;
@@ -336,7 +340,11 @@ data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageN
/* test if version is a number */
data _null_;
version = input("&packageVersion.", ?? best32.);
v = "&packageVersion.";
version = coalesce(input(scan(v,1,".","M"), ?? best32.),0)*1e8
+ coalesce(input(scan(v,2,".","M"), ?? best32.),0)*1e4
+ coalesce(input(scan(v,3,".","M"), ?? best32.),0)*1e0
;
if not (version > 0) then
do;
put 'ERROR: Package version should be a positive NUMBER.';
@@ -493,6 +501,7 @@ DESCRIPTION END:
/* collect the data */
data &filesWithCodes.;
putlog "NOTE- ";
putlog "NOTE: Generating content dataset: &filesWithCodes..";
putlog "NOTE- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
putlog "NOTE- ";
@@ -506,7 +515,8 @@ data &filesWithCodes.;
folderid=dopen(folderRef);
do i=1 to dnum(folderId); drop i;
folder = dread(folderId, i);
folder = dread(folderId, i);
if folder NE lowcase(folder) then
do;
put 'ERROR: Folder should be named ONLY with low case letters.';
@@ -524,6 +534,27 @@ data &filesWithCodes.;
fileId = dopen(fileRef);
file = ' ';
/* ignore folders which name starts with ! */
if fileId AND "!" =: folder then
do;
put "INFO: Folder " folder "name starts with ! and will be ignored. " /
" No content from it will be used to generate the package." / " ";
goto ignoreFolder;
end;
/* ignore unknown types for folders */
if fileId AND not (upcase(type) in:
('LIBNAME' 'MACRO' /*'MACROS'*/ 'DATA' 'FUNCTION' /*'FUNCTIONS'*/ 'FORMAT' /*'FORMATS'*/ 'IMLMODULE' 'PROTO' 'EXEC' 'CLEAN' 'LAZYDATA' 'TEST'))
then
do;
put "WARNING: Type " type 'is not yet supported.' /
"WARNING- Folder " folder " will be ignored. " /
"WARNING- No content from it will be used to generate the package." / " ";
goto ignoreFolder;
end;
/* if it is a directory then read its content */
if fileId then
do j = 1 to dnum(fileId); drop j;
file = dread(fileId, j);
@@ -546,6 +577,8 @@ data &filesWithCodes.;
"WARNING- ";
end;
end;
ignoreFolder: ;
rc = dclose(fileId);
rc = filename(fileRef);
end;
@@ -558,6 +591,7 @@ data &filesWithCodes.;
put 'ERROR: Aborting due to previous errors.';
abort;
end;
put " ";
stop;
run;
@@ -568,6 +602,76 @@ options NOnotes NOsource;
proc sort data = &filesWithCodes.;
by order type file;
run;
/* quality check for EXEC and CLEAN types */
data _null_;
set &filesWithCodes. (where=(upcase(type) in ('EXEC' 'CLEAN'))) end=EOF;
if _N_ = 1 then
do;
declare hash EXEC(); /* store EXECs */
EXEC.defineKey('file');
EXEC.defineData('ne');
EXEC.defineDone();
declare hash CLEAN(); /* store CLEANs */
CLEAN.defineKey('file');
CLEAN.defineData('nc');
CLEAN.defineDone();
declare hash F(ordered:"A");
F.defineKey('file');
F.defineData('file');
F.defineDone();
declare hiter IF("F");
end;
F.replace();
if upcase(type) = 'EXEC' then
do;
e + 1;
if EXEC.find() then EXEC.add(key:file,data:1);
else EXEC.replace(key:file,data:ne+1);
end;
if upcase(type) = 'CLEAN' then
do;
c + 1;
if CLEAN.find() then CLEAN.add(key:file,data:1);
else CLEAN.replace(key:file,data:nc+1);
end;
if EOF then
do;
/* if number of EXECs and CLEANs differs but both are positive issue a Warning */
if (0 < e < c) or (0 < c < e) or not(EXEC.NUM_ITEMS = CLEAN.NUM_ITEMS = F.NUM_ITEMS) then
do;
put "WARNING: Number of EXEC type and CLEAN type files differs!" /
"WARNING- Each EXEC file should have CLEAN file counterpart and vice versa." /
'WARNING- Please create appropriate files and make your package a "role model".' /
'WARNING- ' /
'WARNING- The list of differences:';
do while(IF.next()=0);
ne = 0;
nc = 0;
df = EXEC.find();
df = CLEAN.find();
df = abs(ne - nc);
put "WARNING- File " file char36. "EXEC: " ne 3. +1 "CLEAN: " nc 3. +1 "diff: " df 3.;
end;
put "WARNING- ";
end;
/* if EXECs are positive but CLEANs are zero (or other way around) issue an Error */
if (0 = e < c) or (0 = c < e) then
do;
put "ERROR: There are " e "EXECs files and " c "CLEANs files!" /
"ERROR- Each EXEC file should have CLEAN file counterpart and vice versa." /
'ERROR- Please create appropriate files and make your package a "role model".' /
'ERROR: [&sysmacroname.] Aborting package generation!' ;
abort;
end;
end;
run;
/*
proc contents data = &filesWithCodes.;
run;
@@ -594,6 +698,7 @@ options &notesSourceOptions.;
/* packages description */
%put NOTE-;
%put NOTE: Preparing description file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -605,6 +710,7 @@ data _null_;
run;
/* package license */
%put NOTE-;
%put NOTE: Preparing license file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -623,8 +729,10 @@ run;
%let packageLicense = MIT;
data _null_;
file &zipReferrence.(license.sas) encoding = &packageEncoding.;
length packageAuthor $ 1024;
packageAuthor = symget('packageAuthor');
put " ";
put " Copyright (c) %sysfunc(today(),year4.) &packageAuthor. ";
put " Copyright (c) since %sysfunc(today(),year4.) " packageAuthor ;
put " ";
put " Permission is hereby granted, free of charge, to any person obtaining a copy ";
put ' of this software and associated documentation files (the "Software"), to deal ';
@@ -648,6 +756,7 @@ run;
%end;
/* package metadata */
%put NOTE-;
%put NOTE: Preparing metadata file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -660,24 +769,26 @@ data _null_;
end;
file &zipReferrence.(packagemetadata.sas) encoding = &packageEncoding.;
put ' data _null_; '; /* simple "%local" returns error while loading package */
put ' call symputX("packageName", " ", "L");';
put ' call symputX("packageVersion", " ", "L");';
put ' call symputX("packageTitle", " ", "L");';
put ' call symputX("packageAuthor", " ", "L");';
put ' call symputX("packageMaintainer", " ", "L");';
put ' call symputX("packageEncoding", " ", "L");';
put ' call symputX("packageLicense", " ", "L");';
put ' run; ';
length packageName $ 32 packageVersion $ 24
packageTitle packageAuthor packageMaintainer $ 2048
packageEncoding $ 8 packageLicense $ 128;
packageName = quote(strip(symget('packageName')),'"');
packageVersion = quote(strip(symget('packageVersion')),'"');
packageTitle = quote(strip(symget('packageTitle')),'"');
packageAuthor = quote(strip(symget('packageAuthor')),'"');
packageMaintainer = quote(strip(symget('packageMaintainer')),'"');
packageEncoding = quote(strip(symget('packageEncoding')),'"');
packageLicense = quote(strip(symget('packageLicense')),'"');
put ' %let packageName =' "&packageName.;";
put ' %let packageVersion =' "&packageVersion.;";
put ' %let packageTitle =' "&packageTitle.;";
put ' %let packageAuthor =' "&packageAuthor.;";
put ' %let packageMaintainer =' "&packageMaintainer.;";
put ' %let packageEncoding =' "&packageEncoding.;";
put ' %let packageLicense =' "&packageLicense.;";
put ' ; ';
put ' data _null_; '; /* simple "%local" returns error while loading package */
put ' call symputX("packageName", ' packageName ', "L");';
put ' call symputX("packageVersion", ' packageVersion ', "L");';
put ' call symputX("packageTitle", ' packageTitle ', "L");';
put ' call symputX("packageAuthor", ' packageAuthor ', "L");';
put ' call symputX("packageMaintainer", ' packageMaintainer ', "L");';
put ' call symputX("packageEncoding", ' packageEncoding ', "L");';
put ' call symputX("packageLicense", ' packageLicense ', "L");';
put ' run; ';
stop;
run;
@@ -696,6 +807,7 @@ run;
%ICEloadpackage(sqlinds)
*/
%put NOTE-;
%put NOTE: Preparing iceloadpackage file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -725,6 +837,15 @@ data _null_;
put ' filename &_PackageFileref_. clear; ';
/* test if required version of package is "good enough" */
put ' %local rV pV; ';
put ' %let pV = %sysfunc(compress(&packageVersion.,.,kd)); ';
put ' %let pV = %sysevalf((%scan(&pV.,1,.,M)+0)*1e8 ';
put ' + (%scan(&pV.,2,.,M)+0)*1e4 ';
put ' + (%scan(&pV.,3,.,M)+0)*1e0); ';
put ' %let rV = %sysfunc(compress(&requiredVersion.,.,kd)); ';
put ' %let rV = %sysevalf((%scan(&rV.,1,.,M)+0)*1e8 ';
put ' + (%scan(&rV.,2,.,M)+0)*1e4 ';
put ' + (%scan(&rV.,3,.,M)+0)*1e0); ';
put ' %if %sysevalf(&requiredVersion. > &packageVersion.) %then ';
put ' %do; ';
put ' %put ERROR: Required version is &requiredVersion.; ';
@@ -749,6 +870,7 @@ run;
/* loading package files */
%put NOTE-;
%put NOTE: Preparing load file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -760,10 +882,11 @@ data _null_;
put "filename &_PackageFileref_. list;" /;
put ' %put NOTE- ;';
put ' %put NOTE: ' @; put "Loading package &packageName., version &packageVersion., license &packageLicense.; ";
put ' %put NOTE: ' @; put "*** &packageTitle. ***; ";
put ' %put NOTE: ' @; put '*** %superq(packageTitle) ***; ';
put ' %put NOTE- ' @; put "Generated: %sysfunc(datetime(), datetime21.); ";
put ' %put NOTE- ' @; put "Author(s): &packageAuthor.; ";
put ' %put NOTE- ' @; put "Maintainer(s): &packageMaintainer.; ";
put ' %put NOTE- ' @; put 'Author(s): %superq(packageAuthor); ';
put ' %put NOTE- ' @; put 'Maintainer(s): %superq(packageMaintainer); ';
put ' %put NOTE- ;';
put ' %put NOTE- Run %nrstr(%%)helpPackage(' "&packageName." ') for the description;';
put ' %put NOTE- ;';
@@ -852,7 +975,7 @@ data _null_;
packageReqPackages = lowcase(symget('packageReqPackages'));
/* try to load required packages */
put 'data _null_ ; ';
put ' length req name $ 64 vers verR 8 SYSloadedPackages $ 32767; ';
put ' length req name $ 64 vers verR $ 24 versN verRN 8 SYSloadedPackages $ 32767; ';
put ' if SYMEXIST("SYSloadedPackages") = 1 and SYMGLOBL("SYSloadedPackages") = 1 then ';
put ' do; ';
put ' do until(EOF); ';
@@ -869,7 +992,7 @@ data _null_;
put ' do _N_ = 1 to countw(SYSloadedPackages); ';
put ' req = kscanx(SYSloadedPackages, _N_, " "); ';
put ' name = lowcase(strip(kscanx(req, 1, "("))); ';
put ' vers = input(compress(kscanx(req,-1, "("), ".", "KD"),best32.); ';
put ' vers = compress(kscanx(req,-1, "("), ".", "KD"); ';
put ' _RC_ = LP.add(); ';
put ' end; ';
/* check if elements of the framework are available */
@@ -879,11 +1002,21 @@ data _null_;
put ' do req = ' / packageReqPackages / ' ; ';
/* put ' req = compress(req, "(.)", "KDF"); ';*/
put ' name = lowcase(strip(kscanx(req, 1, "("))); ';
put ' verR = input(compress(kscanx(req,-1, "("), ".", "KD"),best32.); vers = .; ';
put ' verR = compress(kscanx(req,-1, "("), ".", "KD"); vers = ""; ';
put ' LP_find = LP.find(); ';
put ' if (LP_find ne 0) or (LP_find = 0 and . < vers < verR) then ';
/* convert major.minor.patch to number*/
put ' array V verR vers ; ';
put ' array VN verRN versN; ';
put ' do over V; ';
put ' VN = input("0"!!scan(V,1,".","M"),?? best.)*1e8 ';
put ' + input("0"!!scan(V,2,".","M"),?? best.)*1e4 ';
put ' + input("0"!!scan(V,3,".","M"),?? best.)*1e0; ';
put ' end; ';
put ' if (LP_find ne 0) or (LP_find = 0 and . < versN < verRN) then ';
put ' do; ';
put ' put "NOTE: Trying to load required SAS package " req; ';
put ' put "NOTE: Trying to load required SAS package: " req; ';
put ' if LoadPackageExist then ';
put ' call execute(cats(''%nrstr(%loadPackage('', name, ", requiredVersion = ", verR, "))")); ';
put ' else if ICELoadPackageExist then ';
@@ -895,7 +1028,7 @@ data _null_;
/* test if required packages are loaded */
put 'data _null_ ; ';
put ' length req name $ 64 SYSloadedPackages $ 32767; ';
put ' length req name $ 64 vers verR $ 24 versN verRN 8 SYSloadedPackages $ 32767; ';
put ' if SYMEXIST("SYSloadedPackages") = 1 and SYMGLOBL("SYSloadedPackages") = 1 then ';
put ' do; ';
put ' do until(EOF); ';
@@ -911,7 +1044,7 @@ data _null_;
put ' do _N_ = 1 to countw(SYSloadedPackages); ';
put ' req = kscanx(SYSloadedPackages, _N_, " "); ';
put ' name = lowcase(strip(kscanx(req, 1, "("))); ';
put ' vers = input(compress(kscanx(req,-1, "("), ".", "KD"), best32.); ';
put ' vers = compress(kscanx(req,-1, "("), ".", "KD"); ';
put ' _RC_ = LP.add(); ';
put ' end; ';
@@ -919,12 +1052,22 @@ data _null_;
put ' do req = ' / packageReqPackages / ' ; ';
/* put ' req = compress(req, "(.)", "KDF"); ';*/
put ' name = lowcase(strip(kscanx(req, 1, "("))); ';
put ' verR = input(compress(kscanx(req,-1, "("), ".", "KD"),best32.); vers = .; ';
put ' verR = compress(kscanx(req,-1, "("), ".", "KD"); vers = " "; ';
put ' LP_find = LP.find(); ';
put ' if (LP_find ne 0) or (LP_find = 0 and . < vers < verR) then ';
/* convert major.minor.patch to number*/
put ' array V verR vers ; ';
put ' array VN verRN versN; ';
put ' do over V; ';
put ' VN = input("0"!!scan(V,1,".","M"),?? best.)*1e8 ';
put ' + input("0"!!scan(V,2,".","M"),?? best.)*1e4 ';
put ' + input("0"!!scan(V,3,".","M"),?? best.)*1e0; ';
put ' end; ';
put ' if (LP_find ne 0) or (LP_find = 0 and . < versN < verRN) then ';
put ' do; ';
put ' missingPackagr = 1; ';
put ' put "ERROR: SAS package " req "is missing! Download it and" ; ';
put ' put "ERROR: SAS package: " req "is missing! Download it and" ; ';
put ' put ''ERROR- use %loadPackage('' name ", requiredVersion = " verR ") to load it." ;';
put ' end ; ';
put ' end ; ';
@@ -936,7 +1079,7 @@ data _null_;
put ' call symputX("packageRequiredErrors", 1, "L"); ';
put ' do req = ' / packageReqPackages / ' ; ';
put ' name = lowcase(strip(kscanx(req, 1, "("))); ';
put ' vers = input(compress(kscanx(req,-1, "("), ".", "KD"), best32.); ';
put ' vers = compress(kscanx(req,-1, "("), ".", "KD"); ';
put ' put "ERROR: SAS package " req "is missing! Download/install it and" ; ';
put ' put ''ERROR- use %loadPackage('' name ", requiredVersion = " vers ") to load it." ; ';
put ' end ; ';
@@ -1104,6 +1247,7 @@ data _null_;
run;
/* to load lazydata */
%put NOTE-;
%put NOTE: Preparing "lazydata" file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -1115,10 +1259,11 @@ data _null_;
put "filename &_PackageFileref_. list;" /;
put ' %put NOTE- ;';
put ' %put NOTE: ' @; put "Data for package &packageName., version &packageVersion., license &packageLicense.; ";
put ' %put NOTE: ' @; put "*** &packageTitle. ***; ";
put ' %put NOTE: ' @; put '*** %superq(packageTitle) ***; ';
put ' %put NOTE- ' @; put "Generated: %sysfunc(datetime(), datetime21.); ";
put ' %put NOTE- ' @; put "Author(s): &packageAuthor.; ";
put ' %put NOTE- ' @; put "Maintainer(s): &packageMaintainer.; ";
put ' %put NOTE- ' @; put 'Author(s): %superq(packageAuthor); ';
put ' %put NOTE- ' @; put 'Maintainer(s): %superq(packageMaintainer); ';
put ' %put NOTE- ;';
put ' %put NOTE- Write %nrstr(%%)helpPackage(' "&packageName." ') for the description;';
put ' %put NOTE- ;';
@@ -1161,6 +1306,7 @@ run;
/* unloading package objects */
%put NOTE-;
%put NOTE: Preparing unload file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -1405,6 +1551,7 @@ data _null_;
run;
/* package preview, i.e. print out all content of the package files into the log */
%put NOTE-;
%put NOTE: Preparing preview file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -1418,10 +1565,11 @@ data _null_;
put "filename &_PackageFileref_. list;" /;
put ' %put NOTE- ;';
put ' %put NOTE: '"Preview of the &packageName. package, version &packageVersion., license &packageLicense.;";
put ' %put NOTE: ' @; put "*** &packageTitle. ***; ";
put ' %put NOTE: ' @; put '*** %superq(packageTitle) ***; ';
put ' %put NOTE- ' @; put "Generated: %sysfunc(datetime(), datetime21.); ";
put ' %put NOTE- ' @; put "Author(s): &packageAuthor.; ";
put ' %put NOTE- ' @; put "Maintainer(s): &packageMaintainer.; ";
put ' %put NOTE- ' @; put 'Author(s): %superq(packageAuthor); ';
put ' %put NOTE- ' @; put 'Maintainer(s): %superq(packageMaintainer); ';
put ' %put NOTE- ;';
put ' %put NOTE- *** START ***;' /;
@@ -1519,6 +1667,7 @@ data _null_;
run;
/* package help */
%put NOTE-;
%put NOTE: Preparing help file.;
%put NOTE- ^^^^^^^^^^^^^^^^^^^^;
%put NOTE-;
@@ -1532,10 +1681,11 @@ data _null_;
put "filename &_PackageFileref_. list;" /;
put ' %put NOTE- ;';
put ' %put NOTE: '"Help for package &packageName., version &packageVersion., license &packageLicense.;";
put ' %put NOTE: ' @; put "*** &packageTitle. ***; ";
put ' %put NOTE: ' @; put '*** %superq(packageTitle) ***; ';
put ' %put NOTE- ' @; put "Generated: %sysfunc(datetime(), datetime21.); ";
put ' %put NOTE- ' @; put "Author(s): &packageAuthor.; ";
put ' %put NOTE- ' @; put "Maintainer(s): &packageMaintainer.; ";
put ' %put NOTE- ' @; put 'Author(s): %superq(packageAuthor); ';
put ' %put NOTE- ' @; put 'Maintainer(s): %superq(packageMaintainer); ';
put ' %put NOTE- ;';
put ' %put NOTE- *** START ***;' /;
@@ -1592,7 +1742,7 @@ data _null_;
put ' end ; ';
%end;
put 'put "***"; put "* SAS package generated by generatePackage, version 20220925 *"; put "***";';
put 'put "***"; put "* SAS package generated by generatePackage, version 20221112 *"; put "***";';
put 'run; ' /;
@@ -1733,7 +1883,7 @@ data _null_;
call execute(' if ex then put "File " pathname "copied into the package with return code: " rc "(0 = success)";');
call execute(' else do;');
call execute(' put "ERROR: File " pathname "NOT copied into the package!" ;');
call execute(' put "ERROR: [&sysmacroname.] File " pathname "NOT copied into the package!" ;');
call execute(' call symputX("createPackageContentStatus",1,"L");');
call execute(' end;');
@@ -1749,7 +1899,7 @@ data _null_;
call execute(' if 18 <= lengthn(_endhelpline_) AND _endhelpline_ =: "/*** DNE PLEH ***/" then test + (-1); '); /* *** HELP END *** */
call execute(' if (test not in (.,0,1)) or (EOF and test) then ');
call execute(' do; ');
call execute(' put "ERROR: Unmatched or nested HELP tags in ' !! catx('/', folder, file) !! '! Line: " _N_; ');
call execute(' put "ERROR: [&sysmacroname.] Unmatched or nested HELP tags in ' !! catx('/', folder, file) !! '! Line: " _N_; ');
call execute(' put "ERROR- Aborting! "; ');
call execute(' call symputX("createPackageContentStatus",1,"L"); ');
call execute(' abort; ');
@@ -1779,7 +1929,7 @@ data _null_;
call execute(' ex = fexist("_SPFOUT_");');
call execute(' if not ex then do;');
call execute(' put "ERROR: File ' !! strip(drivFile) !! '.sas DOES NOT EXIST in the package!" ;');
call execute(' put "ERROR: [&sysmacroname.] File ' !! strip(drivFile) !! '.sas DOES NOT EXIST in the package!" ;');
call execute(' call symputX("createPackageContentStatus",1,"L"); ');
call execute(' end;');
@@ -1836,6 +1986,7 @@ filename &zipReferrence. clear;
/* verify if there were errors while package content creation */
%if %bquote(&createPackageContentStatus.) ne 0 %then
%do;
%put ERROR- ** [&sysmacroname.] **;
%put ERROR: ** ERRORS IN PACKAGE CONTENT CREATION! **;
%put ERROR- ** NO TESTING WILL BE EXECUTED. **;
%GOTO NOTESTING;
@@ -1933,7 +2084,7 @@ run;
%end;
%else
%do;
%put ERROR: Provided location of the SAS binary file does not exist!;
%put ERROR: [&sysmacroname.] Provided location of the SAS binary file does not exist!;
%put ERROR- The directory was: &SASEXE.;
%put ERROR- Testing would not be executed.;
filename sasroot;
@@ -1946,7 +2097,7 @@ run;
0 = %sysfunc(fileexist(&SASEXE..exe)) /* WINDOWS */
%then
%do;
%put ERROR: Provided location of the SAS binary file does not contain SAS file!;
%put ERROR: [&sysmacroname.] Provided location of the SAS binary file does not contain SAS file!;
%put ERROR- The file searched was: &SASEXE.;
%put ERROR- Testing would not be executed.;
%GOTO NOTESTING;
@@ -1980,7 +2131,7 @@ run;
%end;
%else
%do;
%put ERROR: Provided SAS config file does not exist!;
%put ERROR: [&sysmacroname.] Provided SAS config file does not exist!;
%put ERROR- The file was: &SASCFGFILE.;
%put ERROR- Testing would not be executed.;
%GOTO NOTESTING;
@@ -2119,6 +2270,10 @@ data _null_;
put '%unloadPackage'"(&packageName.,";
put " path=&filesLocation.) " /;
put "filename packages '&filesLocation.';" /
'%listPackages() ' /;
put "proc printto";
put "; run;";
@@ -2351,7 +2506,7 @@ title;
/*%put _local_;*/
%put NOTE: changing current folder to:;
%put NOTE: Changing current folder to:;
%put NOTE- *%sysfunc(DLGCDIR(%sysfunc(pathname(currdir))))*;
filename CURRDIR clear;
@@ -2371,6 +2526,7 @@ options &qlenmax_fstimer_tmp.;
%ENDofgeneratePackage:
%put --- generatePackage END ---;
%mend generatePackage;

View File

@@ -24,7 +24,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to get help about SAS package, version 20220925. Run %helpPackage() for help info.'
des = 'Macro to get help about SAS package, version 20221112. Run %helpPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -39,7 +39,7 @@ des = 'Macro to get help about SAS package, version 20220925. Run %helpPackage()
%put ### This is short help information for the `helpPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to get help about SAS packages, version `20220925` #;
%put # Macro to get help about SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -169,7 +169,7 @@ TODO:
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
*/
/* Macros to install SAS packages, version 20220925 */
/* Macros to install SAS packages, version 20221112 */
/* 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

View File

@@ -4,7 +4,8 @@
%macro installPackage(
packagesNames /* space separated list of packages names, without the zip extension */
, sourcePath = /* location of the package, e.g. "www.some.page/", mind the "/" at the end */
, mirror = 1 /* indicates which location for package source should be used */
, 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 */
, URLuser = /* user name for the password protected URLs */
, URLpass = /* password for the password protected URLs */
@@ -13,7 +14,7 @@
/secure
minoperator
/*** HELP END ***/
des = 'Macro to install SAS package, version 20220925. Run %%installPackage() for help info.'
des = 'Macro to install SAS package, version 20221112. Run %%installPackage() for help info.'
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
%do;
@@ -28,7 +29,7 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%put ### This is short help information for the `installPackage` macro #;
%put #--------------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to install SAS packages, version `20220925` #;
%put # Macro to install SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -56,16 +57,24 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%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://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/` #;
%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` 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 # Default value is `1`. #;
%put # Default value is `0`. #;
%put # #;
%put # - `version=` Indicates which historical version of a package to install. #;
%put # Historical version are 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 version #;
%put # is scan sequentially. #;
%put # #;
%put # - `replace=` With default value of `1` it causes existing package file #;
%put # to be replaced by new downloaded file. #;
@@ -101,6 +110,23 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put %nrstr( %%unloadPackage(SQLinDS) %%* unload the package content from the SAS session; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put #### Example #################################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the multiple packages 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( %%installPackage(baseplus(1.17) macroarray(1.0) dfa(0.5) GSM) );
%put %nrstr( %%loadPackageS(GSM, baseplus(1.17), macroarray(1.0), dfa(0.5)) );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put ##############################################################################################;
%put ;
options &options_tmp.;
@@ -127,8 +153,11 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
/* in case the 'packages' fileref is multi-directory the first directory will be selected as a destination */
data _null_;
/* get the firstPackagesPath */
call symputX("firstPackagesPath", dequote(kscanx(pathname("packages"), 1, "()", "QS")) ,"L");
if "(" =: pathname("packages") then
/* get the firstPackagesPath */
call symputX("firstPackagesPath", dequote(kscanx(pathname("packages"), 1, "()", "QS")), "L");
else
call symputX("firstPackagesPath", pathname("packages"), "L");
run;
%if %superq(sourcePath)= %then
@@ -138,6 +167,13 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
%if 0 = %superq(mirror) %then
%do;
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
%let sourcePath = https://github.com/SASPAC/; /*usercontent*/
%goto mirrorEnd;
%end;
%if 1 = %superq(mirror) %then
%do;
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
@@ -154,14 +190,51 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%mirrorEnd:
%put INFO: Source path is &sourcePath.;
%end;
%else
%do;
%let mirror=-1;
%let SPFinitMirror = &sourcePath.SPFinit.sas;
%end;
%local i;
%local i str;
/* standardise list of packages */
%let str = %qsysfunc(compress(%superq(packagesNames),[{(. _)}],kad));
%let str = %qsysfunc(translate(%superq(str),[[]],{()}));
%let str = %qsysfunc(transtrn(%superq(str),],%str(] )));
%let str = %qsysfunc(compbl(%superq(str)));
%let str = %qsysfunc(transtrn(%superq(str),%str([ ),[));
%let str = %qsysfunc(transtrn(%superq(str),%str( [),[));
%let str = %qsysfunc(transtrn(%superq(str),%str( ]),]));
%let str = %unquote(&str.);
%let packagesNames = %qsysfunc(translate(%superq(str),(),[]));
%if %length("%sysfunc(compress(%superq(str),[,k))") NE %length("%sysfunc(compress(%superq(str),],k))") %then
%do;
%put ERROR: Syntax error in list of packages!;
%put ERROR- %superq(packagesNames);
%goto packagesListError;
%end;
%put ;
%put INFO: Calling: &packagesNames.;
%do i = 1 %to %sysfunc(countw(&packagesNames., , S));
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
%local packageName;
%let packageName = %scan(&packagesNames., &i., , S);
%local packageName packageSubDir vers versA versB;
%put ;
/*%put ### %scan(&packagesNames., &i., , S) ###;*/
%let packageName = %scan(%scan(&packagesNames., &i., , S),1,{[()]});
%let versA = %scan(%scan(&packagesNames., &i., , S),2,{[()]});
%let versB = %scan(&version., &i., , S);
%let vers=;
%if %superq(versB) ne %then %let vers = &versB.;
%if %superq(versA) ne %then %let vers = &versA.;
%if -1 = &mirror %then /* ignore version when direct path is provided */
%do;
%let vers=;
%end;
%put ### &packageName.(&vers.) ###;
%put *** %lowcase(&packageName.) start *****************************************;
%local in out _IOFileref_;
data _null_; call symputX("_IOFileref_", put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
@@ -174,6 +247,11 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%if %upcase(&packageName.) in (SPFINIT SASPACKAGEFRAMEWORK SASPACKAGESFRAMEWORK) %then
%do;
/* allows to install/download the framework file like any other package */
%if %superq(mirror) in (0 1) AND (%superq(vers) ne) %then
%do;
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.sas;
%end;
filename &in URL
"&SPFinitMirror."
recfm=N lrecl=1;
@@ -183,7 +261,17 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
%end;
%else
%do;
filename &in URL "&sourcePath.%lowcase(&packageName.).zip"
%if 0 = %superq(mirror) %then
%do;
%let packageSubDir = %lowcase(&packageName.)/raw/main/;
%if %superq(vers) ne %then
%do;
/*%let packageSubDir = %lowcase(&packageName.)/main/hist/&version./;*/
%let packageSubDir = %lowcase(&packageName.)/raw/&vers./;
%end;
%end;
filename &in URL "&sourcePath.&packageSubDir.%lowcase(&packageName.).zip"
%if (%superq(URLuser) ne ) %then
%do;
user = "&URLuser."
@@ -257,6 +345,8 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
%end;
%packagesListError:
options ls = &ls_tmp. ps = &ps_tmp.
&notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp.
@@ -368,7 +458,7 @@ des = 'Macro to install SAS package, version 20220925. Run %%installPackage() fo
/* Macro to list SAS packages in packages folder.
Version 20220925
Version 20221112
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating

View File

@@ -1,7 +1,7 @@
/*+listPackages+*/
%macro listPackages()/secure PARMBUFF
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20220925.'
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20221112.'
;
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
%do;
@@ -16,7 +16,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 `20220925` #;
%put # Macro to list available SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -166,7 +166,7 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
/* Macro to generate SAS packages.
Version 20220925
Version 20221112
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating

View File

@@ -27,7 +27,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to load SAS package, version 20220925. Run %loadPackage() for help info.'
des = 'Macro to load SAS package, version 20221112. Run %loadPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -42,7 +42,7 @@ des = 'Macro to load SAS package, version 20220925. Run %loadPackage() for help
%put ### This is short help information for the `loadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to *load* SAS packages, version `20220925` #;
%put # Macro to *load* SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -155,7 +155,17 @@ des = 'Macro to load SAS package, version 20220925. Run %loadPackage() for help
filename &_PackageFileref_. clear;
/* test if required version of package is "good enough" */
%if %sysevalf(&requiredVersion. > &packageVersion.) %then
%local rV pV;
%let pV = %sysfunc(compress(&packageVersion.,.,kd));
%let pV = %sysevalf((%scan(&pV.,1,.,M)+0)*1e8
+ (%scan(&pV.,2,.,M)+0)*1e4
+ (%scan(&pV.,3,.,M)+0)*1e0);
%let rV = %sysfunc(compress(&requiredVersion.,.,kd));
%let rV = %sysevalf((%scan(&rV.,1,.,M)+0)*1e8
+ (%scan(&rV.,2,.,M)+0)*1e4
+ (%scan(&rV.,3,.,M)+0)*1e0);
%if %sysevalf(&rV. > &pV.) %then
%do;
%put ERROR: Package &packageName. will not be loaded!;
%put ERROR- Required version is &requiredVersion.;

View File

@@ -11,7 +11,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to load multiple SAS packages at one run, version 20220925. Run %loadPackages() for help info.'
des = 'Macro to load multiple SAS packages at one run, version 20221112. Run %loadPackages() for help info.'
parmbuff
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
@@ -27,7 +27,7 @@ parmbuff
%put ### This is short help information for the `loadPackageS` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro wrapper for the loadPackage macro, version `20220925` #;
%put # Macro wrapper for the loadPackage macro, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -76,18 +76,28 @@ parmbuff
%GOTO ENDofloadPackageS;
%end;
%local lengthOfsyspbuff numberOfPackagesNames i packageElement packageName packageVersion;
%local lengthOfsyspbuff numberOfPackagesNames i packageElement packageName packageVersion str;
%let lengthOfsyspbuff = %qsysfunc(length(&syspbuff.));
%let packagesNames = %qsysfunc(compress(%qsubstr(&syspbuff., 2, %eval(&lengthOfsyspbuff.-2)), %str((._,)), KDA));
%let numberOfPackagesNames = %qsysfunc(countw(&packagesNames., %str(,)));
%let packagesNames = %qsysfunc(compress(%qsubstr(&syspbuff., 2, %eval(&lengthOfsyspbuff.-2)), {[(. _,)]}, KDA));
%let str = %qsysfunc(translate(%superq(packagesNames),[[ ]],{(,)}));
%let str = %qsysfunc(transtrn(%superq(str),],%str(] )));
%let str = %qsysfunc(compbl(%superq(str)));
%let str = %qsysfunc(transtrn(%superq(str),%str([ ),[));
%let str = %qsysfunc(transtrn(%superq(str),%str( [),[));
%let str = %qsysfunc(transtrn(%superq(str),%str( ]),]));
%let str = %qsysfunc(translate(%superq(str),(),[]));
%let packagesNames = %unquote(&str.);
%let numberOfPackagesNames = %qsysfunc(countw(&packagesNames., %str( )));
%put NOTE: List of packages to be loaded contains &numberOfPackagesNames. element(s).;
%put NOTE- The list is: &packagesNames..;
%put NOTE- ;
%do i = 1 %to &numberOfPackagesNames.;
%let packageElement = %qscan(&packagesNames., &i., %str(,) );
%let packageElement = %qscan(&packagesNames., &i., %str( ) );
%let packageName = %qscan(&packageElement., 1, %str(()));
%let packageVersion = %qscan(&packageElement., 2, %str(()));
%if %superq(packageVersion) = %then %let packageVersion = .;

View File

@@ -23,7 +23,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to preview content of a SAS package, version 20220925. Run %previewPackage() for help info.'
des = 'Macro to preview content of a SAS package, version 20221112. Run %previewPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -38,7 +38,7 @@ des = 'Macro to preview content of a SAS package, version 20220925. Run %preview
%put ### This is short help information for the `previewPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to get previwe of a SAS packages, version `20220925` #;
%put # Macro to get previwe of a SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -20,7 +20,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to unload SAS package, version 20220925. Run %unloadPackage() for help info.'
des = 'Macro to unload SAS package, version 20221112. Run %unloadPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -35,7 +35,7 @@ des = 'Macro to unload SAS package, version 20220925. Run %unloadPackage() for h
%put ### This is short help information for the `unloadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to unload SAS packages, version `20220925` #;
%put # Macro to unload SAS packages, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -13,7 +13,7 @@
hashing_file() function, SAS 9.4M6 */
)/secure
/*** HELP END ***/
des = 'Macro to verify SAS package with the hash digest, version 20220925. Run %verifyPackage() for help info.'
des = 'Macro to verify SAS package with the hash digest, version 20221112. Run %verifyPackage() for help info.'
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do;
@@ -28,7 +28,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20220925. Run %
%put ### This is short help information for the `verifyPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to verify SAS package with it hash digest, version `20220925` #;
%put # Macro to verify SAS package with it hash digest, version `20221112` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -21,14 +21,14 @@ 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 **`20220925`**.
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20221112`**.
**To get started with SAS Packages** try this [**`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).
**The documentation and more advance reading** would be the [**`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") article (see the `./SPF/Documentation` directory).
*Note:* Filenames references `packages` and `package` are reserved keywords.
*Note:* Filenames references `packages` and `package` are **reserved keywords.**
The first one should be used to point local folder with packages and the framework.
The second is used internally by macros.
After assigning the directory do not change them when using the SPF since it may affect stability of the framework.
@@ -39,7 +39,7 @@ After assigning the directory do not change them when using the SPF since it may
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
--------------------------------------------------------------------------------------------
Macro to install SAS packages, version `20220925`
Macro to install SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -65,17 +65,25 @@ After assigning the directory do not change them when using the SPF since it may
then the framework itself is downloaded.
- `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://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/`
Current default location for the framework is:
`https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/`
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` 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`
Default value is `1`.
Default value is `0`.
- `version=` Indicates which historical version of a package to install.
Historical version are available only if `mirror=0` is set.
Default value is null which means "install the latest".
When there are multiple packages to install version
is scan sequentially.
- `replace=` With default value of `1` it causes existing package file
to be replaced by new downloaded file.
@@ -111,11 +119,29 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example ################################################################################
Enabling the SAS Package Framework
from the local directory and installing & loading
the multiple packages 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);
%installPackage(baseplus(1.17) macroarray(1.0) dfa(0.5) GSM)
%loadPackageS(GSM, baseplus(1.17), macroarray(1.0), dfa(0.5))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
-------------------------------------------------------------------------------
Macro to get help about SAS packages, version `20220925`
Macro to get help about SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -185,7 +211,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 `20220925`
Macro to *load* SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -258,7 +284,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
-------------------------------------------------------------------------------
Macro wrapper for the loadPackage macro, version `20220925`
Macro wrapper for the loadPackage macro, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -307,7 +333,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
-------------------------------------------------------------------------------
Macro to unload SAS packages, version `20220925`
Macro to unload SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -372,7 +398,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 `20220925`
Macro to list available SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -413,7 +439,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 `20220925`
Macro to verify SAS package with it hash digest, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -467,7 +493,7 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
## This is short help information for the `previewPackage` macro <a name="previewpackage"></a>
-------------------------------------------------------------------------------
Macro to get previwe of a SAS packages, version `20220925`
Macro to get previwe of a SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -534,7 +560,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 `20220925`
Macro to generate SAS packages, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -600,7 +626,7 @@ The file should contain the following obligatory information:
Type: Package
Package: PackageName
Title: A title/brief info for log note about your package.
Version: X.Y
Version: X.Y.Z
Author: Firstname1 Lastname1 (xxxxxx1@yyyyy.com), Firstname2 Lastname2 (xxxxxx2@yyyyy.com)
Maintainer: Firstname Lastname (xxxxxx@yyyyy.com)
License: MIT
@@ -624,6 +650,9 @@ Name of the `type` of folder and `files.sas` inside must be in the _low_ case le
If order of loading is important, the sequential number
can be used to order multiple types in the way you wish.
If folder name starts with `!` (e.g., `!ignore_me`) or *type* of the folder is "unknown" (e.g., not supported one)
the content of such folder is ignored during package generation process.
The "tree structure" of the folder could be for example as follows:
All files have to have `.sas` extension. Other files are ignored.
@@ -715,7 +744,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 `20220925`
Macro to list directories pointed by 'packages' fileref, version `20221112`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating

File diff suppressed because it is too large Load Diff

View File

@@ -2,11 +2,15 @@
To get started with SAS Packages try this [**`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).
## Available packages:
Currently the following packages are available:
For "backward compatibility"/historical point of view the following packages are available under the `./packages` directory.
Since *September 2022* the default location for packages is **SASPAC - the SAS Packages Archive** located under: [`https://github.com/SASPAC`](https://github.com/SASPAC) where each package is stored as a separate repository with historical versions too.
Packages:
---
- **SQLinDS**\[2.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.2.1\], 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(
@@ -18,7 +22,7 @@ data class;
WH = weight + height;
run;
```
SHA256 digest for SQLinDS: 96D0EFE02DF1AE0D7D875A10CAF7EF63CDEF85DD0CF9418934BEFAF0C067D453
SHA256 digest for SQLinDS: A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/sqlinds.md "Documentation for SQLinDS")
@@ -32,7 +36,7 @@ SHA256 digest for MacroCore: A23C29529F3CE7D0C8BEE9545C5D22D5B5594907547374A5135
---
- **DFA** (Dynamic Function Arrays)\[0.5\], 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.1\], 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);
@@ -59,13 +63,13 @@ data _null_;
end;
run;
```
SHA256 digest for DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491
SHA256 digest for DFA: 5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6
[Documentation for DFA](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/dfa.md "Documentation for DFA")
---
- **macroArray**\[1.0\], implementation of an array concept in a macro language, e.g.
- **macroArray**\[1.0.1\], implementation of an array concept in a macro language, e.g.
```sas
%array(ABC[17] (111:127), macarray=Y);
@@ -84,13 +88,13 @@ SHA256 digest for DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC353
which = 1:H:2
);
```
SHA256 digest for macroArray: ED12BC96F8A4E9E7C4D651EC1E15479DB9B55D98B274B63C507ED842081F7AB7
SHA256 digest for macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
---
- **BasePlus**\[1.17\] adds a bunch of functionalities I am missing in BASE SAS, such as:
- **BasePlus**\[1.17.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
```sas
call arrMissToRight(myArray);
call arrFillMiss(17, myArray);
@@ -108,25 +112,25 @@ format x bool.;
%zipLibrary(sashelp,libOut=work)
```
SHA256 digest for BasePlus: 56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C
SHA256 digest for BasePlus: A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
---
- **GSM** (Generate Secure Macros)\[0.20\], package allows
- **GSM** (Generate Secure Macros)\[0.20.1\], 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.
SHA256 digest for GSM: 2AEBC150FBA99A4AAB0265A21C57E89200BFD96B633B898F32743D1C8831A159
SHA256 digest for GSM: 5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922
[Documentation for GSM](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md "Documentation for GSM")
---
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
- **dynMacroArray**\[0.2.1\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA). Development of this package is currently on hold.
SHA256 digest for dynMacroArray: D7E0B8F85C05EBF8622204E0D2F3E990D48D0A9B3911051C3AD44DC98954DDCF
SHA256 digest for dynMacroArray: C987C08615A53D7BD7AEC3911EADF436C676EAB3E233E7E422E42995B890E169
---

View File

@@ -1,3 +1,11 @@
/* 20221112 */
BasePlus: A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4
DFA: 5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6
dynMacroArray: C987C08615A53D7BD7AEC3911EADF436C676EAB3E233E7E422E42995B890E169
GSM: 5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922
macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
SQLinDS: A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B
/* 20220830 */
BasePlus: 56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C
DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491

View File

@@ -56,7 +56,7 @@
---
# The BasePlus package [ver. 1.17] <a name="baseplus-package"></a> ###############################################
# The BasePlus package [ver. 1.17.1] <a name="baseplus-package"></a> ###############################################
The **BasePlus** package implements useful
functions and functionalities I miss in the BASE SAS.
@@ -77,6 +77,8 @@ Kudos to all who inspired me to generate this package:
*Michal Ludwicki*,
*Quentin McMullen*.
Recording from the SAS Explore 2022 conference: [A BasePlus Package for SAS](https://communities.sas.com/t5/SAS-Explore-Presentations/A-BasePlus-Package-for-SAS/ta-p/838246 "A BasePlus Package for SAS") (September 27th-29th, 2022).
---
### BASIC EXAMPLES AND USECASES: ####################################################
@@ -271,10 +273,10 @@ Package contains:
48. functions quicksorthashsddv
49. functions quicksortlight
*SAS package generated by generatePackage, version 20220830*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package BasePlus:
`56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C`
`A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4`
---
# Content description ############################################################################################
@@ -3934,7 +3936,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
## License ####################################################################
Copyright (c) 2020 Bartosz Jablonski
Copyright (c) since 2020 Bartosz Jablonski
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.

View File

@@ -18,7 +18,7 @@
---
# The DFA package [ver. 0.5] <a name="dfa-package"></a> ###############################################
# The DFA package [ver. 0.5.1] <a name="dfa-package"></a> ###############################################
The **DFA** (a.k.a. *Dynamic Function Array*) package implements:
- dynamic numeric and character arrays,
@@ -52,10 +52,10 @@ Package contains:
12. exec generatearrays
13. clean generatearrays
*SAS package generated by generatePackage, version 20220830*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package BasePlus:
`5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491`
`5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6`
---
# Content description ############################################################################################

Binary file not shown.

Binary file not shown.

View File

@@ -8,7 +8,7 @@
---
# The GSM package [ver. 0.20] <a name="gsm-package"></a> ###############################################
# The GSM package [ver. 0.20.1] <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.
@@ -91,10 +91,10 @@ Package contains:
Required SAS Components:
`Base SAS Software`
* SAS package generated by generatePackage, version 20220830 *
* SAS package generated by generatePackage, version 20221112 *
The SHA256 hash digest for package GSM:
`2AEBC150FBA99A4AAB0265A21C57E89200BFD96B633B898F32743D1C8831A159`
`5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922`
## >>> `%GSM()` macro: <<< <a name="gsm-macro"></a> #######################

Binary file not shown.

View File

@@ -19,7 +19,7 @@
---
# The macroArray package [ver. 1.0] <a name="macroarray-package"></a> ###############################################
# The macroArray package [ver. 1.0.1] <a name="macroarray-package"></a> ###############################################
The **macroArray** package implements a macro array facility:
- `%array()`,
@@ -75,10 +75,10 @@ Package contains:
Required SAS Components:
*Base SAS Software*
*SAS package generated by generatePackage, version 20220830.*
*SAS package generated by generatePackage, version 20221112.*
The SHA256 hash digest for package macroArray:
`ED12BC96F8A4E9E7C4D651EC1E15479DB9B55D98B274B63C507ED842081F7AB7`
`371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30`
---
# Content description ############################################################################################

Binary file not shown.

View File

@@ -1,4 +1,4 @@
- [The SQLinDS package [ver. 2.2]](#sqlinds-package)
- [The SQLinDS package [ver. 2.2.1]](#sqlinds-package)
- [Content description](#content-description)
* [library `dsSQL`](#library-dssql)
* [`%dsSQL_inner()` macro](#dssql-inner-macro)
@@ -8,7 +8,7 @@
---
# The SQLinDS package [ver. 2.2] <a name="sqlinds-package"></a> ###############################################
# The SQLinDS package [ver. 2.2.1] <a name="sqlinds-package"></a> ###############################################
The **SQLinDS** package is an implementation of
the *macro-function-sandwich* concept introduced in the
@@ -46,10 +46,10 @@ Package contains:
Required SAS Components:
*Base SAS Software*
*SAS package generated by generatePackage, version 20220830*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package SQLinDS:
`96D0EFE02DF1AE0D7D875A10CAF7EF63CDEF85DD0CF9418934BEFAF0C067D453`
`A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B`
---
# Content description ############################################################################################

Binary file not shown.