Compare commits

...

26 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
Bart Jablonski (yabwon)
11c0b95d7e SAS Packages Framework, version 20220925, extension
SAS Packages Framework, version 20220925, extension

Features:
- For the purpose of easy use of the SPF with SASAUTOS, inside the `SPF` directory, a subdirectory `Macros`, containing each macro of the framework in separate `*.sas` file, was introduced.
- Documentation update.
2022-09-28 22:37:26 +02:00
Bart Jablonski (yabwon)
be89c6b9c6 SAS Packages Framework, version 20220925
**SAS Packages Framework**, version `20220925`

New parameter `mirror=` added to the `%installPackage()` macro.
The `mirror` indicates which web location for packages installation is used.
Value `1` indicates: `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main`
Value `2` indicates: `https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES`
Default value is `1`.
2022-09-25 19:11:55 +02:00
Bart Jablonski
17b1239087 Merge pull request #50 from beauweta/patch-1
Update baseplus.md
2022-08-30 19:16:32 +02:00
Bart Jablonski (yabwon)
bbba37d8eb The SAS Packages Framework, version 20220830:
The SAS Packages Framework, version 20220830:

- New metadata checks added for required SAS components and required SAS packages.
- New parameter `delTestWork` in `%generatePackage()` macro added. It indicates if `WORK` directories generated by user tests should be deleted, i.e. the (NO)WORKTERM option is set.
- Log aesthetics and readability improved in the `%generatePackages()` macro:
  - subtitles added in the log,
  - `stimer` turned off,
  - some notes turned off.
- Generation of table with tests results updated.
- Documentation updated.

Packages regenerated with the new version of SPF:
- BasePlus
- SQLinDS
- macroArray
- DFA
- dynMacroArray
- GSM
2022-08-30 18:56:26 +02:00
Bart Jablonski
6ccc07a5bb Add SAS Packages Framework to SAS
Initiative to add SAS Packages Framework to SAS Base/Viya
2022-05-31 21:53:53 +02:00
Bart Jablonski
b5e15bda11 Add SAS Packages Framework to SAS
Innitiative to *add* SAS Packages Framework *to* SAS Base/Viya
2022-05-31 21:50:58 +02:00
Bart Jablonski
160c1bc9d3 Add SAS Packages Framework to SAS
Innitiative to *add* SAS Packages Framework *to* SAS Base/Viya
2022-05-31 21:49:56 +02:00
beauweta
76297dc5d8 Update baseplus.md
Just rephrased a few sentences and fixed some typos. Cheers, Christian
2022-05-15 15:15:10 +12:00
Bart Jablonski (yabwon)
ea866123d9 The BasePlus package [ver. 1.17]
The BasePlus package [ver. 1.17]

- new macro `%LDSNM()`, which extends functionality of the `%LDSN()` was added.
- documentation updated

hash: 619D4B2562F1D9E42C9C5DCB326E8F4D6A020B5D0CEE29A6174F65F8E1B0E7BD
2022-05-11 23:44:34 +02:00
Bart Jablonski (yabwon)
75029a488f The BasePlus package [ver. 1.16]
The BasePlus package [ver. 1.16]

- improvement to: %LDSN(), %LVarNm(), and %LVarNmLab() macros. Big thanks to Richard DeVenezia!

hash: 4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
2022-05-09 19:00:25 +02:00
Bart Jablonski (yabwon)
642bc5ba72 The BasePlus package [ver. 1.15]
The **BasePlus** package [ver. 1.15]

- 3 new macros added: `%LDSN()`, `%LVarNm()`, and `%LVarNmLab()`

hash: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
2022-05-08 19:10:55 +02:00
Bart Jablonski
6d10426474 **SAS Packages Framework**, version 20220420
**SAS Packages Framework**, version 20220420

- Changes in the `%GeneratePackage()` macro:
- check for driving files existence added,
- local `createPackageContentStatus` macro variable added,
- if `createPackageContentStatus` is not zero an _ERROR _is printed and tests are not executed,

- The `kscanx()` function and `kcountw()` function used in macros of the Framework,

- Doc. updated.

- Packages regenerated with new version of the SAS Packages Framework:
- BasePlus
- SQLinDS
- macroArray
- DFA
- dynMacroArray
- GSM
2022-04-20 22:48:09 +02:00
Bart Jablonski (yabwon)
7048adb3b6 **SAS Packages Framework**, version 20220420
**SAS Packages Framework**, version 20220420

- Changes in the `%GeneratePackage()` macro:
  - check for driving files existence added,
  - local `createPackageContentStatus` macro variable added,
  - if `createPackageContentStatus` is not zero an _ERROR _is printed and tests are not executed,

- The `kscanx()` function and `kcountw()` function used in macros of the Framework,

- Doc. updated.

- Packages regenerated with new version of the SAS Packages Framework:
  - BasePlus
  - SQLinDS
  - macroArray
  - DFA
  - dynMacroArray
  - GSM
2022-04-20 22:35:09 +02:00
Bart Jablonski (yabwon)
5ab1f4c73e The GSM package [ver. 0.20]
The GSM package [ver. 0.20]

- internal bug fix.

hash: BE9508C8E37706B2EB2FBCA68B64F7DCF63C65E8E24775C92E28FE34E547893D
2022-04-06 18:12:10 +02:00
Bart Jablonski
4452d9ee7c Update README.md 2022-03-18 18:05:46 +01:00
Bart Jablonski (yabwon)
df04e48656 The GSM package [ver. 0.19]
The `GSM` package [ver. 0.19]

- The code file parsing modified.
- A `lineEnd=` parameter added.
- The `trim=` parameter deprecated.
- A warning about the `/*%` text changed into a note.
- Documentation updated.

hash: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF
2022-03-13 20:43:14 +01:00
31 changed files with 5988 additions and 342 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 - 2021 Bartosz Jablonski
Copyright (c) 2019 - 2022 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

144
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 **`20220113`**.
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,63 +22,118 @@ 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:
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)
---
### 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!
- [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)
---
### 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**.
@@ -88,25 +149,30 @@ To create your own package:
---
## Where the SAS Packages Framework is used:
This is a list of locations where the SAS Packages Framework is used. If you want to share that you are using SPF let me know and I'll update the list.
This is a list of locations where the SAS Packages Framework is used:
- Warsaw (Poland)
The List:
- Europe
- Poland
- Warsaw
If you want to share that you are using the SPF let me know and I'll update the list.
If you find the SPF useful **share info** about it or **give it a [star](https://github.com/yabwon/SAS_PACKAGES/stargazers)** so more people will know.
---
## 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: DCAB62267B52822F416BA7E6713A696D843E8092A4E3A37DF06CBE1E1D5DAD11
SHA256 digest for SQLinDS: A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/sqlinds.md "Documentation for SQLinDS")
@@ -116,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: 5F89AC6AE628EB27D87FF6A9D72A515FFA3FF6694D04DE0D9811BFFB81444ABB
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);
@@ -141,12 +207,12 @@ SHA256 digest for DFA: 5F89AC6AE628EB27D87FF6A9D72A515FFA3FF6694D04DE0D9811BFFB8
which = 1:H:2
);
```
SHA256 digest for macroArray: DAEB87654D99965BF2B7A6AB14626B3E617D0ABF526E77725DF89A1AB4C812C2
SHA256 digest for macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
- **BasePlus**\[1.14\] 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);
@@ -164,21 +230,21 @@ format x bool.;
%zipLibrary(sashelp,libOut=work)
```
SHA256 digest for BasePlus: A60A300E083628C65DD6899E7EF95588916F8F66B6A25B32B3228987B6F74857
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.18\], 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: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D
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: 766DF3F330B87E99FAC32A00A569D9A45DA1157F591DE34DD0892CD864779409
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

@@ -0,0 +1,105 @@
/*+extendPackagesFileref+*/
/*** HELP START ***/
%macro extendPackagesFileref(
packages /* A valid fileref name,
when empty the "packages" value is used */
)/secure
/*** HELP END ***/
des = 'Macro to list directories pointed by "packages" fileref, version 20221112. Run %extendPackagesFileref(HELP) for help info.'
;
%if %QUPCASE(&packages.) = 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 `extendPackagesFileref` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and embedded inside the zip. #;
%put # #;
%put # The `%nrstr(%%extendPackagesFileref())` macro lists directories pointed by #;
%put # the packages fileref. It allows to add new dierctories to packages folder list. #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packages` *Optional.* A valid fileref name, when empty the "packages" is used. #;
%put # Use case: #;
%put # `%nrstr(%%extendPackagesFileref()).` #;
%put # #;
%put # When used as: `%nrstr(%%extendPackagesFileref(HELP))` it displays this help information. #;
%put # #;
%put #-----------------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ##############################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and adding #;
%put # new directory. #;
%put # #;
%put # Assume that the `SPFinit.sas` file #;
%put # is located in one of "C:/SAS_PK1" or "C:/SAS_PK2" folders. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( filename packages ("C:/SAS_PK1" "C:/SAS_PK2"); %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( filename packages ("D:/NEW_DIR" %%extendPackagesFileref()); %%* add new directory; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put ###########################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDextendPackagesFileref;
%end;
%if %superq(packages) = %then %let packages = packages;
%if %qsysfunc(pathname(&packages.)) ne %then
%do;
%if %qsubstr(%qsysfunc(pathname(&packages.)), 1, 1) = %str(%() %then
%do;
%local length;
%let length = %eval(%length(%qsysfunc(pathname(&packages.)))-2);
%unquote(%qsubstr(%qsysfunc(pathname(&packages.)), 2, &length.))
%end;
%else "%sysfunc(pathname(&packages.))";
%end;
%ENDextendPackagesFileref:
%mend extendPackagesFileref;
/* Examples:
filename packages "C:\";
%include packages(SPFinit.sas)
%extendPackagesFileref(HELP)
filename packages (%extendPackagesFileref() "D:\");
filename packages list;
filename packages clear;
filename packages "C:\";
filename packages ("D:\" %extendPackagesFileref());
filename packages list;
%put *%extendPackagesFileref()*;
*/
/**/

File diff suppressed because it is too large Load Diff

178
SPF/Macros/helppackage.sas Normal file
View File

@@ -0,0 +1,178 @@
/*+helpPackage+*/
/*** HELP START ***/
%macro helpPackage(
packageName /* name of a package,
e.g. myPackageFile.zip,
required and not null */
, helpKeyword /* phrase to search in help,
when empty prints description
"*" means print all help
"license" prints license */
, path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for
location of "packages" fileref */
, options = %str(LOWCASE_MEMNAME) /* possible options for ZIP filename */
, source2 = /*source2*/ /* option to print out details,
null by default */
, zip = zip /* standard package is zip (lowcase),
e.g. %helpPackage(PiPackage,*)
if the zip is not available use a folder
unpack data to "pipackage.disk" folder
and use helpPackage in the form:
%helpPackage(PiPackage, *, zip=disk, options=)
*/
)/secure
/*** HELP END ***/
des = 'Macro to get help about SAS package, version 20221112. Run %helpPackage() 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 `helpPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and provided with #;
%put # a single `help.sas` file (also embedded inside the zip). #;
%put # #;
%put # The `%nrstr(%%helpPackage())` macro prints in the SAS log help #;
%put # information about the package provided by the developer. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` *Required.* Name of a package, e.g. myPackage, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%helpPackage(myPackage)).` #;
%put # If empty displays this help information. #;
%put # #;
%put # 2. `helpKeyword` *Optional.* A phrase to search in help, #;
%put # - when empty prints description, #;
%put # - "*" means: print all help, #;
%put # - "license" prints the license. #;
%put # #;
%put # - `path=` *Optional.* Location of a package. By default it #;
%put # looks for location of the **packages** fileref, i.e. #;
%put # `%nrstr(%%sysfunc(pathname(packages)))` #;
%put # #;
%put # - `options=` *Optional.* Possible options for ZIP filename, #;
%put # default value: `LOWCASE_MEMNAME` #;
%put # #;
%put # - `source2=` *Optional.* Option to print out details about #;
%put # what is loaded, null by default. #;
%put # #;
%put # - `zip=` Standard package is zip (lowcase), #;
%put # e.g. `%nrstr(%%helpPackage(PiPackage))`. #;
%put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #;
%put # and use helpPackage in the following form: #;
%put # `%nrstr(%%helpPackage(PiPackage, ,zip=disk, options=))` #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%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 #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofhelpPackage;
%end;
/* local variables for options */
%local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%local _PackageFileref_;
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
/* when the packages reference is multi-directory search for the first one containing the package */
data _null_;
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."));
if exists then leave;
end;
if exists then call symputx("path", p, "L");
run;
filename &_PackageFileref_. &ZIP.
/* put location of package myPackageFile.zip here */
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
;
%if %sysfunc(fexist(&_PackageFileref_.)) %then
%do;
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
filename &_PackageFileref_. &ZIP.
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
ENCODING =
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
%else utf8 ;
;
%include &_PackageFileref_.(help.sas) / &source2.;
%end;
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.;
%ENDofhelpPackage:
%mend helpPackage;
/*
TODO:
- macro for testing available packages in the packages folder [DONE] checkout: %listPackages()
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
*/
/* 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
a single load.sas file (also embedded inside the zip).
*/

View File

@@ -0,0 +1,478 @@
/*+installPackage+*/
/*** HELP START ***/
%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 = 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 */
, URLoptions = /* options for the `sourcePath` URLs */
)
/secure
minoperator
/*** HELP END ***/
des = 'Macro to install SAS package, version 20221112. Run %%installPackage() for help info.'
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = 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 `installPackage` macro #;
%put #--------------------------------------------------------------------------------------------#;;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and embedded inside the zip. #;
%put # #;
%put # The `%nrstr(%%installPackage())` macro installs the package zip #;
%put # in the packages folder. The process of installation is equivalent with #;
%put # manual downloading the package zip file into the packages folder. #;
%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. `packagesNames` Space separated list of packages names _without_ #;
%put # the zip extension, e.g. myPackage1 myPackage2, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%installPackage(myPackage1 myPackage2))`. #;
%put # If empty displays this help information. #;
%put # If the package name is *SPFinit* or *SASPackagesFramework* #;
%put # then the framework itself is downloaded. #;
%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` 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 `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. #;
%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 #--------------------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example #################################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%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.;
%GOTO ENDofinstallPackage;
%end;
/* local variables for options */
%local ls_tmp ps_tmp notes_tmp source_tmp stimer_tmp fullstimer_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let stimer_tmp = %sysfunc(getoption(stimer));
%let fullstimer_tmp = %sysfunc(getoption(fullstimer));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N;
/*
Reference:
https://blogs.sas.com/content/sasdummy/2011/06/17/how-to-use-sas-data-step-to-copy-a-file-from-anywhere/
*/
/* 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");
else
call symputX("firstPackagesPath", pathname("packages"), "L");
run;
%if %superq(sourcePath)= %then
%do;
%local SPFinitMirror;
/* the defaults are: */
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
%if 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;
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
%goto mirrorEnd;
%end;
%if 2 = %superq(mirror) %then
%do;
%let SPFinitMirror = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/SPF/SPFinit.sas;
%let sourcePath = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/packages/;
%goto mirrorEnd;
%end;
%mirrorEnd:
%put INFO: Source path is &sourcePath.;
%end;
%else
%do;
%let mirror=-1;
%let SPFinitMirror = &sourcePath.SPFinit.sas;
%end;
%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 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;
%let in = i&_IOFileref_.;
%let out = o&_IOFileref_.;
/* %let in = i%sysfunc(md5(&packageName.),hex7.); */
/* %let out = o%sysfunc(md5(&packageName.),hex7.); */
/*options MSGLEVEL=i;*/
%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;
filename &out
"&firstPackagesPath./SPFinit.sas"
recfm=N lrecl=1;
%end;
%else
%do;
%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."
pass = "&URLuser."
%end;
&URLoptions.
recfm=N lrecl=1;
filename &out "&firstPackagesPath./%lowcase(&packageName.).zip" recfm=N lrecl=1;
%end;
/*
filename in list;
filename out list;
*/
/* copy the file byte-by-byte */
data _null_;
length filein 8 out_path in_path $ 4096;
out_path = pathname ("&out");
in_path = pathname ("&in" );
filein = fopen( "&in", 'S', 1, 'B');
if filein = 0 then
put "ERROR: Source file:" /
"ERROR- " in_path /
"ERROR- is unavailable!";
if filein > 0;
put @2 "Source information:";
infonum = FOPTNUM(filein);
length infoname $ 32 infoval $ 128;
do i=1 to coalesce(infonum, -1);
infoname = FOPTNAME(filein, i);
infoval = FINFO(filein, infoname);
put @4 infoname ":"
/ @6 infoval
;
end;
rc = FCLOSE(filein);
put;
if FEXIST("&out") = 0 then
do;
put @2 "Installing the &packageName. package"
/ @2 "in the &firstPackagesPath. directory.";
rc = FCOPY("&in", "&out");
end;
else if FEXIST("&out") = 1 then
do;
if symgetn("replace")=1 then
do;
put @2 "The following file will be replaced during "
/ @2 "instalation of the &packageName. package: "
/ @5 out_path;
rc = FDELETE("&out");
rc = FCOPY("&in", "&out");
end;
else
do;
put @2 "The following file will NOT be replaced: "
/ @5 out_path;
rc = 1;
end;
end;
put @2 "Done with return code " rc= "(zero = success)";
run;
filename &in clear;
filename &out clear;
%put *** %lowcase(&packageName.) end *******************************************;
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
%end;
%packagesListError:
options ls = &ls_tmp. ps = &ps_tmp.
&notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp.;
%ENDofinstallPackage:
%mend installPackage;
/*** HELP START ***/
/*
Filenames references "packages" and "package" are reserved keywords.
The first one should be used to point local folder with packages.
The second is used internally by macros.
Do not use them otherwise than:
filename packages "</the/folder/with/sas/packages>";
since it may affect stability of the framework.
**/
/* Example 1: Enabling the SAS Package Framework
and loading the SQLinDS package from the local directory.
Assume that the SPFinit.sas file and the SQLinDS
package (sqlinds.zip file) are located in
the "C:/SAS_PACKAGES/" folder.
Run the following code in your SAS session:
filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%helpPackage(SQLinDS) %* get help about the package;
%loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/
/* Example 2: Enabling the SAS Package Framework
from the local directory and installing & loading
the SQLinDS 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:
filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%installPackage(SQLinDS) %* install the package from the Internet;
%helpPackage(SQLinDS) %* get help about the package;
%loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/
/* Example 3: Enabling the SAS Package Framework
and installing & loading the SQLinDS package
from the Internet.
Run the following code in your SAS session:
filename packages "%sysfunc(pathname(work))"; %* setup WORK as a temporary directory for packages;
filename spfinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPFinit.sas";
%include spfinit; %* enable the framework;
%installPackage(SQLinDS) %* install the package from the Internet;
%helpPackage(SQLinDS) %* get help about the package;
%loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/
/* Example 4:
Assume that the SPFinit.sas file and the SQLinDS package (sqlinds.zip file)
are located in the "C:/SAS_PACKAGES/" folder.
In case when user SAS session does not support ZIP fileref
the following solution could be used.
Unzip the packagename.zip content into the packagename.disk folder
and run macros with the following options: ;
%loadPackage(packageName,zip=disk,options=)
%helpPackage(packageName,,zip=disk,options=) %* mind the double comma!! ;
%unloadPackage(packageName,zip=disk,options=)
*/
/* Example 5: Enabling the SAS Package Framework from the local directory
and installing the SQLinDS package from the Internet.
Assume that the SPFinit.sas file is located in
the "C:/SAS_PACKAGES/" folder.
filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%installPackage(SQLinDS); %* install package;
%installPackage(SQLinDS); %* overwrite already installed package;
%installPackage(SQLinDS,replace=0); %* prevent overwrite installed package;
%installPackage(NotExistingPackage); %* handling with not existing package;
*/
/*** HELP END ***/
/*** HELP START ***/
/* Macro to list SAS packages in packages folder.
Version 20221112
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip).
*/
/*
* Example 1: Set local packages directory, enable the framework,
and list packages in the local repository.
filename packages "C:\SAS_PACKAGES";
%include packages(SPFinit.sas);
%listPackages()
*/
/*** HELP END ***/

180
SPF/Macros/listpackages.sas Normal file
View File

@@ -0,0 +1,180 @@
/*+listPackages+*/
%macro listPackages()/secure PARMBUFF
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20221112.'
;
%if %QUPCASE(&SYSPBUFF.) = %str(%(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 `listPackages` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and embedded inside the zip. #;
%put # #;
%put # The `%nrstr(%%listPackages())` macro lists packages available #;
%put # in the packages folder. List is printed inthe SAS Log. #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # NO PARAMETERS #;
%put # #;
%put # When used as: `%nrstr(%%listPackages(HELP))` it displays this help information. #;
%put # #;
%put #-----------------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ##############################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and listing #;
%put # available packages. #;
%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( %%listPackages() %%* list available packages; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put ###########################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDoflistPackages;
%end;
%local ls_tmp ps_tmp notes_tmp source_tmp filesWithCodes;
%let filesWithCodes = WORK._%sysfunc(datetime(), hex16.)_;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
options NOnotes NOsource ls=MAX ps=MAX;
data _null_;
length baseAll $ 32767;
baseAll = pathname("packages");
if baseAll = " " then
do;
put "NOTE: The file reference PACKAGES is not assigned.";
stop;
end;
if char(baseAll,1) ^= "(" then baseAll = quote(strip(baseAll)); /* for paths with spaces */
do k = 1 to kcountw(baseAll, "()", "QS"); drop k;
base = dequote(kscanx(baseAll, k, "()", "QS"));
length folder $ 64 file $ 1024 folderRef fileRef $ 8;
folderRef = "_%sysfunc(datetime(), hex6.)0";
rc=filename(folderRef, base);
folderid=dopen(folderRef);
putlog " ";
put "/*" 100*"+" ;
do i=1 to dnum(folderId); drop i;
if i = 1 then
do;
put " #";
put " # Listing packages for: " base;
put " #";
end;
folder = dread(folderId, i);
fileRef = "_%sysfunc(datetime(), hex6.)1";
rc = filename(fileRef, catx("/", base, folder));
fileId = dopen(fileRef);
EOF = 0;
if fileId = 0 and lowcase(kscanx(folder, -1, ".")) = 'zip' then
do;
file = catx('/',base, folder);
rc1 = filename("package", strip(file), 'zip', 'member="description.sas"');
rcE = fexist("package");
rc2 = filename("package", " ");
if rcE then /* if the description.sas exists in the zip then read it */
do;
putlog " * ";
length nn $ 96;
if (96-lengthn(file)) < 1 then
put " * " file;
else
do;
nn = repeat("*", (96-lengthn(file)));
put " * " file nn;
end;
infile _DUMMY_ ZIP FILEVAR=file member="description.sas" end=EOF;
do until(EOF);
input;
if strip(upcase(kscanx(_INFILE_,1,":"))) in ("PACKAGE" "TITLE" "VERSION" "AUTHOR" "MAINTAINER" "LICENSE") then
do;
_INFILE_ = kscanx(_INFILE_,1,":") !! ":" !! kscanx(_INFILE_,2,":");
putlog " * " _INFILE_;
end;
if strip(upcase(strip(_INFILE_))) =: "DESCRIPTION START:" then leave;
end;
end;
end;
rc = dclose(fileId);
rc = filename(fileRef);
end;
putlog " * ";
put 100*"+" "*/";
rc = dclose(folderid);
rc = filename(folderRef);
end;
stop;
run;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
%ENDoflistPackages:
%mend listPackages;
/*** HELP START ***/
/* 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
data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip).
See examples below.
*/
/*** HELP END ***/

208
SPF/Macros/loadpackage.sas Normal file
View File

@@ -0,0 +1,208 @@
/*+loadPackage+*/
/*** HELP START ***/
%macro loadPackage(
packageName /* name of a package,
e.g. myPackage,
required and not null */
, path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for
location of "packages" fileref */
, options = %str(LOWCASE_MEMNAME) /* possible options for ZIP filename */
, source2 = /*source2*/ /* option to print out details,
null by default */
, requiredVersion = . /* option to test if loaded package
is provided in required version */
, lazyData = /* a list of names of lazy datasets
to be loaded, if not null then
datasets from the list are loaded
instead of a package, asterisk
means "load all datasets" */
, zip = zip /* standard package is zip (lowcase),
e.g. %loadPackage(PiPackage)
if the zip is not available use a folder
unpack data to "pipackage.disk" folder
and use loadPackage in the form:
%loadPackage(PiPackage, zip=disk, options=)
*/
)/secure
/*** HELP END ***/
des = 'Macro to load SAS package, version 20221112. Run %loadPackage() 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 `loadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and included by #;
%put # a single `load.sas` file (also embedded inside the zip). #;
%put # #;
%put # The `%nrstr(%%loadPackage())` macro loads package content, i.e. macros, #;
%put # functions, formats, etc., from the zip into the SAS session. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` *Required.* Name of a package, e.g. myPackage, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%loadPackage(myPackage)).` #;
%put # If empty displays this help information. #;
%put # #;
%put # - `path=` *Optional.* Location of a package. By default it #;
%put # looks for location of the **packages** fileref, i.e. #;
%put # `%nrstr(%%sysfunc(pathname(packages)))` #;
%put # #;
%put # - `options=` *Optional.* Possible options for ZIP filename, #;
%put # default value: `LOWCASE_MEMNAME` #;
%put # #;
%put # - `source2=` *Optional.* Option to print out details about #;
%put # what is loaded, null by default. #;
%put # #;
%put # - `requiredVersion=` *Optional.* Option to test if the loaded #;
%put # package is provided in required version, #;
%put # default value: `.` #;
%put # #;
%put # - `lazyData=` *Optional.* A list of names of lazy datasets to be #;
%put # loaded. If not null datasets from the list are loaded #;
%put # instead of the package. #;
%put # An asterisk (*) means *load all lazy datasets*. #;
%put # #;
%put # - `zip=` Standard package is zip (lowcase), #;
%put # e.g. `%nrstr(%%loadPackage(PiPackage))`. #;
%put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #;
%put # and use loadPackage in the following form: #;
%put # `%nrstr(%%loadPackage(PiPackage, zip=disk, options=))` #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put ### Example #####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%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 #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofloadPackage;
%end;
/* local variables for options */
%local ls_tmp ps_tmp notes_tmp source_tmp stimer_tmp fullstimer_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let stimer_tmp = %sysfunc(getoption(stimer));
%let fullstimer_tmp = %sysfunc(getoption(fullstimer));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N;
%local _PackageFileref_;
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
/* when the packages reference is multi-directory search for the first one containing the package */
data _null_;
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."));
if exists then leave;
end;
if exists then call symputx("path", p, "L");
run;
filename &_PackageFileref_. &ZIP.
/* put location of package myPackageFile.zip here */
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
;
%if %sysfunc(fexist(&_PackageFileref_.)) %then
%do;
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
filename &_PackageFileref_. clear;
/* test if required version of package is "good enough" */
%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.;
%put ERROR- Provided version is &packageVersion.;
%put ERROR- Verify installed version of the package.;
%put ERROR- ;
%GOTO WrongVersionOFPackage; /*%RETURN;*/
%end;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
filename &_PackageFileref_. &ZIP.
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
ENCODING =
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
%else utf8 ;
;
%if %bquote(&lazyData.) = %then
%do;
%include &_PackageFileref_.(load.sas) / &source2.;
%end;
%else
%do;
%include &_PackageFileref_.(lazydata.sas) / &source2.;
%end;
%end;
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
filename &_PackageFileref_. clear;
%WrongVersionOFPackage:
/* restore optionos */
options ls = &ls_tmp. ps = &ps_tmp.
&notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp.;
%ENDofloadPackage:
%mend loadPackage;

111
SPF/Macros/loadpackages.sas Normal file
View File

@@ -0,0 +1,111 @@
/*+loadPackageS+*/
/*** HELP START ***/
%macro loadPackageS(
packagesNames /* A comma separated list of packages names,
e.g. myPackage, myPackage1, myPackage2, myPackage3
required and not null.
Package version, in brackets behind a package name,
can be provided, e.g.
%loadPackageS(myPackage1(1.7), myPackage2(4.2))
*/
)/secure
/*** HELP END ***/
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
%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 `loadPackageS` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and embedded inside the zip. #;
%put # #;
%put # The `%nrstr(%%loadPackageS())` allows to load multiple packages at one time, #;
%put # *ONLY* from the *ZIP* with *DEFAULT OPTIONS*, into the SAS session. #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packagesNames` A comma separated list of packages names, #;
%put # e.g. myPackage, myPackage1, myPackage2, myPackage3 #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%loadPackageS(myPackage1, myPackage2, myPackage3))`. #;
%put # Package version, in brackets behind a package name, can #;
%put # be provided, example is the following: #;
%put # `%nrstr(%%loadPackageS(myPackage1(1.7), myPackage2(4.2)))`. #;
%put # If empty displays this help information. #;
%put # #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS DFA) %%* install packages from the Internet; );
%put %nrstr( %%loadPackageS(SQLinDS, DFA) %%* load packags content into the SAS session; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofloadPackageS;
%end;
%local lengthOfsyspbuff numberOfPackagesNames i packageElement packageName packageVersion str;
%let lengthOfsyspbuff = %qsysfunc(length(&syspbuff.));
%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 packageName = %qscan(&packageElement., 1, %str(()));
%let packageVersion = %qscan(&packageElement., 2, %str(()));
%if %superq(packageVersion) = %then %let packageVersion = .;
%loadPackage(%unquote(&packageName.), requiredVersion=%unquote(&packageVersion.))
%end;
%ENDofloadPackageS:
%mend loadPackageS;

View File

@@ -0,0 +1,159 @@
/*+previewPackage+*/
/*** HELP START ***/
%macro previewPackage(
packageName /* name of a package,
e.g. myPackageFile.zip,
required and not null */
, helpKeyword /* phrase to search for preview,
when empty prints description
"*" means prints all */
, path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for
location of "packages" fileref */
, options = %str(LOWCASE_MEMNAME) /* possible options for ZIP filename */
, source2 = /*source2*/ /* option to print out details,
null by default */
, zip = zip /* standard package is zip (lowcase),
e.g. %previewPackage(PiPackage,*)
if the zip is not available use a folder
unpack data to "pipackage.disk" folder
and use previewPackage in the form:
%previewPackage(PiPackage, *, zip=disk, options=)
*/
)/secure
/*** HELP END ***/
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;
%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 `previewPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and provided with #;
%put # a single `preview.sas` file (also embedded inside the zip). #;
%put # #;
%put # The `%nrstr(%%previewPackage())` macro prints, in the SAS log, content #;
%put # of a SAS package. Code of a package is printed out. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` *Required.* Name of a package, e.g. myPackage, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%previewPackage(myPackage)).` #;
%put # If empty displays this help information. #;
%put # #;
%put # 2. `helpKeyword` *Optional.* A phrase to search in preview, #;
%put # - when empty prints description, #;
%put # - "*" means: print all preview. #;
%put # #;
%put # - `path=` *Optional.* Location of a package. By default it #;
%put # looks for location of the **packages** fileref, i.e. #;
%put # `%nrstr(%%sysfunc(pathname(packages)))` #;
%put # #;
%put # - `options=` *Optional.* Possible options for ZIP filename, #;
%put # default value: `LOWCASE_MEMNAME` #;
%put # #;
%put # - `source2=` *Optional.* Option to print out details about #;
%put # what is loaded, null by default. #;
%put # #;
%put # - `zip=` Standard package is zip (lowcase), #;
%put # e.g. `%nrstr(%%previewPackage(PiPackage))`. #;
%put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #;
%put # and use previewPackage in the following form: #;
%put # `%nrstr(%%previewPackage(PiPackage, , zip=disk, options=))` #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%previewPackage(SQLinDS) %%* get content of the package; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofpreviewPackage;
%end;
%local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%local _PackageFileref_;
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
/* when the packages reference is multi-directory search for the first one containing the package */
data _null_;
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."));
if exists then leave;
end;
if exists then call symputx("path", p, "L");
run;
filename &_PackageFileref_. &ZIP.
/* put location of package myPackageFile.zip here */
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
;
%if %sysfunc(fexist(&_PackageFileref_.)) %then
%do;
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
filename &_PackageFileref_. &ZIP.
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
ENCODING =
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
%else utf8 ;
;
%include &_PackageFileref_.(preview.sas) / &source2.;
%end;
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.;
%ENDofpreviewPackage:
%mend previewPackage;

View File

@@ -0,0 +1,156 @@
/*+unloadPackage+*/
/*** HELP START ***/
%macro unloadPackage(
packageName /* name of a package,
e.g. myPackage,
required and not null */
, path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for
location of "packages" fileref */
, options = %str(LOWCASE_MEMNAME) /* possible options for ZIP filename */
, source2 = /*source2*/ /* option to print out details,
null by default */
, zip = zip /* standard package is zip (lowcase),
e.g. %unloadPackage(PiPackage)
if the zip is not available use a folder
unpack data to "pipackage.disk" folder
and use unloadPackage in the form:
%unloadPackage(PiPackage, zip=disk, options=)
*/
)/secure
/*** HELP END ***/
des = 'Macro to unload SAS package, version 20221112. Run %unloadPackage() 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 `unloadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and provided with #;
%put # a single `unload.sas` file (also embedded inside the zip). #;
%put # #;
%put # The `%nrstr(%%unloadPackage())` macro clears the package content #;
%put # from the SAS session. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` *Required.* Name of a package, e.g. myPackage, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%unloadPackage(myPackage)).` #;
%put # If empty displays this help information. #;
%put # #;
%put # - `path=` *Optional.* Location of a package. By default it #;
%put # looks for location of the **packages** fileref, i.e. #;
%put # `%nrstr(%%sysfunc(pathname(packages)))` #;
%put # #;
%put # - `options=` *Optional.* Possible options for ZIP filename, #;
%put # default value: `LOWCASE_MEMNAME` #;
%put # #;
%put # - `source2=` *Optional.* Option to print out details about #;
%put # what is loaded, null by default. #;
%put # #;
%put # - `zip=` Standard package is zip (lowcase), #;
%put # e.g. `%nrstr(%%unloadPackage(PiPackage))`. #;
%put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #;
%put # and use unloadPackage in the following form: #;
%put # `%nrstr(%%unloadPackage(PiPackage, zip=disk, options=))` #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put ### Example #####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%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 #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofunloadPackage;
%end;
/* local variables for options */
%local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%local _PackageFileref_;
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
/* when the packages reference is multi-directory search for the first one containing the package */
data _null_;
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."));
if exists then leave;
end;
if exists then call symputx("path", p, "L");
run;
filename &_PackageFileref_. &ZIP.
/* put location of package myPackageFile.zip here */
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
;
%if %sysfunc(fexist(&_PackageFileref_.)) %then
%do;
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
filename &_PackageFileref_. &ZIP.
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
ENCODING =
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
%else utf8 ;
;
%include &_PackageFileref_.(unload.sas) / &source2.;
%end;
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist!;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.;
%ENDofunloadPackage:
%mend unloadPackage;

View File

@@ -0,0 +1,176 @@
/*+verifyPackage+*/
/*** HELP START ***/
%macro verifyPackage(
packageName /* name of a package,
e.g. myPackage,
required and not null */
, path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for
location of "packages" fileref */
, hash = /* 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 20221112. Run %verifyPackage() 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 `verifyPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%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 #;
%put # data, etc.) wrapped up together and embedded inside the zip. #;
%put # #;
%put # The `%nrstr(%%verifyPackage())` macro generate package SHA256 hash #;
%put # and compares it with the one provided by the user. #;
%put # #;
%put # #;
%put # *Minimum SAS version required for the process is 9.4M6.* #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` Name of a package, e.g. myPackage, #;
%put # Required and not null, default use case: #;
%put # `%nrstr(%%loadPackage(myPackage))`. #;
%put # If empty displays this help information. #;
%put # #;
%put # - `hash=` A value of the package `SHA256` hash. #;
%put # Provided by the user. #;
%put # #;
%put # - `path=` Location of a package. By default it looks for #;
%put # location of the "packages" fileref, i.e. #;
%put # `%nrstr(%%sysfunc(pathname(packages)))` #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # #;
%put #### Example ####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS 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"; %%* set-up a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofverifyPackage;
%end;
%local ls_tmp ps_tmp notes_tmp source_tmp stimer_tmp fullstimer_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes));
%let source_tmp = %sysfunc(getoption(source));
%let stimer_tmp = %sysfunc(getoption(stimer));
%let fullstimer_tmp = %sysfunc(getoption(fullstimer));
%let msglevel_tmp = %sysfunc(getoption(msglevel));
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N;
%local _PackageFileref_;
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
/* when the packages reference is multi-directory search for the first one containing the package */
data _null_;
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"));
if exists then leave;
end;
if exists then call symputx("path", p, "L");
run;
filename &_PackageFileref_.
/* put location of package myPackageFile.zip here */
"&path./%lowcase(&packageName.).zip"
;
%if %sysfunc(fexist(&_PackageFileref_.)) %then
%do;
/* create hash SHA256 id *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
%local HASHING_FILE_exist;
%let HASHING_FILE_exist = 0;
%if %sysfunc(exist(sashelp.vfunc, VIEW)) %then
%do;
data _null_;
set sashelp.vfunc(keep=fncname);
where fncname = "HASHING_FILE";
call symputX('HASHING_FILE_exist', 1, "L");
stop;
run;
%end;
%if &HASHING_FILE_exist. = 1 %then
%do;
options notes;
filename &_PackageFileref_. list;
data _null_;
SHA256 = HASHING_FILE("SHA256", "&_PackageFileref_.", 4);
providedHash = "&hash.";
put "Provided Hash: " providedHash;
put "SHA256 digest: " SHA256;
put " ";
if SHA256 = providedHash then
do;
put "NOTE: Package verification SUCCESSFUL.";
put "NOTE- Generated hash is EQUAL to the provided one.";
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.";
end;
run;
%let HASHING_FILE_exist = 0;
%end;
%else
%put WARNING: Verification impossible! Minimum SAS version required for the process is 9.4M6. ;
/*-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
%end;
%else %put ERROR:[&sysmacroname] File "&path./&packageName..zip" does not exist!;
filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp.
&notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp.;
%ENDofverifyPackage:
%mend verifyPackage;
/**/

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 **`20220113`**.
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 `20220113`
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,13 +65,28 @@ 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 `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 replaceed by new downloaded file.
to be replaced by new downloaded file.
- `URLuser=` A user name for the password protected URLs, no quotes needed.
@@ -104,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 `20220113`
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
@@ -178,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 `20220113`
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
@@ -251,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 `20220113`
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
@@ -300,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 `20220113`
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
@@ -365,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 `20220113`
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
@@ -406,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 `20220113`
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
@@ -460,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 `20220113`
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
@@ -527,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 `20220113`
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
@@ -567,10 +600,15 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
- `sasexe=` Location of a DIRECTORY where the SAS binary is located,
if null (the default) then the `!SASROOT` is used.
- `sascfgfile=` Location of a FILE with testing session configuration
- `sascfgFile=` Location of a FILE with testing session configuration
parameters, if null (the default) then no config file
is pointed during the SAS invocation,
if set to `DEF` then the `!SASROOT/sasv9.cfg` is used.
- `delTestWork=` Indicates if `WORK` directories generated by user tests
should be deleted, i.e. the (NO)WORKTERM option is set.
The default value: `1` means "delete tests work".
Available values are `0` and `1`.
-------------------------------------------------------------------------------
@@ -588,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
@@ -612,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.
@@ -703,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 `20220113`
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

@@ -1,4 +1,4 @@
Copyright (c) 2019 - 2021 Bartosz Jablonski
Copyright (c) 2019 - 2022 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

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: DCAB62267B52822F416BA7E6713A696D843E8092A4E3A37DF06CBE1E1D5DAD11
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: 5F89AC6AE628EB27D87FF6A9D72A515FFA3FF6694D04DE0D9811BFFB81444ABB
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: 5F89AC6AE628EB27D87FF6A9D72A515FFA3FF6694D04DE0D9811BFFB8
which = 1:H:2
);
```
SHA256 digest for macroArray: DAEB87654D99965BF2B7A6AB14626B3E617D0ABF526E77725DF89A1AB4C812C2
SHA256 digest for macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
---
- **BasePlus**\[1.14\] 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: A60A300E083628C65DD6899E7EF95588916F8F66B6A25B32B3228987B6F74857
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.18\], 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: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D
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: 766DF3F330B87E99FAC32A00A569D9A45DA1157F591DE34DD0892CD864779409
SHA256 digest for dynMacroArray: C987C08615A53D7BD7AEC3911EADF436C676EAB3E233E7E422E42995B890E169
---

View File

@@ -1,3 +1,42 @@
/* 20221112 */
BasePlus: A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4
DFA: 5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6
dynMacroArray: C987C08615A53D7BD7AEC3911EADF436C676EAB3E233E7E422E42995B890E169
GSM: 5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922
macroArray: 371B92A5ABBE82C53F7D63BC5C0D1EBD4695603D3894D8A9A5D5777D1AB59B30
SQLinDS: A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B
/* 20220830 */
BasePlus: 56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C
DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491
dynMacroArray: D7E0B8F85C05EBF8622204E0D2F3E990D48D0A9B3911051C3AD44DC98954DDCF
GSM: 2AEBC150FBA99A4AAB0265A21C57E89200BFD96B633B898F32743D1C8831A159
macroArray: ED12BC96F8A4E9E7C4D651EC1E15479DB9B55D98B274B63C507ED842081F7AB7
SQLinDS: 96D0EFE02DF1AE0D7D875A10CAF7EF63CDEF85DD0CF9418934BEFAF0C067D453
/* 20220511 */
BasePlus: 619D4B2562F1D9E42C9C5DCB326E8F4D6A020B5D0CEE29A6174F65F8E1B0E7BD
/* 20220509 */
BasePlus: 4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
/* 20220508 */
BasePlus: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
/* 20220420 */
BasePlus: 12A9A2155D9C6F969DF0A66E3A18D0938B8194FA3AA9D70EDDE1CB71DEF9691E
DFA: 6B3FB0B06B47A7EF1BB004B483B0F39B8F553F7F16D02A7E24CDE388BBA704EA
dynMacroArray: 7DA9BFDED37C18C4FB5BD7579A81A4B2578EEEF1546D1A3AB5C80DE07C88A615
GSM: E6E2A6214EE7DC6E06AA76916A68B216DD7665184E63CF2C01F487A038E71B09
macroArray: DF63B0E027827A82038F1C8422787A0BC569BA93104BA1778DB6DD088A5D255C
SQLinDS: 701B69BE71B99792803BCE7718ED486259310FFB92E6D77ED1BC029D9CC67B60
/* 20220406 */
GSM: BE9508C8E37706B2EB2FBCA68B64F7DCF63C65E8E24775C92E28FE34E547893D
/* 20220307 */
GSM: F63B8C602C1DB02F4107D9AF78182D87CD64AEA6521163067B7EB6D5C1B368AF
/* 20220307 */
GSM: 8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D

View File

@@ -45,12 +45,18 @@
* [`%RainCloudPlot()` macro](#raincloudplot-macro)
* [`%zipLibrary()` macro](#ziplibrary-macro)
* [`%unzipLibrary()` macro](#unziplibrary-macro)
* [`%LDSN()` macro](#ldsn-macro)
* [`%LDsNm()` macro](#ldsnm-macro)
* [`%LVarNm()` macro](#lvarnm-macro)
* [`%LVarNmLab()` macro](#lvarnmlab-macro)
* [License](#license)
---
# The BasePlus package [ver. 1.14] <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.
@@ -67,7 +73,11 @@ Kudos to all who inspired me to generate this package:
*Richard DeVenezia*,
*Christian Graffeuille*,
*Allan Bowe*,
*Anamaria Calai*.
*Anamaria Calai*,
*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).
---
@@ -187,7 +197,6 @@ Kudos to all who inspired me to generate this package:
%rainCloudPlot(sashelp.cars,DriveTrain,Invoice)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
![Rain Cloud Plot](./baseplus_RainCloudPlot_Ex0_9.png)
**Example 10**: Zip SAS library.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
@@ -196,64 +205,78 @@ Kudos to all who inspired me to generate this package:
%unzipLibrary(%sysfunc(pathname(work)), zip=sashelp, mode=S, clean=1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Example 11**: Long dataset names.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data %LDSN( work. peanut butter & jelly time with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s (drop = sex rename=(name=first_name) where = (age in (12,13,14))) );
set sashelp.class;
run;
proc print data = %LDSN( work. peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s );
run;
data MyNextDataset;
set %LDSN( work. peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s );
where age > 12;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
Package contains:
1. macro deduplistc
2. macro deduplistp
3. macro deduplists
4. macro deduplistx
5. macro functionexists
6. macro getvars
7. macro qdeduplistx
8. macro qgetvars
9. macro qzipevalf
10. macro raincloudplot
11. macro symdelglobal
12. macro unziplibrary
13. macro zipevalf
14. macro ziplibrary
15. format bool
16. format boolz
17. format ceil
18. format floor
19. format int
20. function arrfill
21. function arrfillc
22. function arrmissfill
23. function arrmissfillc
24. function arrmisstoleft
25. function arrmisstoleftc
26. function arrmisstoright
27. function arrmisstorightc
28. function bracketsc
29. function bracketsn
30. function catxfc
31. function catxfi
32. function catxfj
33. function catxfn
34. function deldataset
35. function semicolonc
36. function semicolonn
37. format brackets
38. format semicolon
39. proto qsortincbyprocproto
40. function frommissingtonumberbs
41. function fromnumbertomissing
42. function quicksort4notmiss
43. function quicksorthash
44. function quicksorthashsddv
45. function quicksortlight
1. macro deduplistc
2. macro deduplistp
3. macro deduplists
4. macro deduplistx
5. macro functionexists
6. macro getvars
7. macro ldsn
8. macro ldsnm
9. macro lvarnm
10. macro lvarnmlab
11. macro qdeduplistx
12. macro qgetvars
13. macro qzipevalf
14. macro raincloudplot
15. macro symdelglobal
16. macro unziplibrary
17. macro zipevalf
18. macro ziplibrary
19. format bool
20. format boolz
21. format ceil
22. format floor
23. format int
24. functions arrfill
25. functions arrfillc
26. functions arrmissfill
27. functions arrmissfillc
28. functions arrmisstoleft
29. functions arrmisstoleftc
30. functions arrmisstoright
31. functions arrmisstorightc
32. functions bracketsc
33. functions bracketsn
34. functions catxfc
35. functions catxfi
36. functions catxfj
37. functions catxfn
38. functions deldataset
39. functions semicolonc
40. functions semicolonn
41. format brackets
42. format semicolon
43. proto qsortincbyprocproto
44. functions frommissingtonumberbs
45. functions fromnumbertomissing
46. functions quicksort4notmiss
47. functions quicksorthash
48. functions quicksorthashsddv
49. functions quicksortlight
*SAS package generated by generatePackage, version 20220113*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package BasePlus:
`A60A300E083628C65DD6899E7EF95588916F8F66B6A25B32B3228987B6F74857`
`A80006D3C1409465E49F383D08F2F3AF1E33D6A67D71A8CAF29747ADC917E2E4`
---
# Content description ############################################################################################
@@ -3497,9 +3520,423 @@ run;
---
## >>> `%LDSN()` macro: <<< <a name="ldsn-macro"></a> #######################
The LDSN (Long DataSet Names) macro function
allows to use an "arbitrary" text string to name a dataset.
The LDSN macro has some limitation described below, to overcome them
another macro, with different name: LDSNM (Long DataSet Names Modified)
was created. See its description to learn how to use it.
---
The idea for the macro came from the following story:
Good friend of mine, who didn't use SAS for quite some time,
told me that he lost a few hours for debugging because
he forgot that the SAS dataset name limitation is 32 bytes.
I replied that it shouldn't be a problem to do a workaround
for this inconvenience with a macro and the `MD5()` hashing function.
I said: *The macro should take an "arbitrary string" for a dataset
name, convert it, with help of `MD5()`, to a hash digest, and
create a dataset with an "artificial" `hex16.` formated name.*
Starting with something like this:
~~~~~~~~~~~~~~~~~~~~~~~sas
data %LDSN(work. peanut butter & jelly with a hot-dog in [a box] and s*t*a*r*s (drop = sex rename=(name=first_name) where = (age in (12,13,14))) );
set sashelp.class;
run;
~~~~~~~~~~~~~~~~~~~~~~~
the macro would do:
~~~~~~~~~~~~~~~~~~~~~~~sas
%sysfunc(MD5(peanut butter & jelly with a hot-dog in [a box] and s*t*a*r*s), hex16.)
~~~~~~~~~~~~~~~~~~~~~~~
and (under the hood) return and execute the following code:
~~~~~~~~~~~~~~~~~~~~~~~sas
data work.DSN_41D599EF51FBA58_(drop = sex rename=(name=first_name) where = (age in (12,13,14))) ;
set sashelp.class;
run;
~~~~~~~~~~~~~~~~~~~~~~~
Also in the next data step user should be able to do:
~~~~~~~~~~~~~~~~~~~~~~~sas
data my_next_data_step;
set %DSN(work. peanut butter & jelly with a hot-dog in [a box] and s*t*a*r*s);
run;
~~~~~~~~~~~~~~~~~~~~~~~
and work without the "dataset-name-length-limitation" issue.
---
See examples below for the details.
The `%LDSN()` macro executes like a pure macro code.
**Known "Limitations":**
- dataset name _cannot_ contain dots (`.`) since they are used as separators!
- dataset name _cannot_ contain round brackets(`(` and `)`) since they are used as separators
(but `[]` and `{}` are allowed)!
- dataset name _cannot_ contain unpaired quotes (`'` and `"`),
text: `a "hot-dog"` is ok, but `John's dog` is not!
**Behaviour:**
- dataset name text is *converted to upcase*
- dataset name text *leading and trailing spaces are ignored*,
e.g. the following will give the same hash digest:
`%ldsn(work.test)`, `%ldsn( work.test)`, `%ldsn(work.test )`,
`%ldsn(work .test)`, `%ldsn(work. test)`, `%ldsn(work . test)`.
- macro calls of the form:
`data %LDSN(); run;`, `data %LDSN( ); run;`, `data %LDSN( . ); run;` or even
`data %LDSN( . (keep=x)); run;` are resolved to empty string, so the result is
equivalent to `data; run;`
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
~~~~~~~~~~~~~~~~~~~~~~~sas
%LDSN(
arbitrary text string (in line with limitations)
)
~~~~~~~~~~~~~~~~~~~~~~~
The text string is concider as *"fully qualified dataset name"*, i.e. macro
assumes it may contain library as prefix and data set options as sufix.
See the `%LDsNm()` macro for comparison.
---
### EXAMPLES AND USECASES: ####################################################
**EXAMPLE 1.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
options nomprint source nomlogic nosymbolgen ls = max ps = max;
data %LDSN( work. peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s (drop = sex rename=(name=first_name) where = (age in (12,13,14))) );
set sashelp.class;
run;
proc print data = %LDSN( work. peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s );
run;
data MyNextDataset;
set %LDSN( work. peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s );
where age > 12;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
## >>> `%LDSNM()` macro: <<< <a name="ldsnm-macro"></a> #######################
The LDSNM (Long DataSet Names Modified) macro function
allows to use an "arbitrary" text string to name a dataset.
The LDSN macro had some limitation (see its documentation), to overcome them
another `%LDSNM()` (Long DataSet Names Modified) macro was created.
The main idea behind the `%LDSNM()` is the same as for `%LDSN()` - see the description there.
---
The `%LDSNM()` macro works differently than the `%LDSN()` macro.
The `%LDSN()` macro assumes that *both* libname and dataset options *are*
be passed as elements **inside** the macro argument, together with the data set name. E.g.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data %LDSN( WORK.peanut butter & jelly with a hot-dog in [a box] and s*t*a*r*s (drop = sex) );
set sashelp.class;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The `%LDSNM()` macro, in contrary, assumes that both libname and dataset options are
passed **outside** the macro parameter, i.e.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data WORK.%LDSNM( peanut butter & jelly with a hot-dog in [a box] and s*t*a*r*s ) (drop = sex);
set sashelp.class;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This approach overcomes some limitations the LDSN has.
The **additional** feature of the `%LDSNM()` is that when the macro is called,
a global macrovariable is created.
The macro variable name is the text of the hashed data set name.
The macro variable value is the text of the unhashed data set name (i.e. the argument of the macro).
For example the following macro call:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data %LDSNM(John "x" 'y' dog);
set sashelp.class;
where name = 'John';
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
creates macro variable with name `DSN_BF1F8C4D6495B34A_` and with value: `JOHN "X" 'Y' DOG`.
The macrovariable is useful when combined with `symget()` function and
the `indsname=` option to get the original text string value back,
like in this example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data test;
set %LDSNM(John "x" 'y' dog) indsname = i;
indsname = symget(scan(i,-1,"."));
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See examples below for the details.
---
The `%LDSN()` macro executes like a pure macro code.
**Known "Limitations":**
- dataset name _cannot_ contain _unpaired_ round brackets(`(` and `)`)
(but unmatched `[]` and `{}` are allowed)!
- dataset name _cannot_ contain _unpaired_ quotes (`'` and `"`),
text: `a "hot-dog"` is ok, but `John's dog` is not!
**Behaviour:**
- dataset name text is *converted to upcase*
- dataset name text *leading and trailing spaces are ignored*,
e.g. the following will give the same hash digest:
`%ldsn(test)`, `%ldsn( test)`, `%ldsn(test )`.
- macro calls of the form:
`data %LDSN(); run;` or `data %LDSN( ); run;` are resolved
to empty string, so the result is equivalent to `data; run;`
- created macrovariable is _global_ in scope.
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
~~~~~~~~~~~~~~~~~~~~~~~sas
%LDSNM(
arbitrary text string (in line with limitations)
)
~~~~~~~~~~~~~~~~~~~~~~~
The text string is considered as *"only dataset name"*, i.e. the macro does not
assume it contains library as prefix or data set options as suffix.
See the `%LDSN()` macro for comparison.
---
### EXAMPLES AND USECASES: ####################################################
**EXAMPLE 1.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data %LDSNM(John "x" 'y' & dog);
set sashelp.class;
where name = 'John';
run;
data %LDSNM(John "x"[ 'y' & dog);
set sashelp.class;
where name = 'John';
run;
data %LDSNM(John "x" 'y'} & dog);
set sashelp.class;
where name = 'John';
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 2.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data work.%LDsNm( peanut butter & jelly, a hot-dog in [a box], and s(*)t(*)a(*)r(*)s!! ) (drop = sex rename=(name=first_name) where = (age in (12,13,14)))
;
set sashelp.class;
run;
data test;
set work.%LDsNm( peanut butter & jelly, a hot-dog in [a box], and s(*)t(*)a(*)r(*)s!! ) indsname=i;
indsname=symget(scan(i,-1,"."));
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 3.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data work.%LDsNm( . );
set sashelp.class;
run;
data %LDsNm( );
set sashelp.class;
run;
data %LDsNm();
set sashelp.class;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
## >>> `%LVarNm()` macro: <<< <a name="lvarnm-macro"></a> #######################
The LVarNm() macro function works like the LDSN() macro function, but for variables.
Supported by LVarNmLab() macro function which allows to remember "user names" in labels.
The motivation for the macro was similar to that for the LDSN() macro.
---
See examples below for the details.
The `%LVarNm()` macro executes like a pure macro code.
**Known "Limitations":**
- variable name _cannot_ contain unpaired quotes (`'` and `"`),
text: `a "hot-dog"` is ok, but `John's dog` is not!
**Behaviour:**
- variable name text is *converted to upcase*
- variable name text *leading and trailing spaces are ignored*,
e.g. the following will give the same hash digest:
`%LVarNm(test)`, `%LVarNm( test)`, `%LVarNm(test )`.
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
~~~~~~~~~~~~~~~~~~~~~~~sas
%LVarNm(
arbitrary text string (in line with limitations)
)
~~~~~~~~~~~~~~~~~~~~~~~
---
### EXAMPLES AND USE CASES: ####################################################
**EXAMPLE 1.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
options ls=max;
data test;
%LVarNmLab( peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s )
do %LVarNm( peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s ) = 1 to 10;
y = 5 + %LVarNm( peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s ) * 17;
output;
end;
run;
data test2;
set test;
where %LVarNm( peanut butter & jelly with a "Hot-Dog" in [a box], popcorn, and s*t*a*r*s ) < 5;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 2.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data test3;
%LVarNmLab() = 17;
%LVarNm() = 17;
%LVarNm( ) = 42;
%LVarNm( ) = 303;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 3.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data test3;
%LVarNm(test) = 1;
%LVarNm( test) = 2;
%LVarNm(test ) = 3;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 4.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data test4;
array X[*] %LVarNm(some strange! name)_0 - %LVarNm(some strange! name)_10;
do i = lbound(X) to hbound(X);
X[i] = 2**(i-1);
put X[i]=;
end;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## >>> `%LVarNmLab()` macro: <<< <a name="lvarnmlab-macro"></a> #######################
The LVarNmLab() macro function supports LVarNm() and allows to remember "user names" in labels.
The motivation for the macro was similar one as for the LDSN() macro.
---
See examples in LVarNm() documentation for the details.
The `%LVarNmLab()` macro executes like a pure macro code.
**Known "Limitations":**
- variable name _cannot_ contain unpaired quotes (`'` and `"`),
text: `a "hot-dog"` is ok, but `John's dog` is not!
**Behaviour:**
- variable name text is *converted to upcase*
- variable name text *leading and trailing spaces are ignored*,
e.g. the following will give the same hash digest:
`%LVarNmLab(test)`, `%LVarNmLab( test)`, `%LVarNmLab(test )`.
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
~~~~~~~~~~~~~~~~~~~~~~~sas
%LVarNmLab(
arbitrary text string (in line with limitations)
)
~~~~~~~~~~~~~~~~~~~~~~~
---
## 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 20220113*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package BasePlus:
`5F89AC6AE628EB27D87FF6A9D72A515FFA3FF6694D04DE0D9811BFFB81444ABB`
`5A6FD2F6E962E6C191346A141FFAF354E35A546CA93146B55D7C6163BFB1BDD6`
---
# Content description ############################################################################################

Binary file not shown.

Binary file not shown.

View File

@@ -8,7 +8,7 @@
---
# The GSM package [ver. 0.18] <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.
@@ -54,8 +54,33 @@ Recording of presentation with "how it works" description, in Polish, is avaliab
```
- Share generated `ZIP` file (unzip and run the code).
*Limitations:*
Single macro file cannot be longer than 32760 bytes.
**Limitations:**
- Single macro file cannot be longer than 32760 bytes.
- Multiline text variable. Consider the following code text file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%macro~test()/SECURE;~#@
data~test;~#@
a~=~"abc~#@
~#@
def";~#@
put~a~hex20.;~#@
run;~#@
%mend~test;~#@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where `~` symbols the space character,
`#` symbols the carriage return (`0D`),
and `@` symbols the line feed (`0A`).
The code file is scanned and inserted into
the `resolve()` function argument in a "byte by byte"
fashion hence also the "end of line" characters are included.
As the result value of variable `a` will be:
`a = "abc~#@~#@def"`.
If you want to use the `GSM` package avoid
such "style" of coding in your macros.
---
@@ -66,10 +91,10 @@ Package contains:
Required SAS Components:
`Base SAS Software`
* SAS package generated by generatePackage, version 20220113 *
* SAS package generated by generatePackage, version 20221112 *
The SHA256 hash digest for package GSM:
`8D730316043A6523A3AF2AA15D2820BB75A46E06307F2B8916D30AC102AEE31D`
`5D1925970C9590CD195C15B8641B01D7857E3B2546323DC77D09154BCCA40922`
## >>> `%GSM()` macro: <<< <a name="gsm-macro"></a> #######################
@@ -92,7 +117,7 @@ be added to the macro definition. See the example:
As a result a zip file, containing dataset with functions and
code to be executed on site, is generated.
code to be executed on site, is generated.
Since encrypted code is stored in a SAS dataset it has
no limitation in sharing between operating systems (like catalogs have).
@@ -117,6 +142,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,outpath=>
<,encodingRestricted=>
<,secret=>
<,lineEnd=>
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -125,10 +151,6 @@ The basic syntax is the following, the `<...>` means optional parameters:
1. `path` - *Required*, indicates a directory which contains files with macros.
Only files with `sas` extension are used.
* `trim=` - *Optional*, the default value is `0`.
If set to `1` then lines of macro code are trimmed.
If set to `2` then lines of macro code are stripped.
* `cmplib=` - *Optional*, the default value is `work.generateMacros`.
Names the dataset which will contain generated functions.
@@ -151,8 +173,20 @@ The basic syntax is the following, the `<...>` means optional parameters:
Required to execute the `resolve()` function.
User who do not know the value will not be able
to run the `_maxro_XX_()` function.
---
* `lineEnd=` - *Optional*, the default value is `0D0A`, indicates which of:
line feed, carriage return, or both, or a space be inserted
at the end of line in the intermediate code file that is generated.
Value has to be hexadecimal code (_NOT_ null),
since the value is resolved as `"&lineEnd."x`, so use e.g.
`0A` for line feed, `0D` for carriage return,
`0D0A` for both, and `20` for space.
* `trim=` - *Deprecated*, the default value is `0`.
*Kept for backward compatibility.*
---
### Example: ###################################################################
@@ -197,8 +231,7 @@ run;
%GSM(&path., cmplib=work.myMacros)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## >>> `%GSMpck_makeFCMPcode()` macro: <<< <a name="gsmpck-makefcmpcode-macro"></a> #######################
## >>> `%GSMpck_makeFCMPcode()` macro: <<< <a name="GSMpck-makeFCMPcode-macro"></a> #######################
The `%GSMpck_makeFCMPcode()` macro is an internal macro of
the **GSM** (a.k.a. *Generate Secure Macros*) package.
@@ -219,11 +252,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
%GSMpck_makeFCMPcode(
path
,number
<,trim=0>
<,outlib=work.generateMacros.secure>
<,source2=>
<,fileNameCode=FNC>
<,secret=123456789>
<,lineEnd=0A>
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -234,9 +267,6 @@ The basic syntax is the following, the `<...>` means optional parameters:
2. `number` - *Required*, a sequential number.
* `trim=` - *Optional*, the default value is `0`.
If set to `1` then lines of macro code are trimmed.
If set to `2` then lines of macro code are stripped.
* `cmplib=` - *Optional*, the default value is `work.generateMacros`.
Names the dataset which will contain generated functions.
@@ -253,6 +283,17 @@ The basic syntax is the following, the `<...>` means optional parameters:
function. User who do not know the value will not be able
to run the `_maxro_XX_()` function.
* `lineEnd=` - *Optional*, the default value is `0D0A`, indicates which of:
line feed, carriage return, or both, or a space be inserted
at the end of line in the intermediate code file that is generated.
Value has to be hexadecimal code (_NOT_ null),
since the value is resolved as `"&lineEnd."x`, so use e.g.
`0A` for line feed, `0D` for carriage return,
`0D0A` for both, and `20` for space.
* `trim=` - *Deprecated*, the default value is `0`.
*Kept for backward compatibility.*
---

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 20220113.*
*SAS package generated by generatePackage, version 20221112.*
The SHA256 hash digest for package macroArray:
`DAEB87654D99965BF2B7A6AB14626B3E617D0ABF526E77725DF89A1AB4C812C2`
`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 20220113*
*SAS package generated by generatePackage, version 20221112*
The SHA256 hash digest for package SQLinDS:
`DCAB62267B52822F416BA7E6713A696D843E8092A4E3A37DF06CBE1E1D5DAD11`
`A070214517CC36590083FCF9D5F488AC6E746793E94B9AA55D09A419CF291B5B`
---
# Content description ############################################################################################

Binary file not shown.