Compare commits

..

126 Commits

Author SHA1 Message Date
Bart Jablonski
0f7babea91 Merge pull request #122 from yabwon/main
SAS Packages Framework, version 20251221
2025-12-21 22:06:53 +01:00
Bart Jablonski
76bd106e20 SAS Packages Framework, version 20251221
SAS Packages Framework, version 20251221

Changes:
- 3 new macros: `%relocatePackage()`, `%SasPackagesFrameworkNotes()`, and `%isPackagesFilerefOK()` added.
- Documentation updated.
2025-12-21 22:04:57 +01:00
Bart Jablonski
3c29e9eb9c Merge pull request #121 from yabwon/main
SAS Packages Framework, version 20251221
2025-12-21 21:33:27 +01:00
Bart Jablonski
c3bd55b868 SAS Packages Framework, version 20251221
SAS Packages Framework, version 20251221

Changes:
- 3 new macros: `%relocatePackage()`, `%SasPackagesFrameworkNotes()`, and `%isPackagesFilerefOK()` added.
- Documentation updated.
2025-12-21 21:32:33 +01:00
Bart Jablonski
37419f1826 Merge pull request #119 from yabwon/main
SAS Packages Framework, version 20251126
2025-11-26 21:22:49 +01:00
Bart Jablonski
b71b0382c5 SAS Packages Framework, version 20251126
SAS Packages Framework, version 20251126

Changes:
- Automatic documentation generator in the %generatePackage() macro can now exclude files generated by `%splitCodeForPackage()` macro.
2025-11-26 20:58:03 +01:00
Bart Jablonski
f61e68490a Merge pull request #118 from yabwon/main
SAS Packages Framework, version 20251122
2025-11-22 13:20:08 +01:00
Bart Jablonski
200bab261e SAS Packages Framework, version 20251122
SAS Packages Framework, version 20251122

Changes:
- When a package is generated with the `%generatePackage()` macro, additional info about operating system and SAS release are added to the help notes.
- Documentation updated.

The SQLinDS package [ver. 2.3.1]

Package regenerated with SAS Packages Framework, version 20251122. No functional changes, documentation cleaned up.
2025-11-22 13:18:32 +01:00
Bart Jablonski
b8d5f286d2 Merge pull request #117 from yabwon/main
pull request
2025-11-21 11:15:45 +01:00
Bart Jablonski
b69ee84a1d The BasePlus package [ver. 3.1.1]
The BasePlus package [ver. 3.1.1]

Update:
- Minor updates `%dirsAndFiles()` macro.

- File SHA256: `F*6394CE27FBCF48D475F682CBCF8CA8B4FDD6D40D2672EF571F4A561BDDF274A6` for this version
- Content SHA256: `C*3CA28DF8F3E6D6670D7FD44788D347452F24F4BCF18115873E7EBC742FE30CA4` for this version
2025-11-05 15:19:29 +01:00
Bart Jablonski
801a4731ec The BasePlus package [ver. 3.1.0]
The BasePlus package [ver. 3.1.0]

Update:
- Update in macro `%findDSwithVarVal()`. To handle bigger range of engines, when a library is assigned with different engine than: "BASE","SPDE","V6","V7","V8","V9","CVP" observation number is not returned.

- File SHA256: `F*9FFBC40A2B7FC51161C7D6D120DADC3ACEF8087E4EB43BB1A3F0FBC1F1CBD5AC` for this version
- Content SHA256: `C*76C55A9F392EAB938D199144CC834EF332CD78BA8B98565FA003DEA509A33A3E` for this version
2025-10-20 11:01:40 +02:00
Bart Jablonski
8d8186fc78 Merge pull request #116 from yabwon/main
SAS Packages Framework, version 20251017
2025-10-19 21:54:35 +02:00
Bart Jablonski
b4b319a2e0 SAS Packages Framework, version 20251017
SAS Packages Framework, version 20251017

Changes:
- New parameters `workInTestResults=` and `testWorkPath=` added to the `%generatePackage()` macro.
- Documentation updated.
2025-10-19 21:36:03 +02:00
Bart Jablonski
9cf3332e60 The BasePlus package [ver. 3.0.0]
The BasePlus package [ver. 3.0.0]

New:
- New utility macro `%workLib()`, created in collaboration with Ryo Nakaya, added.

- File SHA256: `F*B9F6D8F1EDD1ECDA89F4BE327C4F4202649475D1D9DFB476279B633D9F14125D` for this version
- Content SHA256: `C*680412F6B403870A3A8975FC17300F7C92AEDECA48D3F242B5BC4E545DC6D313` for this version
2025-10-15 10:23:42 +02:00
Bart Jablonski
998a23c980 Update README.md 2025-10-13 10:02:21 +02:00
Bart Jablonski
3701986fab SAS Packages Framework logo 2025-10-13 09:41:54 +02:00
Bart Jablonski
31a29b3528 SESUG 2025 conference article added to the documentation
SESUG 2025 conference article added to the documentation
2025-10-02 11:03:01 +02:00
Bart Jablonski
fab9fb7166 Update README.md
Link to "SAS Package ー その共有、もっとスマートに" video added.
2025-09-30 22:32:32 +02:00
Bart Jablonski
1d83c65a9b Merge pull request #114 from yabwon/main
pull request
2025-09-09 22:46:31 +02:00
Bart Jablonski
71503379bf The BasePlus package [ver. 2.4.1]
The BasePlus package [ver. 2.4.1]

Fix:
- Fix engine recognition code in `%splitDSintoBlocks()` macro.

- File SHA256: `F*DB0811D8F207641BD45FCE30CB75D03CDF8D06849EBEA268BB575358FAA4E76C` for this version
- Content SHA256: `C*27861ABABB412E8229FE25CD5EEA868F49BB3CBD805CCE65F321ADBC522FAC4E` for this version
2025-09-05 10:30:18 +02:00
Bart Jablonski
79bd3d0c0a Update README.md 2025-08-07 18:49:17 +02:00
Bart Jablonski
f01ac518a6 The BasePlus package [ver. 2.4.0]
The BasePlus package [ver. 2.4.0]

Changes:
- new parameter `backslashSens=` added to the `%dirsAndFiles()` macro.

- File SHA256: `F*19FE220C82DE4B9990B4AC352A9D9DEF5FAF2FD601BE756B2F3A2AC39CDAF381` for this version
- Content SHA256: `C*83DEF0C93481B1C77494531E5CE9F8EB8E4C15AB3CC48D1E9C0223C13A84DB3F` for this version
2025-08-07 18:26:26 +02:00
Bart Jablonski
e8d1269f6c Merge pull request #113 from yabwon/main
The BasePlus package [ver. 2.3.1]
2025-08-05 14:19:19 -04:00
Bart Jablonski
62b7c64063 The BasePlus package [ver. 2.3.1]
The BasePlus package [ver. 2.3.1]

Changes:
Fix in log notes produced by `%getVars()` and `%QgetVars()`.

- File SHA256: `F*B2D318DD9708D74E5A7C419F7CAE1BF46D662B7F6AEE7E6B1B9D9B6858A5C41A` for this version
- Content SHA256: `C*C34B47FDC4A22C5F5EACA087FA5308B97C367E8B7C32C5B28D37B491C6DAA9A3` for this version
2025-08-05 20:18:11 +02:00
Bart Jablonski
ef3afe837d The BasePlus package [ver. 2.3.0]
# The BasePlus package [ver. 2.3.0]

- File SHA256: `F*71DC1AFA709B2977E8AEA452721776F62EEC8240ABD658AC83AA6D4310FC49B6` for this version
- Content SHA256: `C*9CEDE8C64D2C619EBC27AC85B4904D2CE2423C832C6C313E526946FC1417EFD1` for this version

---

### Changes:

Update in macros:
- `%getVars()` and `%QgetVars()`

    - New *optional* parameter `nlit=`. Introduced to improve `validvarname=ANY` handling. Indicates if the `NLITERAL()` function should be executed to cover spacial characters. Default value is `0`.
    - Code simplification for the `mcArray=` parameter case.
    - Situation when the `%getVars()` macro is called with `mcArray=` in `%put` or `%let` statements is handled more gracefully.

- `%zipEvalf()` and `%QzipEvalf()`

    - If the list contains quoted blanks, they are respected now, i.e. `a "b c"` are considered 2 strings, `a` and `b c`.

See documentation for details.

---
2025-08-04 15:45:33 +02:00
Bart Jablonski
ba34a71ffe Merge pull request #112 from yabwon/main
SAS Packages Framework, version 20250729
2025-07-29 05:52:46 -04:00
Bart Jablonski
ff758fc2cc Merge pull request #111 from yabwon/main
SAS Packages Framework, version 20250728
2025-07-28 05:53:45 -04:00
Bart Jablonski
35b30ca45e Merge pull request #110 from yabwon/main
SAS Packages Framework, version 20250710
2025-07-10 08:04:33 -04:00
Bart Jablonski
bfdede5dd4 Merge pull request #109 from yabwon/main
update README.md
2025-06-11 13:32:59 -04:00
Bart Jablonski
856c73758f Merge pull request #108 from yabwon/main
SAS Packages Framework, version 20241207
2024-12-07 23:13:42 +01:00
Bart Jablonski
104c38ab2c Merge pull request #107 from yabwon/main
SAS Packages Framework, version 20241129
2024-11-29 17:08:10 +01:00
Bart Jablonski
9a7b81c2ad Merge pull request #106 from yabwon/main
SAS Packages Framework, version 20241102
2024-11-02 22:24:21 +01:00
Bart Jablonski
a56da0fa4f Merge pull request #105 from yabwon/main
SAS Packages Framework, version 20241027
2024-10-28 10:34:16 +01:00
Bart Jablonski
edeb1729b5 Merge pull request #104 from yabwon/main
SAS Packages Framework, version `20241014`
2024-10-14 21:44:37 +02:00
Bart Jablonski
9b2ec979e4 Merge pull request #103 from yabwon/main
SAS Packages Framework, version 20240927
2024-09-27 11:27:06 +02:00
Bart Jablonski
efda10b412 Merge pull request #102 from yabwon/main
The BasePlus package [ver. 2.0.1]
2024-07-24 08:11:27 +02:00
Bart Jablonski
78a79d1fc7 Merge pull request #101 from yabwon/main
The BasePlus package [ver. 2.0.0]
2024-07-23 22:17:14 +02:00
Bart Jablonski
e61a9689df Merge pull request #100 from yabwon/main
The BasePlus package [ver. 1.43.0]
2024-07-22 09:06:08 +02:00
Bart Jablonski
044019608f Merge pull request #99 from yabwon/main
The BasePlus package [ver. 1.42.1]
2024-07-19 10:30:22 +02:00
Bart Jablonski
fedf5b894d Merge pull request #98 from yabwon/main
SAS Packages Framework, version `20240711`
2024-07-11 14:59:42 +02:00
Bart Jablonski
3c30e7d17c Merge pull request #97 from yabwon/main
The BasePlus package [ver. 1.42.0]
2024-07-10 23:09:57 +02:00
Bart Jablonski
a99b75ffe9 Merge pull request #96 from yabwon/main
The BasePlus package [ver. 1.40.0]
2024-06-06 22:23:23 +02:00
Bart Jablonski
e7357877f0 Merge pull request #95 from yabwon/main
SAS Packages Framework, version `20240529`
2024-05-29 16:39:15 +02:00
Bart Jablonski
05946c92ce Merge pull request #94 from yabwon/main
SAS Packages Framework, version 20240423
2024-04-23 11:33:44 +02:00
Bart Jablonski
b3b36174af Merge pull request #93 from yabwon/main
SAS Packages Framework, version 20240415
2024-04-15 19:33:16 +02:00
Bart Jablonski
62fd354c6d SAS Packages Framework, version 20240415
SAS Packages Framework, version 20240415

Features:

- In the `%generatePackage()` macro, when `markdownDoc=` parameters is used, package files can be "excluded" from being used to produce documentation markdown file.

- Documentation updated.
2024-04-15 19:24:07 +02:00
Bart Jablonski
7f97b47a21 Merge pull request #92 from yabwon/main
The BasePlus package [ver. 1.38.0]
2024-03-12 14:48:52 +01:00
Bart Jablonski
340d13e56f Merge pull request #91 from yabwon/main
The BasePlus package [ver. 1.37.0]
2024-03-09 13:57:50 +01:00
Bart Jablonski
d68697ea77 Merge pull request #90 from yabwon/main
SAS Packages Framework, version 20231210
2023-12-12 11:54:30 +01:00
Bart Jablonski
9bb8354faa Merge pull request #88 from yabwon/main
The macroArray package [ver. 1.2.6]
2023-12-01 12:56:02 +01:00
Bart Jablonski
d0ff15fe80 Merge pull request #87 from yabwon/main
SAS Packages Framework, version `20231123`
2023-11-29 17:07:12 +01:00
Bart Jablonski
fe70185832 Merge pull request #86 from yabwon/main
The BasePlus package [ver. 1.35.0]
2023-11-14 14:45:52 +01:00
Bart Jablonski
83bef9fe30 Merge pull request #85 from yabwon/main
The BasePlus package [ver. 1.35.0]
2023-11-14 14:38:31 +01:00
Bart Jablonski
fd0a67de4e Merge pull request #84 from yabwon/main
SAS Packages Framework, version `20231107`
2023-11-07 12:41:48 +01:00
Bart Jablonski
60405c2226 Merge pull request #83 from yabwon/main
The BasePlus package [ver. 1.32.0]
2023-10-26 13:49:52 +02:00
Bart Jablonski
b6c554d994 Merge pull request #82 from yabwon/main
SAS Packages Framework version 20231024
2023-10-24 14:52:38 +02:00
Bart Jablonski
b7ce4778bb Merge pull request #81 from yabwon/main
SAS Packages Framework version 20231009
2023-10-09 18:06:42 +02:00
Bart Jablonski
956cfce026 Merge pull request #80 from yabwon/main
The BasePlus package [ver. 1.30.0]
2023-09-19 17:45:24 +02:00
Bart Jablonski
2c1a7eacc3 Merge pull request #79 from yabwon/main
The macroArray package [ver. 1.1.0]
2023-09-06 23:11:22 +02:00
Bart Jablonski
1a6f0c0013 Merge pull request #78 from yabwon/main
SAS Packages Framework, version `20230904`
2023-09-04 16:44:32 +02:00
Bart Jablonski
8a30b5a918 Merge pull request #77 from yabwon/main
The BasePlus package [ver. 1.29.0]
2023-08-24 11:33:19 +02:00
Bart Jablonski
b209d022b3 Merge pull request #76 from yabwon/main
The GSM package [ver. 0.21.0]
2023-07-27 11:15:52 +02:00
Bart Jablonski
680c021f72 Merge pull request #75 from yabwon/main
The BasePlus package [ver. 1.26.1]
2023-06-02 11:43:43 +02:00
Bart Jablonski
ad15aa0e3b Merge pull request #74 from yabwon/main
The BasePlus package [ver. 1.26.0]
2023-06-01 17:51:17 +02:00
Bart Jablonski
b78dac17e7 Merge pull request #73 from yabwon/main
The BasePlus package [ver. 1.26.0]
2023-06-01 17:05:47 +02:00
Bart Jablonski
974f617772 Merge pull request #72 from yabwon/main
The BasePlus package [ver. 1.24.2]
2023-05-26 11:19:27 +02:00
Bart Jablonski
5550b0d1de Merge pull request #71 from yabwon/main
SAS Packages Framework, version 20230520
2023-05-20 17:37:21 +02:00
Bart Jablonski
0979066509 Merge pull request #70 from yabwon/main
pull request
2023-05-03 23:06:54 +02:00
Bart Jablonski
344619d195 Merge pull request #69 from yabwon/main
The BasePlus package [ver. 1.20.0]
2023-04-17 14:58:51 +02:00
Bart Jablonski
a7c6a670bf Merge pull request #68 from yabwon/main
SAS Packages Framework, version 20230411
2023-04-11 18:41:16 +02:00
Bart Jablonski
01513d9cdb Merge pull request #67 from yabwon/main
Pull request
2023-04-02 18:37:25 +02:00
Bart Jablonski
62ad0c1045 Merge pull request #66 from yabwon/main
SAS Packages Framework, version 20230207
2023-02-07 18:09:36 +01:00
Bart Jablonski
be6d41ae7d Merge pull request #65 from yabwon/main
SAS Packages Framework, version 20230112
2023-01-12 17:30:31 +01:00
Bart Jablonski
c92edcbbd6 Merge pull request #64 from yabwon/main
SAS Packages Framework, version 20221215
2022-12-15 18:09:02 +01:00
Bart Jablonski
b6f9a65f5f Merge pull request #63 from yabwon/main
SAS Packages Framework, version 20221212
2022-12-12 23:45:30 +01:00
Bart Jablonski
d8451c08bc Merge pull request #62 from yabwon/main
SAS Packages Framework, version 20221125
2022-11-26 23:53:51 +01:00
Bart Jablonski
565d7d3f6e Merge pull request #61 from yabwon/main
SAS Packages Framework, version 20221121
2022-11-21 14:31:45 +01:00
Bart Jablonski
f2a72739c7 Merge pull request #60 from yabwon/main
Bunch of small updates
2022-11-13 20:20:30 +01:00
Bart Jablonski
394aaab3be Merge pull request #59 from yabwon/main
SAS Packages Framework, version 20221112
2022-11-12 17:31:22 +01:00
Bart Jablonski
88e97ecd7f Merge pull request #58 from yabwon/main
SAS Packages Framework, version 20221107
2022-11-07 10:48:49 +01:00
Bart Jablonski
ebcad71357 Merge pull request #57 from yabwon/main
SAS Packages Framework, ver. 20221022
2022-10-22 22:19:56 +02:00
Bart Jablonski
e9e3518b6a Merge pull request #56 from yabwon/main
SAS Packages Framework, version 20221002
2022-10-01 12:15:38 +02:00
Bart Jablonski
e17c325e5c Merge pull request #55 from yabwon/main
SAS Packages Framework, version 20221001
2022-10-01 01:11:49 +02:00
Bart Jablonski
6891d9d4c6 Merge pull request #54 from yabwon/main
**SAS Packages Framework**, version 20220930.
2022-09-30 20:42:38 +02:00
Bart Jablonski
1f093a749b Merge pull request #53 from yabwon/main
SAS Packages Framework, version 20220925, extension
2022-09-28 22:45:35 +02:00
Bart Jablonski
9331fa488d Merge pull request #52 from yabwon/main
SAS Packages Framework, version 20220925
2022-09-25 19:17:41 +02:00
Bart Jablonski
6194dcb2a0 Merge pull request #51 from yabwon/main
pull request
2022-08-30 19:18:39 +02:00
Bart Jablonski
bbd018bf61 Merge pull request #49 from yabwon/main
The SAS Packages Framework, version 20220830:
2022-08-30 19:07:19 +02:00
Bart Jablonski
f3b3b55dba Merge pull request #48 from yabwon/main
Innitiative to add SAS Packages Framework to SAS Base/Viya
2022-05-31 21:55:22 +02:00
Bart Jablonski
bd3a78adfd Merge pull request #47 from yabwon/main
The BasePlus package [ver. 1.17]
2022-05-11 23:48:25 +02:00
Bart Jablonski
6487d74aaf Merge pull request #46 from yabwon/main
The BasePlus package [ver. 1.16]
2022-05-09 19:07:45 +02:00
Bart Jablonski
4c734caeec Merge pull request #45 from yabwon/main
The BasePlus package [ver. 1.15]
2022-05-08 19:18:26 +02:00
Bart Jablonski
11400fe51d Merge pull request #44 from yabwon/main
**SAS Packages Framework**, version 20220420
2022-04-20 22:40:24 +02:00
Bart Jablonski
6e5d4c3872 Merge pull request #43 from yabwon/main
The GSM package [ver. 0.20]
2022-04-06 18:15:35 +02:00
Bart Jablonski
3ccf2490e1 Merge pull request #42 from yabwon/main
The GSM package [ver. 0.19]
2022-03-13 20:45:35 +01:00
Bart Jablonski
9273e80a16 Merge pull request #41 from yabwon/main
The GSM package [ver. 0.18]
2022-03-07 16:46:02 +01:00
Bart Jablonski
5cbe17b513 Merge pull request #40 from yabwon/main
pull request
2022-02-17 14:25:47 +01:00
Bart Jablonski
21a713ced7 Merge pull request #39 from yabwon/main
**SAS Packages Framework**, version 20220113
2022-01-13 17:01:35 +01:00
Bart Jablonski
0af4000d33 Merge pull request #38 from yabwon/main
BasePlus package [ver. 1.14]
2022-01-11 14:10:58 +01:00
Bart Jablonski
ae423c362b Merge pull request #37 from yabwon/main
BasePlus package [ver. 1.13]
2022-01-11 11:07:18 +01:00
Bart Jablonski
705a600534 Merge pull request #36 from yabwon/main
Package MacroArray, version 0.9
2021-12-28 18:34:13 +01:00
Bart Jablonski
2137c04534 Merge pull request #35 from yabwon/main
pull request
2021-12-16 10:41:37 +01:00
Bart Jablonski
49bcb64e51 Merge pull request #34 from yabwon/main
SAS Packages Framework, version 220211216
2021-12-16 10:19:42 +01:00
Bart Jablonski
8bdf820958 Merge pull request #31 from yabwon/main
Package BasePlus, version 1.12
2021-11-23 12:52:43 +01:00
Bart Jablonski
2045048ff3 Merge pull request #30 from yabwon/main
Package BasePlus, version 1.11
2021-11-19 17:09:53 +01:00
Bart Jablonski
f4007a22df Merge pull request #29 from yabwon/main
Package BasePlus, version 1.1
2021-11-14 16:14:43 +01:00
Bart Jablonski
96952896a2 Merge pull request #28 from yabwon/main
Package BasePlus, version 1.0
2021-11-13 22:55:51 +01:00
Bart Jablonski
f886a42b77 Merge pull request #27 from yabwon/main
pull request
2021-11-12 13:59:57 +01:00
Bart Jablonski
612e955983 Merge pull request #26 from yabwon/main
Package GSM, version 0.16
2021-11-12 11:14:29 +01:00
Bart Jablonski
907ad0865d Merge pull request #25 from yabwon/main
SAS Packages Framework, version 20211111
2021-11-10 20:25:29 +01:00
Bart Jablonski
9d37f157c7 Merge pull request #24 from yabwon/main
**GSM** (Generate Secure Macros) package, version 0.15
2021-11-05 13:50:47 +01:00
Bart Jablonski
f5159f9557 Merge pull request #23 from yabwon/main
BasePlus, version 0.994
2021-10-05 12:09:11 +02:00
Bart Jablonski
033961fba2 Merge pull request #22 from yabwon/main
pull request
2021-10-01 21:23:48 +02:00
Bart Jablonski
1e31a9cec4 Merge pull request #21 from yabwon/main
pull request
2021-08-18 23:02:20 +02:00
Bart Jablonski
9f8560aa61 Merge pull request #20 from yabwon/main
pull request
2021-07-19 13:02:42 +02:00
Bart Jablonski
4599a6e06d Merge pull request #19 from yabwon/main
**SAS Packages Framework**, version 20210528
2021-05-28 14:54:27 +02:00
Bart Jablonski
28c8afac49 Merge pull request #18 from yabwon/main
pull request
2021-05-20 15:43:02 +02:00
Bart Jablonski
aac8a3ca0a Merge pull request #17 from yabwon/main
pull request
2021-05-16 21:46:47 +02:00
yabwon
82bb81624f Merge branch 'master' of https://github.com/yabwon/SAS_PACKAGES 2021-03-30 22:44:25 +02:00
Bart Jablonski
9bccf5b9f5 Merge pull request #16 from yabwon/main
pull reques
2021-03-30 22:43:03 +02:00
yabwon
cad068d931 Final version of SGF2021 article
Final version of SGF2021 article
2021-03-30 22:39:17 +02:00
Bart Jablonski
b9c280d983 Merge pull request #15 from yabwon/main
*SAS Packages Framework*, version 20210204
2021-02-04 13:44:09 +01:00
Bart Jablonski
ca72c14569 Merge pull request #14 from yabwon/main
pull request
2021-02-03 21:21:59 +01:00
Bart Jablonski
aa84650b42 Merge pull request #13 from yabwon/main
pull request
2021-01-22 17:00:32 +01:00
Bart Jablonski
60354ce484 Merge pull request #12 from yabwon/main
pull request
2021-01-17 21:13:38 +01:00
Bart Jablonski
793d0c7d6a Merge pull request #11 from yabwon/main
pull request
2021-01-09 21:03:09 +01:00
30 changed files with 3270 additions and 576 deletions

View File

@@ -1,4 +1,6 @@
# SAS_PACKAGES - a SAS Packages Framework
# SAS Packages Framework
![SAS Packages Framework](./SPF/Logo/SPFlogo1200x770.png "SAS Packages Framework")
---
@@ -6,27 +8,28 @@ 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.
In this repository we are presenting the **SAS Packages Framework** - a tool that allows to develop and use SAS packages.
Don't forget to give the repository a **STAR** and become [stargazer](https://github.com/yabwon/SAS_PACKAGES/stargazers)! :-)
---
---
### Current version:
**The latest version** of the **SAS Packages Framework** is **`20250729`**.
**The latest version** of the **SAS Packages Framework** is **`20251221`**.
---
---
## Intro:
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).
To get started with SAS Packages try: [**`Introduction to SAS Packages`**](https://youtube.com/playlist?list=PLeMzGEImIT5eV13IGXQIgWmTFCJt_cLZG&si=ElQm0_ifq76mvUbq "Introduction to SAS Packages video series") video series or [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
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).
The documentation and more advance reading can be found in 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).
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")
Short description of the SAS Packages Framework macros and their parameters can be found [here](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/SPFinit.md "Short description of the SAS Packages Framework macros")
### Recordings and Presentations:
@@ -41,6 +44,7 @@ Videos presenting the SPF and packages, from various conferences and meetups (th
- ["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 communities.sas.com") (September 27th-29th 2022, ~28 minutes, technical presentation with details about the BasePlus package), alternative video at YouTube is [here](https://www.youtube.com/watch?v=-Poxkx5WfOQ "SASexplore2022 TouTube")
- ["SAS Packages - State of the Union" - SaSensei International Dojo No. 13](https://www.youtube.com/watch?v=1GEldZYQjj0&t=0s "SID no. 13") (November 10th 2022, ~50 minutes, general overview with the latest technical details)
- ["SAS Packages Framework - an easy code sharing medium for SAS" - Warsaw IT Days 2023](https://youtu.be/T52Omisi0dk&t=0s "Warsaw IT Days 2023") (March 31st 2023, ~60 minutes, general overview with technical details for user and developer)
- ["SAS Package ー その共有、もっとスマートに" - SASユーザー総会 2025](https://youtu.be/4QRr7sUhO9E "SASユーザー総会2025") (September 25th 2025, ~22 minutes, general overview with the list of reasons: why is it worth to use SAS packages?)
### Tutorials:
@@ -49,7 +53,7 @@ Here are links to some tutorials which may help you to start with the framework.
Order is dictated by the amount of details presented.
Letter "D" indicates tutorial dedicated for developers and "U" materials for users.
1) (DU) The latest [video](https://youtu.be/T52Omisi0dk&t=0s) explaining the idea.
1) (DU) A [video](https://youtu.be/T52Omisi0dk&t=0s) explaining the idea in more details.
2) (D) Very simple ["Hello World" example](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/HelloWorldPackage.md) tutorial for developers. As a support a [walk-through video](https://youtu.be/T52Omisi0dk&t=2160s)
@@ -64,7 +68,7 @@ Letter "D" indicates tutorial dedicated for developers and "U" materials for use
### Initiative to add SAS Packages Framework to SAS Base/Viya:
A **SASware Ballot Idea** for adding *SAS Packages Framework* macros into Base SAS and Viya was submitted Friday, May 27th 2022. If you would like to support the idea visit this [**communities.sas.com post**](https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-SAS-Packages-Framework-to-the-SAS-Base-Viya/idi-p/815508) and up vote the idea! We have 46 likes from 44 supporters up to today (as of April 22, 2025)!
A **SASware Ballot Idea** for adding *SAS Packages Framework* macros into Base SAS and Viya was submitted Friday, May 27th 2022. If you would like to support the idea visit this [**communities.sas.com post**](https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-SAS-Packages-Framework-to-the-SAS-Base-Viya/idi-p/815508) and up vote the idea! We have 48 likes from 46 supporters up to today (as of September 30, 2025)!
---
@@ -186,6 +190,7 @@ The SAS Packages Framework [(short) documentation](https://github.com/yabwon/SAS
---
### Updates worth mentioning:
**Update**\[December 21st, 2025\]**:** `%relocatePackage()`, `%SasPackagesFrameworkNotes()`, and `%isPackagesFilerefOK()` **utility macros are available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241221 "splitCodeForPackage"))**.
**Update**\[October 27th, 2024\]**:** `%splitCodeForPackage()` **utility macro is available. (see [here](https://github.com/yabwon/SAS_PACKAGES/releases/tag/20241027 "splitCodeForPackage"))**.
@@ -218,13 +223,15 @@ The SAS Packages Framework [(short) documentation](https://github.com/yabwon/SAS
---
## Where the SAS Packages Framework is used:
This is a list of locations where the SAS Packages Framework is used:
- Warsaw (Poland)
- Osaka (Japan)
- Kyoto (Japan)
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 (:star:)](https://github.com/yabwon/SAS_PACKAGES/stargazers)** so more people will know.
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.
---

Binary file not shown.

BIN
SPF/Logo/SPFlogo.pdf Normal file

Binary file not shown.

BIN
SPF/Logo/SPFlogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

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

View File

@@ -3,7 +3,7 @@
Macro to generate SAS packages.
Version 20250729
Version 20251221
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -20,30 +20,36 @@
filesLocation /* location of package files
e.g. /path/to/package/files/locatiion or C:\my\package\files */
/* testing options: */
,testPackage=Y /* indicator if tests should be executed,
default value Y means "execute tests" */
,packages= /* location of other packages if there are
dependencies in loading, must be a single directory
if more than one are provided only the first is used */
,testResults= /* location where tests results should be stored,
if null (the default) the WORK is used */
,sasexe= /* a DIRECTORY where the SAS binary is located,
if null (the default) then the !SASROOT is used */
,sascfgFile= /* 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=1 /* indicates if `WORK` directories generated by user tests
should be deleted, i.e. the (NO)WORKTERM option is set,
default value 1 means "delete tests work" */
,markdownDoc=0 /* indicates if a markdown file with documentation
be generated from help info blocks */
,easyArch=0 /* when creating documentation file indicates if a copy of
the zip and markdown files with the version number in the
file name be created */
,testPackage=Y /* indicator if tests should be executed,
default value Y means "execute tests" */
,packages= /* location of other packages if there are
dependencies in loading, must be a single directory
if more than one are provided only the first is used */
,testResults= /* location where tests results should be stored,
if null (the default) the WORK is used */
,workInTestResults=0 /* indicates if WORK directories for tests should located
in the same place as results */
,testWorkPath= /* location where tests SAS sessions' work directories
should be stored, if null (the default) the main SAS
session WORK is used. Takes precedence over workInTestResults= */
,sasexe= /* a DIRECTORY where the SAS binary is located,
if null (the default) then the !SASROOT is used */
,sascfgFile= /* 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=1 /* indicates if `WORK` directories generated by user tests
should be deleted, i.e. the (NO)WORKTERM option is set,
default value 1 means "delete tests work" */
/* documentation options: */
,markdownDoc=0 /* indicates if a markdown file with documentation
be generated from help info blocks */
,easyArch=0 /* when creating documentation file indicates if a copy of
the zip and markdown files with the version number in the
file name be created */
)/ secure minoperator
/*** HELP END ***/
des = 'Macro to generate SAS packages, version 20250729. Run %generatePackage() for help info.'
des = 'Macro to generate SAS packages, version 20251221. Run %generatePackage() for help info.'
;
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
%do;
@@ -54,75 +60,87 @@ des = 'Macro to generate SAS packages, version 20250729. Run %generatePackage()
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ;
%put #################################################################################;
%put ### This is short help information for the `generatePackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to generate SAS packages, version `20250729` #;
%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(%%generatePackage())` macro generates SAS packages. #;
%put # It wraps-up the package content, i.e. macros, functions, formats, etc., #;
%put # into the zip file and generate all metadata content required by other #;
%put # macros from the SAS Packages Framework. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to read about the details of package generation process. #;
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `filesLocation=` Location of package files, example value: #;
%put # `%nrstr(%%sysfunc(pathname(work))/packagename)`. #;
%put # Default use case: #;
%put # `%nrstr(%%generatePackage(filesLocation=/path/to/packagename))` #;
%put # If empty displays this help information. #;
%put # #;
%put # Testing parameters: #;
%put # #;
%put # - `testPackage=` Indicator if tests should be executed. #;
%put # Default value: `Y`, means "execute tests" #;
%put # #;
%put # - `packages=` Location of other packages for testing #;
%put # if there are dependencies in loading the package. #;
%put # Has to be a single directory, if more than one are #;
%put # provided than only the first is used. #;
%put # If path to location contains spaces it should be quoted! #;
%put # #;
%put # - `testResults=` Location where tests results should be stored, #;
%put # if null (the default) then the session WORK is used. #;
%put # #;
%put # - `sasexe=` Location of a DIRECTORY where the SAS binary is located, #;
%put # if null (the default) then the `!SASROOT` is used. #;
%put # #;
%put # - `sascfgFile=` Location of a FILE with testing session configuration #;
%put # parameters, if null (the default) then no config file #;
%put # is pointed during the SAS invocation, #;
%put # if set to `DEF` then the `!SASROOT/sasv9.cfg` is used. #;
%put # #;
%put # - `delTestWork=` Indicates if `WORK` directories generated by user tests #;
%put # should be deleted, i.e. the (NO)WORKTERM option is set. #;
%put # The default value: `1` means "delete tests work". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put # - `markdownDoc=` Indicates if a markdown file with documentation #;
%put # be generated from help information blocks. #;
%put # The default value: `0` means "do not generate the file". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put # - `easyArch=` When creating documentation file (`markdownDoc=1`) #;
%put # indicates if a copy of the zip and markdown files #;
%put # with the version number in the file name be created #;
%put # The default value: `0` means "do not create files". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put #################################################################################;
%put ######################################################################################;
%put ### This is short help information for the `generatePackage` macro #;
%put #------------------------------------------------------------------------------------#;
%put # #;
%put # Macro to generate SAS packages, version `20251221` #;
%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(%%generatePackage())` macro generates SAS packages. #;
%put # It wraps-up the package content, i.e. macros, functions, formats, etc., #;
%put # into the zip file and generate all metadata content required by other #;
%put # macros from the SAS Packages Framework. #;
%put # #;
%put #------------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to read about the details of package generation process. #;
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `filesLocation=` Location of package files, example value: #;
%put # `%nrstr(%%sysfunc(pathname(work))/packagename)`. #;
%put # Default use case: #;
%put # `%nrstr(%%generatePackage(filesLocation=/path/to/packagename))` #;
%put # If empty displays this help information. #;
%put # #;
%put # Testing parameters: #;
%put # #;
%put # - `testPackage=` Indicator if tests should be executed. #;
%put # Default value: `Y`, means "execute tests" #;
%put # #;
%put # - `packages=` Location of other packages for testing #;
%put # if there are dependencies in loading the package. #;
%put # Has to be a single directory, if more than one are #;
%put # provided than only the first is used. #;
%put # If path to location contains spaces it should be quoted! #;
%put # #;
%put # - `testResults=` Location where tests results should be stored, #;
%put # if null (the default) then the session WORK is used. #;
%put # #;
%put # - `workInTestResults=` Indicates if WORK directories for test sessions should #;
%put # be located in the same place as results. #;
%put # The default value: `0` means "do not do this". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put # - `testWorkPath=` Points a location where tests sessions work directories #;
%put # should be stored. By default it is null what means that #;
%put # a sub-directory of the main SAS session WORK is used. #;
%put # Takes precedence over `workInTestResults=`. #;
%put # #;
%put # - `sasexe=` Location of a DIRECTORY where the SAS binary is located, #;
%put # if null (the default) then the `!SASROOT` is used. #;
%put # #;
%put # - `sascfgFile=` Location of a FILE with testing session configuration #;
%put # parameters, if null (the default) then no config file #;
%put # is pointed during the SAS invocation, #;
%put # if set to `DEF` then the `!SASROOT/sasv9.cfg` is used. #;
%put # #;
%put # - `delTestWork=` Indicates if `WORK` directories generated by user tests #;
%put # should be deleted, i.e. the (NO)WORKTERM option is set. #;
%put # The default value: `1` means "delete tests work". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put # Documentation parameters: #;
%put # #;
%put # - `markdownDoc=` Indicates if a markdown file with documentation #;
%put # be generated from help information blocks. #;
%put # The default value: `0` means "do not generate the file". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put # - `easyArch=` When creating documentation file (`markdownDoc=1`) #;
%put # indicates if a copy of the zip and markdown files #;
%put # with the version number in the file name be created #;
%put # The default value: `0` means "do not create files". #;
%put # Available values are `0` and `1`. #;
%put # #;
%put #------------------------------------------------------------------------------------#;
%put ######################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofgeneratePackage;
@@ -873,7 +891,7 @@ title6 "MD5 hashed fileref of package lowcase name: &_PackageFileref_.";
title8 "Required SAS packages: %qsysfunc(compress(%superq(packageReqPackages),%str(%'%")))" ; /* " */
%end;
footnote1 "SAS Packages Framework, version 20250729";
footnote1 "SAS Packages Framework, version 20251221";
proc print
data = &filesWithCodes.(drop=base folderRef fileRef rc folderid _abort_ fileId additionalContent)
@@ -941,27 +959,27 @@ run;
file &zipReferrence.(license.sas) encoding = &packageEncoding.;
length packageAuthor $ 1024;
packageAuthor = symget('packageAuthor');
put " ";
put "Copyright (c) since %sysfunc(today(),year4.) " packageAuthor ;
put " ";
put "Permission is hereby granted, free of charge, to any person obtaining a copy ";
put 'of this software and associated documentation files (the "Software"), to deal ';
put "in the Software without restriction, including without limitation the rights ";
put "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ";
put "copies of the Software, and to permit persons to whom the Software is ";
put "furnished to do so, subject to the following conditions: ";
put " ";
put "The above copyright notice and this permission notice shall be included ";
put "in all copies or substantial portions of the Software. ";
put " ";
put 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ';
put "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ";
put "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ";
put "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ";
put "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ";
put "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ";
put "SOFTWARE. ";
put " ";
put " ";
put "Copyright (c) since %sysfunc(today(),year4.) " packageAuthor ;
put " ";
put "Permission is hereby granted, free of charge, to any person obtaining a copy";
put 'of this software and associated documentation files (the "Software"), to deal';
put "in the Software without restriction, including without limitation the rights";
put "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell";
put "copies of the Software, and to permit persons to whom the Software is";
put "furnished to do so, subject to the following conditions:";
put " ";
put "The above copyright notice and this permission notice shall be included";
put "in all copies or substantial portions of the Software.";
put " ";
put 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR';
put "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,";
put "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE";
put "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER";
put "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,";
put "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE";
put "SOFTWARE.";
put " ";
run;
%end;
@@ -1697,7 +1715,7 @@ data _null_;
%end;
put +(-1) '`.;''' /
' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"' /
' !! '' %put with the SAS Packages Framework version 20250729.;''' /
' !! '' %put with the SAS Packages Framework version 20251221.;''' /
' !! '' %put ****************************************************************************;''' /
' !! '' %GOTO theEndOfTheMacro;''' /
' !! '' %end;''' ;
@@ -1862,7 +1880,7 @@ data _null_;
%end;
put +(-1) '`.; '' !!' /
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !!' /
''' %put with the SAS Packages Framework version 20250729.; '' !! ' /
''' %put with the SAS Packages Framework version 20251221.; '' !! ' /
''' %put ****************************************************************************; '' !! ' /
''' %GOTO theEndOfTheMacro; '' !! ' /
''' %end; '' !! ' /
@@ -2668,9 +2686,11 @@ data _null_;
put "put @3 'localization (only if additional content was deployed during the installation process).';" / "put ;";
%end;
put 'put " " / @3 "--------------------------------------------------------------------" / " ";'
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20250729`*";'
/ 'put " " / @3 "--------------------------------------------------------------------";';
put 'put " " / @3 "---------------------------------------------------------------------" / " ";'
/ 'put @3 "*SAS package generated by SAS Package Framework, version `20251221`*";'
/ "put @3 '*under `&sysscp.`(`&sysscpl.`) operating system,*';"
/ "put @3 '*using SAS release: `&sysvlong4.`.*';"
/ 'put " " / @3 "---------------------------------------------------------------------";';
put 'run; ' /;
@@ -3224,16 +3244,57 @@ options DLCREATEDIR; /* turns-on creation of subdirectories by libname */
/* temporary location for tests results is WORK unless developer provide &testResults. */
%local testPackageTimesamp;
%let testPackageTimesamp = %sysfunc(lowcase(&packageName._%sysfunc(datetime(),b8601dt15.)));
%if %qsysfunc(fileexist(%bquote(&testResults.))) %then
%if %qsysfunc(fileexist(%superq(testResults))) %then
%do;
libname TEST "&testResults./test_&testPackageTimesamp.";
%end;
%else
%do;
%if NOT %sysevalf(%superq(testResults)=,boolean) %then
%do;
%put WARNING: The testResults path:;
%put WARNING- %superq(testResults);
%put WARNING- does not exist. WORK will be used.;
%put WARNING- ;
%end;
libname TEST "&SASWORK./test_&testPackageTimesamp.";
%end;
/* test work points to the SAS session work */
libname TESTWORK "&SASWORK./testwork_&testPackageTimesamp.";
/* test WORK points to the SAS session WORK or to directory pointed by the developer */
%if %qsysfunc(fileexist(%superq(testWorkPath))) %then
%do;
libname TESTWORK "&testWorkPath./testwork_&testPackageTimesamp.";
%put NOTE- ;
%PUT NOTE: WORK libname directories from test SAS sessions will not be deleted.;
%if %sysevalf(1=%superq(workInTestResults),boolean) %then
%do;
%put NOTE- Parameter workInTestResults is ignored;
%end;
%put NOTE- ;
%let delTestWork=0;
%end;
%else %if %sysevalf(1=%superq(workInTestResults),boolean) %then
%do;
libname TESTWORK "%sysfunc(pathname(TEST))";
%put NOTE- ;
%PUT NOTE: WORK libname directories from test SAS sessions will be located in the;
%PUT NOTE- same directory where test resulrs are stored, and will not be deleted.;
%put NOTE- ;
%let delTestWork=0;
%end;
%else
%do;
%if NOT %sysevalf(%superq(testWorkPath)=,boolean) %then
%do;
%put WARNING: The testWorkPath path:;
%put WARNING- %superq(testWorkPath);
%put WARNING- does not exist. WORK will be used.;
%put WARNING- ;
%end;
libname TESTWORK "&SASWORK./testwork_&testPackageTimesamp.";
%end;
%local dirForTest dirForTestWork;
%let dirForTest = %sysfunc(pathname(TEST));
%let dirForTestWork = %sysfunc(pathname(TESTWORK));
@@ -3247,7 +3308,7 @@ filename currdir ".";
filename currdir list;
/* if your package uses any other packages this points to their location */
/* test if packages fileref exists and, if do, use it */
/* test if packages fileref exists and, if it does, use it */
/* if no one is provided the filesLocation is used as a replacement */
%if %bquote(&packages.)= %then %let packages=%sysfunc(pathname(packages));
%if %bquote(&packages.)= %then %let packages=&filesLocation.;
@@ -3273,9 +3334,9 @@ options NOquotelenmax;
data _null_;
file "./loading.sas";
put "proc printto";
put "log = '&dirForTest./loading.log0'";
put "; run;";
put "proc printto"
/ "log = '&dirForTest./loading.log0'"
/ "; run;";
put "filename packages '&packages.';" /;
@@ -3285,18 +3346,18 @@ data _null_;
put '%include packages(loadpackage.sas);' / ; /* for older versions when the SPFinit.sas did not exist */
/* load */
put '%loadpackage'"(&packageName.,";
put " path=&filesLocation.)" /;
put '%loadpackage'"(&packageName.,";
put " path=&filesLocation., lazyData=*)" /;
put '%loadpackage'"(&packageName.,"
/ " path=&filesLocation.)" /;
put '%loadpackage'"(&packageName.,"
/ " path=&filesLocation., lazyData=*)" /;
/* help */
put '%helpPackage'"(&packageName.,";
put " path=&filesLocation.)" /;
put '%helpPackage'"(&packageName.,*,";
put " path=&filesLocation.)" /;
put '%helpPackage'"(&packageName.,License,";
put " path=&filesLocation.)" /;
put '%helpPackage'"(&packageName.,"
/ " path=&filesLocation.)" /;
put '%helpPackage'"(&packageName.,*,"
/ " path=&filesLocation.)" /;
put '%helpPackage'"(&packageName.,License,"
/ " path=&filesLocation.)" /;
/* preview */
put '%previewPackage'"(&packageName.,";
@@ -3316,10 +3377,9 @@ data _null_;
when (upcase(type) in ("LAZYDATA")) /* the "DATA" type will pop-up during deletion */
do;
if 1 = FIRST.type then
put "data _null_; " ;
put " if not exist('" fileshortUP "') then " /
" put 'WARNING: Dataset " fileshortUP "does not exist!'; "
;
put "data _null_; "
/ " if not exist('" fileshortUP "') then "
/ " put 'WARNING: Dataset " fileshortUP "does not exist!'; " ;
if 1 = LAST.type then
put "run; ";
end;
@@ -3327,10 +3387,9 @@ data _null_;
when (upcase(type) =: "MACRO")
do;
if 1 = FIRST.type then
put "data _null_; " ;
put ' if not input(resolve(''%SYSMACEXIST(' fileshortUP ')''), best.) then ' /
" put 'WARNING: Macro " fileshortUP "does not exist!'; "
;
put "data _null_; "
/ ' if not input(resolve(''%SYSMACEXIST(' fileshortUP ')''), best.) then '
/ " put 'WARNING: Macro " fileshortUP "does not exist!'; " ;
if 1 = LAST.type then
put "run; ";
@@ -3348,19 +3407,23 @@ data _null_;
end;
/* unload */
put '%unloadPackage'"(&packageName.,";
put " path=&filesLocation.) " /;
put '%unloadPackage'"(&packageName.,"
/ " path=&filesLocation.) " /;
/* additional content */
put '%loadPackageAddCnt'"(&packageName.,";
put " path=&filesLocation.) " /;
put '%loadPackageAddCnt'"(&packageName.,"
/ " path=&filesLocation.) " /;
put "filename packages '&filesLocation.';" /
'%listPackages() ' /;
put "filename packages '&filesLocation.';"
/ '%listPackages() ' /;
/* check if work should be deleted after test is done */
delTestWork = input(symget('delTestWork'), ?? best32.);
if 0 = delTestWork then
put "options NOWORKTERM;"/;
put "proc printto";
put "; run;";
put "proc printto"
/ "; run;";
stop;
run;
@@ -3471,6 +3534,28 @@ data _null_;
file "./autoexec.sas";
/* check if work should be deleted after test is done */
delTestWork = input(symget('delTestWork'), ?? best32.);
if not(delTestWork in (0 1)) then
do;
putlog "WARNING: [&sysmacroname.] The `delTestWork` parameter is invalid.";
putlog "WARNING- [&sysmacroname.] Default value (1) is set.";
delTestWork = 1;
end;
if 0 = delTestWork then
do;
put "libname _ '&dirForTest.';" /
"data TESTWORK_&t.;" /
" length testName $ 128 testWork $ 2048;" /
" testNumber=&t.; testName='&&TEST_&t..';" /
" testWork = pathname('WORK');" /
"run;" /
"proc append base=_.TESTWORK data=TESTWORK_&t.; run;" /
"proc delete data=TESTWORK_&t.; run;" /
"libname _ clear;" ;
end;
put "proc printto";
put "log = '&dirForTest./&&TEST_&t...log0'";
put "; run;";
@@ -3487,15 +3572,6 @@ data _null_;
put '%loadpackage'"(&packageName.,";
put " path=&filesLocation., lazyData=*)" /;
/* check if work should be deleted after test is done */
delTestWork = input(symget('delTestWork'), ?? best32.);
if not(delTestWork in (0 1)) then
do;
putlog "WARNING: [&sysmacroname.] The `delTestWork` parameter is invalid.";
putlog "WARNING- [&sysmacroname.] Default value (1) is set.";
delTestWork = 1;
end;
if 0 = delTestWork then
put "options NOWORKTERM;"/;
@@ -3572,12 +3648,13 @@ options &notesSourceOptions.;
data test.tests_summary;
length testName $ 128;
do _N_ = 0 to &numberOfTests.;
testName = symget(cats("TEST_", _N_));
systask = coalesce(input(symget(cats("SASSTAT", _N_)), ?? best32.), -1);
sysrc = coalesce(input(symget(cats("TESTRC_", _N_)), ?? best32.), -1);
error = coalesce(input(symget(cats("TESTE_", _N_)), ?? best32.), -1);
warning = coalesce(input(symget(cats("TESTW_", _N_)), ?? best32.), -1);
do testNumber = 0 to &numberOfTests.;
testName = symget(cats("TEST_", testNumber));
systask = coalesce(input(symget(cats("SASSTAT", testNumber)), ?? best32.), -1);
sysrc = coalesce(input(symget(cats("TESTRC_", testNumber)), ?? best32.), -1);
error = coalesce(input(symget(cats("TESTE_", testNumber)), ?? best32.), -1);
warning = coalesce(input(symget(cats("TESTW_", testNumber)), ?? best32.), -1);
output;
end;
run;
@@ -3585,10 +3662,29 @@ title1 "Summary of tests.";
title2 "details can be found in:";
title3 "%sysfunc(pathname(TEST))";
footnote;
proc print data = test.tests_summary;
proc print data = test.tests_summary(drop=testNumber);
run;
title;
%if 0=&delTestWork. %then
%do;
data test.tests_summary;
merge
test.tests_summary
%if %sysfunc(EXIST(test.testwork)) %then
%do; test.testwork %end;
%else
%do; %PUT INFO: Cannot add work path location info.; %end;
;
by testNumber;
run;
%if %sysfunc(EXIST(test.testwork)) %then
%do;
proc delete data=test.testwork;
run;
%end;
%end;
/*%put _local_;*/
%put NOTE: Changing current folder to:;
@@ -3706,9 +3802,11 @@ data &filesWithCodes.markdown;
/ "localization (only if additional content was deployed during the installation process).";
%end;
put " " / "--------------------------------------------------------------------" / " "
/ "*SAS package generated by SAS Package Framework, version `20250729`*"
/ " " / "--------------------------------------------------------------------" / " ";
put " " / "---------------------------------------------------------------------" / " "
/ "*SAS package generated by SAS Package Framework, version `20251221`,*"
/ "*under `&sysscp.`(`&sysscpl.`) operating system,*"
/ "*using SAS release: `&sysvlong4.`.*"
/ " " / "---------------------------------------------------------------------" / " ";
put "# The `&packageName.` package content";
put "The `&packageName.` package consists of the following content:" / " ";
@@ -3721,7 +3819,7 @@ data &filesWithCodes.markdown;
/*
To exclude file from being added to the documentation
insert the "excluding" text(see below) as a comment
in the FIRST line of the file.
in the FIRST or SECOND line of the file!
Do not add spaces.
For each file the first line is read in and checked.
@@ -3735,7 +3833,15 @@ data &filesWithCodes.markdown;
'/*##ExcludeFromDocumentation##*/'
'/*##ExcludeFromMarkdownDoc##*/'
)
then continue; /* exclude file from documentation */
then continue; /* exclude file from documentation after FIRST line */
input;
if strip(_infile_) IN (
'/*##DoNotUse4Documentation##*/'
'/*##ExcludeFromDocumentation##*/'
'/*##ExcludeFromMarkdownDoc##*/'
)
then continue; /* exclude file from documentation after SECOND line */
/* this is because %splitCodeForPackage() macro adds one extra line */
type2=type;
length link $ 256;

View File

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

View File

@@ -1,5 +1,5 @@
/*+installPackage+*/
/* Macros to install SAS packages, version 20250729 */
/* Macros to install SAS packages, version 20251221 */
/* 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
@@ -26,7 +26,7 @@
/secure
minoperator
/*** HELP END ***/
des = 'Macro to install SAS package, version 20250729. Run %%installPackage() for help info.'
des = 'Macro to install SAS package, version 20251221. Run %%installPackage() for help info.'
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
%do;
@@ -41,7 +41,7 @@ des = 'Macro to install SAS package, version 20250729. Run %%installPackage() fo
%put ### This is short help information for the `installPackage` macro #;
%put #--------------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to install SAS packages, version `20250729` #;
%put # Macro to install SAS packages, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -0,0 +1,149 @@
/*+isPackagesFilerefOK+*/
/*** HELP START ***/
%macro isPackagesFilerefOK(
vERRb /* indicates if macro should be verbose and report errors */
)
/ minoperator PARMBUFF
des = 'Macro to check if the PACKAGES fileref is "correct", type %isPackagesFilerefOK(HELP) for help, version 20251221.'
;
/*** HELP END ***/
%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 `isPackagesFilerefOK` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to check if the `packages` fileref is "correct", version `20251221` #;
%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(%%isPackagesFilerefOK())` macro checks if the `packages` fileref #;
%put # is correct, i.e. all listed directories exist, are accessible (can be open), and #;
%put # are assigned with the DISK device. #;
%put # #;
%put # The Macro works as a macro function. It returns `1` wher everything is ok, and #;
%put # it returns `0` if at least one issue exists. #;
%put # #;
%put #### Parameters: #;
%put # #;
%put # 1. `vERRb` - *Optional* Indicates if the macro should return value AND be verbose #;
%put # (e.g., print errors and notes) or just return value. #;
%put # #;
%put # When used as: `%nrstr(%%isPackagesFilerefOK(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 # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
%put # #;
%put #### Example ##############################################################################;
%put # #;
%put # Enabling the SAS Package Framework from the local #;
%put # directory, expanding PACKAGES fileref, and checking #;
%put # if the new one is still correct for installing new package. #;
%put # #;
%put # Assume that the `SPFinit.sas` file #;
%put # is located in the "/sas/PACKAGES/" directory. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( filename packages "/sas/PACKAGES"; %%* set packages filename;);
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework;);
%put ;
%put %nrstr( filename packages ("~/myPCKGs" %%extendPackagesFileref()); %%* add new directory; );
%put ;
%put %nrstr( %if %%IsPackagesFilerefOK() %%then %%* check fileref; );
%put %nrstr( %%do; %%InstallPackage(SQLinDS) %%end; %%* install SQLinDS; );
%put ;
%put %nrstr( %%listPackages() %%* list packages; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put ###########################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofIsPackagesFilerefOK;
%end;
%if NOT (%superq(vERRb) in (0 1)) %then %let vERRb = 0;
%local isPackagesFilerefOK;
%let isPackagesFilerefOK=1;
%local dsid rc nobs i XENGINE XPATH dirid _F_;
%let dsid = %sysfunc(OPEN(sashelp.vextfl(where=(fileref="PACKAGES"))));
%let nobs = %sysfunc(ATTRN(&dsid., nlobsf));
/*%put &=dsid. &=nobs.;*/
%if &nobs. AND 1=&vERRb. %then %put INFO: PACKAGES fileref is: %sysfunc(pathname(PACKAGES));
%let isPackagesFilerefOK=%sysevalf(&nobs. AND 1, boolean);
%do i = 1 %to &nobs.;
%let rc=%sysfunc(FETCHOBS(&dsid., &i.));
%let XENGINE=%sysfunc(GETVARC(&dsid., %sysfunc(VARNUM(&dsid., XENGINE))));
%let XPATH=%sysfunc(GETVARC(&dsid., %sysfunc(VARNUM(&dsid., XPATH))));
%put %superq(XENGINE) %superq(XPATH);
%if DISK ne %superq(XENGINE) %then
%do;
%let isPackagesFilerefOK=0;
%if 1=&vERRb. %then
%do;
%if %superq(XENGINE) = SASFSVAM %then %let XENGINE= FILESRVC (SASFSVAM);
%put ERROR: The %superq(XENGINE) is illegal! Only the DISK device is correct.;
%end;
%end;
%else %if 0=%sysfunc(fileexist(%superq(XPATH))) %then
%do;
%let isPackagesFilerefOK=0;
%if 1=&vERRb. %then
%do;
%put ERROR: Path: %superq(XPATH) does NOT exist!;
%end;
%end;
%else
%do;
%let rc = %sysfunc(FILENAME(_F_, %superq(XPATH)));
%let dirid = %sysfunc(DOPEN(&_F_.));
%let isPackagesFilerefOK=%sysevalf(&dirid. AND 1, boolean);
%let dirid = %sysfunc(DCLOSE(&dirid.));
%let rc = %sysfunc(FILENAME(_F_));
%if 1=&vERRb. AND 0=&isPackagesFilerefOK. %then
%do;
%put ERROR: Path: %superq(XPATH) cannot be open!;
%put ERROR- It may not be a directory or your access rights are insuficient.;
%end;
%end;
%end;
%let dsid = %sysfunc(CLOSE(&dsid.));
%if 1=&vERRb. %then
%do;
%if &isPackagesFilerefOK.=1 %then
%do;
%put %str( );
%put INFO: The PACKAGES fileref is OK. Enjoy!;
%put %str( );
%end;
%else
%do;
%put %str( );
%put ERROR: The PACKAGES fileref is incorrect!;
%put %str( );
%end;
%end;
/* result */
%do;&isPackagesFilerefOK.%return;%end;
%ENDofIsPackagesFilerefOK:
%mend isPackagesFilerefOK;

View File

@@ -3,7 +3,7 @@
Macro to list SAS packages in packages folder.
Version 20250729
Version 20251221
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -23,7 +23,7 @@
%macro listPackages()
/secure PARMBUFF
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20250729.'
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20251221.'
;
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
%do;
@@ -38,7 +38,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
%put ### This is short help information for the `listPackages` macro #;
%put #-----------------------------------------------------------------------------------------#;;
%put # #;
%put # Macro to list available SAS packages, version `20250729` #;
%put # Macro to list available SAS packages, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -36,7 +36,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to load SAS package, version 20250729. Run %loadPackage() for help info.'
des = 'Macro to load SAS package, version 20251221. Run %loadPackage() for help info.'
minoperator
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
@@ -52,7 +52,7 @@ minoperator
%put ### This is short help information for the `loadPackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to *load* SAS packages, version `20250729` #;
%put # Macro to *load* SAS packages, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

@@ -19,7 +19,7 @@
is provided in required version */
)/secure
/*** HELP END ***/
des = 'Macro to load additional content for a SAS package, version 20250729. Run %loadPackageAddCnt() for help info.'
des = 'Macro to load additional content for a SAS package, version 20251221. Run %loadPackageAddCnt() for help info.'
minoperator
;
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
@@ -35,7 +35,7 @@ minoperator
%put ### This is short help information for the `loadPackageAddCnt` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to *load* additional content for a SAS package, version `20250729` #;
%put # Macro to *load* additional content for a SAS package, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -288,9 +288,11 @@ minoperator
run;
data _null_;
set WORK.__&_TargetFileref_._zip___ end = EOF;
set WORK.__&_TargetFileref_._zip___ end = EOF;
wc = countw(file,"/\");
put wc= file=;
length libText pathname_f $ 8192;
libText = pathname("outData", "L");
@@ -309,15 +311,24 @@ minoperator
end;
pathname_f = pathname("f");
rc1 = filename("in", strip(pathname_f), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
length rc1msg $ 8192;
rc1 = filename("in", strip(pathname_f), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
rc1msg = sysmsg();
rc2 = filename("out", catx("/", libText, scan(file, j , "/\")), "disk", "lrecl=1 recfm=n");
length fileNameOutPath $ 8192;
fileNameOutPath = catx("/", libText, scan(file, j , "/\"));
/* check for Windows */
if lengthn(fileNameOutPath)>260 then
if symget('SYSSCP')='WIN' then
put "INFO: Pathname plus filename length exceeds 260. Under Windows family OS it may cause problems.";
length rc2msg $ 8192;
rc2 = filename("out", fileNameOutPath, "disk", "lrecl=1 recfm=n");
rc2msg = sysmsg();
rc3 = fcopy("in", "out");
length rc3msg $ 8192;
rc3 = fcopy("in", "out");
rc3msg = sysmsg();
loadingProblem + (rc3 & 1);
@@ -325,7 +336,7 @@ minoperator
if rc3 then
do;
put "ERROR: Cannot extract: " file;
put (rc1 rc2 rc3) (=);
put "ERROR-" (rc1 rc2 rc3) (=);
put (rc1msg rc2msg rc3msg) (/);
put "ERROR-";
end;

View File

@@ -11,7 +11,7 @@
*/
)/secure
/*** HELP END ***/
des = 'Macro to load multiple SAS packages at one run, version 20250729. Run %loadPackages() for help info.'
des = 'Macro to load multiple SAS packages at one run, version 20251221. Run %loadPackages() for help info.'
parmbuff
;
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
@@ -27,7 +27,7 @@ parmbuff
%put ### This is short help information for the `loadPackageS` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro wrapper for the loadPackage macro, version `20250729` #;
%put # Macro wrapper for the loadPackage macro, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;

View File

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

View File

@@ -0,0 +1,683 @@
/*+relocatePackage+*/
/*** HELP START ***/
%macro relocatePackage(
packageName /* list of packages (space-separated!) */
,source= /* place to take packages from (local location) */
,target= /* the "packages" fileref by default */
,sDevice=DISK /* also: ZIP, FILESRVC (SASFSVAM)*/
,tDevice=DISK /* also: ZIP, FILESRVC */
,checksum=0 /* if 1, copies data only if the source (from file) checksum is different than the target (to file) */
,move=0 /* packages are copied by default */
,try=3 /* integer between 1 and 9 */
,debug=0 /* debugging indicator */
,ignorePackagesFilerefCheck=0
)
/ des = 'Utility macro that locally Copies or Moves Packages, version 20251221. Run %relocatePackage() for help info.'
secure
minoperator
;
/*** HELP END ***/
%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 `relocatePackage` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro to *locally copy or move* (relocate) SAS packages, version `20251221` #;
%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(%%relocatePackage())` is a utility macro for local copying or moving #;
%put # SAS packages. The macro transfers packages located in the `PACKAGES` #;
%put # fileref to a selected directory (`DISK` device), folderpath (`FILESRVC` #;
%put # device), or a zip file (`ZIP` device). #;
%put # #;
%put # The macro allows for a bidirectional transfer of packages, i.e., from the #;
%put # `PACKAGES` fileref to the selected *target*, or from the selected *source* #;
%put # to the `PACKAGES` fileref. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put #### Parameters: #;
%put # #;
%put # 1. `packageName` *Required.* Name of a package, e.g. myPackage. #;
%put # A space-separated(!) list of packages to transfer is #;
%put # also accepted. If empty displays this help information. #;
%put # #;
%put # - `source=` *Required/Optional.* Source location for packages. #;
%put # When used, indicates a directory (`DISK` device), #;
%put # a folderpath (`FILESRVC` device), or a zip file (`ZIP` #;
%put # device) *from* where packages will be copied. #;
%put # In this case `PACKAGES` fileref is target location. #;
%put # Cannot be used together with `target=` parameter. #;
%put # #;
%put # - `target=` *Required/Optional.* Target location for packages. #;
%put # When used, indicates a directory (`DISK` device), #;
%put # a folderpath (`FILESRVC` device), or a zip file (`ZIP` #;
%put # device) *to* where packages will be copied. #;
%put # In this case `PACKAGES` fileref is source location. #;
%put # Cannot be used together with `source=` parameter. #;
%put # #;
%put # - `sDevice=` *Required/Optional.* When `source=` is used this #;
%put # parameter provides which type of device to be use. #;
%put # Default value is `DISK`, values `ZIP` and `FILESRVC` #;
%put # are allowed. For `FILESRVC` the `folderpath=` is used. #;
%put # #;
%put # - `tDevice=` *Required/Optional.* When `target=` is used this #;
%put # parameter provides which type of device to be use. #;
%put # Default value is `DISK`, values `ZIP` and `FILESRVC` #;
%put # are allowed. For `FILESRVC` the `folderpath=` is used. #;
%put # #;
%put # - `checksum=` *Optional.* Indicates if packages should be copied only #;
%put # if the source (from file) checksum is different than #;
%put # the target (to file). Default value is 0 (always copy). #;
%put # #;
%put # - `move=` *Optional.* Indicates if packages should be moved from #;
%put # source to target, default value is `0`, #;
%put # when set to `1`: after *successful* copying packages #;
%put # in the source are *deleted*. Use carefully! #;
%put # #;
%put # - `debug=` *Optional.* Indicates if debug notes should be printed, #;
%put # default value is `0`, when set to `1`: debug info #;
%put # is printed. #;
%put # #;
%put # - `try=` *Optional.* Number of tries when copy is unsuccessful, #;
%put # default value is `3`, allowed values are integers #;
%put # from 1 to 9. Time between tries is quarter of a second. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
%put # #;
%put ### Example 1 ###################################################################;
%put # #;
%put # Enabling the SAS Package Framework from the local #;
%put # directory, copying SQLinDS package from Viya Files #;
%put # service, and loading the package to the SAS session. #;
%put # #;
%put # Assume that the `SPFinit.sas` file is located in the "/home/user/PCKG" #;
%put # directory and Viya Files service location is "/files/packages/" #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( filename packages "/home/user/PCKG"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%relocatePackage%(SQLinDS %%* copy the package from Viya Files service; );
%put %nrstr( ,source=/files/packages/ );
%put %nrstr( ,sDevice=FILESRVC%) );
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put # #;
%put ### Example 2 ###################################################################;
%put # #;
%put # Enabling the SAS Package Framework from the local directory #;
%put # and creating a "bundle" file by moving 3 packages: the BasePlus, #;
%put # the SQLinDS, and the MacroArray package into the target file. #;
%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( %%relocatePackage%(BasePlus SQLinDS MacroArray %%* create a bundle of packages;);
%put %nrstr( ,target=D:/archive/bundle_2025_12_15.zip );
%put %nrstr( ,tDevice=ZIP, move=1%) );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put # #;
%put #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofrelocatePackage;
%end;
/* local variables for options */
%local ls_tmp ps_tmp notes_tmp source_tmp stimer_tmp fullstimer_tmp msglevel_tmp mautocomploc_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));
%let mautocomploc_tmp = %sysfunc(getoption(mautocomploc));
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
%if NOT(%superq(debug) in (0 1)) %then %let debug=0;
%if NOT(%superq(move) in (0 1)) %then %let move=0;
%if NOT(%superq(try) in (1 2 3 4 5 6 7 8 9)) %then %let try=3;
%if NOT(%superq(checksum) in (0 1)) %then %let checksum=0;
%if NOT(%superq(ignorePackagesFilerefCheck) in (0 1)) %then %let ignorePackagesFilerefCheck=0;
options nonotes msglevel=N;
%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 &checksum. AND NOT &HASHING_FILE_exist. %then
%do;
%put WARNING: Checksum verification impossible! Minimum SAS version required for the process is 9.4M6. ;
%end;
data _null_;
putlog 32*"*" 24*"=" 32*"*";
length packages source target $ 32767 sDevice tDevice $ 32;
packages = lowcase(compress(symget('packageName'),"_ ","KAD"));
if " " = packages then
do;
putlog "INFO: No packages to move or copy. Exiting.";
LINK stopProcessing;
end;
else putlog "INFO: List of packages: " packages;
debug = sum(symgetn('debug'),0);
/* grab macro variables values */
array mvar source target sDevice tDevice;
do over mvar;
mvar=symget(vname(mvar));
end;
if source NE ' ' AND target NE " " then
do;
putlog "WARNING: The SOURCE= and the TARGET= parameters cannot be used simultaneously. Exiting!";
LINK stopProcessing;
end;
if source EQ ' ' AND target EQ " " then
do;
putlog "INFO: The SOURCE= and the TARGET= parameters were not used, nothing to do. Exiting!";
LINK stopProcessing;
end;
/* verify that PACKAGES is valid location for source or target */
/*=========================================================================================================*/
%if 0 = &ignorePackagesFilerefCheck. %then
%do;
if NOT (input(resolve('%isPackagesFilerefOK(&debug.)'), best.)=1) then /* if debug=1 the isPackagesFilerefOK in verbose mode */
do;
putlog "WARNING: The PACKAGES fileres is not OK! Exiting!";
LINK stopProcessing;
end;
%end;
/*=========================================================================================================*/
/* prepare source and target */
/*=========================================================================================================*/
%local i ST_list st stDev stFr stH stI stEx stAsg leave;
%let ST_list=target source; /* repeat the same structure twice with different prefix */
%do i=1 %to 2;
%let st=%scan(&ST_list., &i.);
%let stDev=%substr(&st.,1,1)Device;
%let stFr =%substr(&st.,1,1)FileRef;
%let stH =%substr(&st.,1,1)Hash;
%let stI =%substr(&st.,1,1)Iter;
%let stEx =%substr(&st.,1,1)Exists;
%let stAsg=%substr(&st.,1,1)Assigned;
%let stFp =%substr(&st.,1,1)FromPackages;
retain &stFp. 0 move 0;
move = sum(symgetn('move'),0);
/* validate source and target */
&stDev. = upcase(compress(&stDev.,"_","KAD"));
if NOT (&stDev. in ("DISK" "BASE" "ZIP" "FILESRVC" "SASFSVAM")) then
do;
putlog "WARNING: The &stDev. parameter value: " &stDev. "is not allowed."
/ "WARNING- Only: DISK, ZIP, and FILESRVC devices are supported as &st. device. Exiting!";
LINK stopProcessing;
end;
if &st.=" " then
do;
if 0 then set SASHELP.VEXTFL;
DECLARE HASH &stH.(dataset:'SASHELP.VEXTFL(where=(fileref="PACKAGES"))', ordered: "A");
&stH..DefineKey("level");
&stH..DefineData("xpath","xengine");
&stH..DefineDone();
DECLARE HITER &stI.("&stH.");
if &stH..NUM_ITEMS=0 then
do;
putlog "INFO: Packages fileref not found. Using WORK instead.";
level = 0;
xpath = pathname("WORK","L");
xengine = 'DISK';
&stI..REPLACE();
end;
&stI..FIRST();
&st. = strip(xpath); /* get the first packages path */
&stDev. = strip(xengine);
/* Just to make it easier to debug since FILESRVC will show up in Google */
if &stDev. = 'SASFSVAM' then _stDev_ = 'FILESRVC';
else _stDev_ = strip(xengine);
putlog "INFO: The &st. location is: " / @7 _stDev_ +(-1) ": " &st.;
%if &st.=source %then
%do;
do while(&stI..next()=0);
if xengine = 'SASFSVAM' then _engine_ = 'FILESRVC';
else _engine_ = xengine;
putlog @7 _engine_ +(-1) ": " xpath;
end;
%end;
&stFp. = 1;
end;
else
do;
length &stFr. $ 8;
if " "=getoption("SERVICESBASEURL") AND (&stDev. in ("FILESRVC" "SASFSVAM")) then
do;
putlog "WARNING: The SERVICESBASEURL option must be specified for the FILESRVC device. Exiting!";
LINK stopProcessing;
end;
length &stAsg.Txt &stEx.Txt $ 256;
if (&stDev. in ("FILESRVC" "SASFSVAM")) then
&stAsg. = filename(&stFr., ,strip(&stDev.), "recfm=n lrecl=1 " !! "folderpath=" !! quote(strip(&st.))); /* assign FILESRVC */
else
&stAsg. = filename(&stFr.,strip(&st.), strip(&stDev.), "recfm=n lrecl=1"); /* assign DISK or ZIP*/
&stAsg.Txt = sysmsg();
&stEx. = FEXIST(&stFr.);
&stEx.Txt = sysmsg();
if debug then putlog (&stFr. &st. &stDev. &stAsg. &stAsg.Txt &stEx. &stEx.Txt) (=/);
_rc_ = filename(&stFr.); /*clear*/
end;
%end;
/*=========================================================================================================*/
if source=target and sDevice=tDevice then
do;
putlog / "INFO: Nothing to move or copy. Exiting.";
LINK stopProcessing;
end;
if move then
do;
putlog / "INFO: Files will be moved, i.e., after successful copying to the target location"
/ " the source will be deleted.";
end;
/* 4096 for host options for Viya FS */
length sHostoptions tHostOptions $ 4096 tFilename sFilename $ 2048;
do i = 1 to countw(packages, " ");
package = scan(packages, i, " ");
putlog 32*"*" package $24.-C 32*"*";
select;
/* copy from PACKAGES to some location */
/*=========================================================================================================*/
when(1=sFromPackages AND 0=tFromPackages AND 0=tAssigned)
do;
select;
/* disk */
when (tDevice in ("DISK" "BASE"))
do;
if NOT tExists then GOTO stopForThisPackage1;
tAssigned = filename(tFileRef
,cats(target, "/", package, ".zip")
,strip(tDevice)
,"recfm=n lrecl=1");
end;
/* zip */
when (tDevice in ("ZIP"))
do;
if tExists then putlog "INFO: Overwriting member: " package +(-1) ".zip inside: " target;
tAssigned = filename(tFileRef
,cats(target)
,strip(tDevice)
,"recfm=n lrecl=1 member=" !! quote(cats(package, ".zip")) );
end;
/* filesrvc */
when (tDevice in ("FILESRVC" "SASFSVAM"))
do;
tAssigned = filename(tFileRef
,/*blank*/ ,strip(tDevice)
,"recfm=n lrecl=1"
!! " folderpath=" !! quote(cats(target))
!! " filename=" !! quote(cats(package, ".zip"))
);
end;
/* other */
otherwise
do;
putlog "ERROR: Unsupported device: " tDevice +(-1) ". Exiting!";
GOTO stopForThisPackage1;
end;
end;
if debug then putlog tAssigned= tFileRef= / tDevice=;
_rc_ = sIter.first();
_rc_ = sIter.prev();
do while(sIter.next()=0);
/* If Viya File Service, we need to use:
filename('fileref', ,'FILEFSVAM', "<host options>") */
if xengine = 'SASFSVAM' then do;
sFilename = ' ';
sHostOptions = "recfm=n lrecl=1"
!! " folderpath=" !! quote(strip(xpath))
!! " filename=" !! quote(cats(package, ".zip"))
;
end;
else do;
sFilename = cats(strip(xpath), "/", package, ".zip");
sHostOptions = "recfm=n lrecl=1";
end;
sAssigned = filename(sFileref
,sFilename
,xengine
,sHostOptions);
if debug then putlog sAssigned= sFileRef= / xengine=;
leave=0;
LINK LoopTryCopyFile; /* LINK 1 */
if leave then leave;
end;
sAssigned = filename(sFileRef);
tAssigned = filename(tFileRef);
stopForThisPackage1:
if 0=leave then putlog "ERROR: Fail to process " package;
end;
/*=========================================================================================================*/
/* copy from some location to PACKAGES */
/*=========================================================================================================*/
when(0=sFromPackages AND 1=tFromPackages AND 0=sAssigned)
do;
select;
/* disk */
when (sDevice in ("DISK" "BASE"))
do;
if NOT sExists then GOTO stopForThisPackage2;
sAssigned = filename(sFileRef
,cats(source, "/", package, ".zip")
,strip(sDevice)
,"recfm=n lrecl=1");
end;
/* zip */
when (sDevice in ("ZIP"))
do;
sAssigned = filename(sFileRef
,cats(source)
,strip(sDevice)
,"recfm=n lrecl=1 member=" !! quote(cats(package, ".zip")) );
end;
/* filesrvc */
when (sDevice in ("FILESRVC" "SASFSVAM"))
do;
sAssigned = filename(sFileRef
,/*blank*/ ,strip(sDevice)
,"recfm=n lrecl=1"
!! " folderpath=" !! quote(cats(source))
!! " filename=" !! quote(cats(package, ".zip"))
);
end;
/* other */
otherwise
do;
putlog "ERROR: Unsupported device: " sDevice +(-1) ". Exiting!";
GOTO stopForThisPackage2;
end;
end;
if debug then putlog sAssigned= sFileRef= / sDevice=;
if NOT fexist(sFileRef) then
do;
putlog "WARNING: File: " package +(-1) ".zip does NOT exist inside: " source;
end;
else
do;
_rc_ = tIter.first();
_rc_ = tIter.prev();
do while(tIter.next()=0);
/* If Viya File Service, we need to use:
filename('fileref', ,'FILEFSVAM', "<host options>") */
if xengine = 'SASFSVAM' then do;
tFilename = ' ';
tHostOptions = "recfm=n lrecl=1"
!! " folderpath=" !! quote(strip(xpath))
!! " filename=" !! quote(cats(package, ".zip"))
;
end;
else do;
tFilename = cats(strip(xpath), "/", package, ".zip");
tHostOptions = "recfm=n lrecl=1";
end;
tAssigned = filename(tFileRef
,tFilename
,xengine
,tHostOptions);
if debug then putlog tAssigned= tFileRef= / xengine=;
leave=0;
LINK LoopTryCopyFile; /* LINK 1 */
if leave then leave;
end;
tAssigned = filename(tFileRef);
end;
sAssigned = filename(sFileRef);
stopForThisPackage2:
if 0=leave then putlog "ERROR: Fail to process " package;
end;
/*=========================================================================================================*/
/**
when(0) do; put "future cases"; end;
**/
otherwise putlog "WARNING: Unknown combination.";
end;
end;
LINK stopProcessing;
/** the end **/
STOP;
/* LINK 1 */
loopTryCopyFile:
do try = 1 to &try. while(leave=0);
length s_HASHING t_HASHING $ 128;
%if &checksum. AND &HASHING_FILE_exist. %then
%do;
if try = 1 AND fexist(tFileRef) then /* check SHA256 only for first try */
do;
LINK GETSHA256DIGEST; /* LINK 2 */
if s_HASHING=t_HASHING then
do;
putlog "INFO: The SHA256 hash digest for source and target are identical."
/ @7 "Checksum: " t_HASHING
/ @7 "Package will not be copied.";
_rc_ = 0;
end;
else
do; /* message only for the first time */
putlog "INFO: The SHA256 hash digest for source and target are different."
/ @7 "Target checksum: " t_HASHING
/ @7 "Source checksum: " s_HASHING
/ @7 "Copying package.";
_rc_ = fcopy(sFileRef, tFileRef);
_rcTxt_ = sysmsg();
end;
end;
else /* keep this ELSE unclosed for... */
%end;
do; /* ... this DO-END block */
_rc_ = fcopy(sFileRef, tFileRef);
_rcTxt_ = sysmsg();
end;
if debug then putlog _rc_= / _rcTxt_=;
leave + (_rc_=0)*fexist(tFileRef);
%if &HASHING_FILE_exist. = 1 %then
%do;
if leave then /* compare SHA256 after copy */
do;
LINK GETSHA256DIGEST; /* LINK 2 */
if NOT (s_HASHING=t_HASHING) then
putlog "WARNING: The SHA256 hash digest is different for source and target!"
/ "WARNING- Source is: " s_HASHING
/ "WARNING- Target is: " t_HASHING
/ "WARNING- There could be errors during copying. Check your files.";
end;
%end;
if (leave AND move) then
do;
_rc_ = fdelete(sFileRef);
if _rc_ then putlog "WARNING: Target successfully copied, but cannot delete source file while moving.";
end;
if not leave then _rc_ = sleep(1,0.25);
end;
return;
/* LINK 2 */
GETSHA256DIGEST:
%let ST_list=t s; /* for source(s) and for target(t), repeat the same structure twice with different prefix */
%do i=1 %to 2;
%let st=%scan(&ST_list., &i.);
select;
when (&st.Device in ("ZIP")) &st._HASHING=HASHING_FILE("SHA256", &st.FileRef, 4);
when (&st.Device in ("DISK" "BASE")) &st._HASHING=HASHING_FILE("SHA256", pathname(&st.FileRef,'F'), 0);
otherwise /* for FILESRVC and SASFSVAM*/
do;
&st._sha256 = hashing_init("SHA256");
&st._FID = fopen(&st.FileRef, "i", 1, "B"); /* read only in binary format */
if &st._FID then do while(fread(&st._FID)=0);
length &st.c $ 1;
_rc_ = fget(&st._FID, &st.c, 1);
_rc_ = hashing_part(&st._sha256, &st.c);
end;
&st._FID = fclose(&st._FID);
&st._HASHING = hashing_term(&st._sha256);
end;
end;
%end;
return;
/* LINK 3 */
stopProcessing:
putlog 32*"*" 24*"=" 32*"*";
stop;
return;
run;
/* restore optionos */
options ls = &ls_tmp. ps = &ps_tmp.
&notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp. &mautocomploc_tmp.;
%ENDofrelocatePackage:
%mend relocatePackage;
/* tests on Viya:
filename PACKAGES list;
%let user= <...>;
filename backup filesrvc
folderpath="/Users/&user./My Folder/SASPACKAGES";
filename backup list;
%put %sysfunc(pathname(backup));
data _null_;
x=getoption("SERVICESBASEURL");
put x=;
run;
options ls = 90;
%* move from PACKAGES to a FILESRVC location*;
%relocatePackage(baseplus SQLinDS macroarray
,target=/Users/&user./My Folder/SASPACKAGES
,tDevice=FILESRVC
,move=1)
%* move back to PACKAGES from a FILESRVC location*;
%relocatePackage(baseplus SQLinDS macroarray
,source=/Users/&user./My Folder/SASPACKAGES
,sDevice=FILESRVC
,move=1)
%* create a ZIP bundle with packages in HOME *;
%relocatePackage(baseplus SQLinDS macroarray
,target=~/SASPACKAGESbundle.zip
,tDevice=ZIP)
*/
/* SERVICESBASEURL */
/* Tests on SAS:
options mprint msglevel=N;
filename PACKAGES ("R:\" "C:\SAS_WORK\SAS_PACKAGES");
%relocatePackage(myPackage)
options nomprint msglevel=N;
%relocatePackage(baseplus SQLinDS macroarray, target=R:\abc, debug=1)
%relocatePackage(baseplus SQLinDS macroarray, target=R:\noDir)
%relocatePackage(baseplus SQLinDS macroarray, target=R:\bundle.zip, tDevice=zip)
%relocatePackage(baseplus SQLinDS macroarray, target=R:\, tDevice=FILESRVC)
filename PACKAGES ("R:\testPackages1_NOT_EXIST" "R:\testPackages2_NOT_EXIST");
%relocatePackage(baseplus SQLinDS macroarray abc, source=R:\abc, debug=1, move=1)
filename PACKAGES ("R:\testPackages1" "R:\testPackages2");
%relocatePackage(baseplus SQLinDS macroarray abc, source=R:\abc, debug=1, move=1)
%relocatePackage(baseplus SQLinDS macroarray, source=R:\noDir, debug=1)
filename PACKAGES ("R:\testPackages2" "R:\testPackages1");
%relocatePackage(baseplus SQLinDS macroarray, source=R:\bundle.zip, sDevice=zip, move=1)
%relocatePackage(baseplus SQLinDS macroarray, source=R:\, sDevice=FILESRVC)
%relocatePackage(baseplus SQLinDS macroarray, source=R:\bundle.zip, sDevice=zip, target=R:\bundle)
*/
/*%macro _();%mend _;*/
/**/

View File

@@ -0,0 +1,165 @@
/*+SasPackagesFrameworkNotes+*/
%macro SasPackagesFrameworkNotes(
SPFmacroName /* space separated list of names */
)
/
minoperator
secure
des = 'Macro to provide help notes about SAS Packages Framework macros, version 20251221. Run %SasPackagesFrameworkNotes(HELP) for help info.'
;
%local list N i element;
%let list=
installPackage
listPackages
/**/
verifyPackage
previewPackage
helpPackage
/**/
loadPackage
loadPackageS
loadPackageAddCnt
/**/
unloadPackage
/**/
generatePackage
splitCodeForPackage
/**/
extendPackagesFileref
relocatePackage
isPackagesFilerefOK
/**/
SasPackagesFrameworkNotes
;
%let N = %sysfunc(countw(&list.));
%let SPFmacroName = %sysfunc(compress(%superq(SPFmacroName),_ *,KAD));
%if (%qupcase(&SPFmacroName.) = 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))
%sysfunc(getoption(mprint)) %sysfunc(getoption(mlogic)) %sysfunc(getoption(symbolgen))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N NOmprint NOmlogic NOsymbolgen;
%put ;
%put #################################################################################;
%put ### This is short help information for the `SasPackagesFrameworkNotes` macro #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Macro prints help notes for SAS Packages Framework macros, version `20251221` #;
%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(%%SasPackagesFrameworkNotes())` macro provides help notes about #;
%put # components of the SAS Packages Framework. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put #### Parameters: #;
%put # #;
%put # 1. `SPFmacroName` *Required.* Names of a SPF components. #;
%put # Names should be space separated, asterisk(*) is #;
%put # allowed too. In such case ALL help notes are printed #;
%put # If equal `HELP` displays this help information. #;
%put # If empty displays list of SPF macros. #;
%put # #;
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
%put # to learn more. #;
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
%put # #;
%put ### Example 1 ###################################################################;
%put # #;
%put # Run the following code to print all SPF help notes: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( %%SasPackagesFrameworkNotes(*) %%* print ALL notes; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put # #;
%put ### Example 2 ###################################################################;
%put # #;
%put # Run the following code to list all SPF macros: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( %%SasPackagesFrameworkNotes() %%* list all macro names; );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put # #;
%put ### Example 3 ###################################################################;
%put # #;
%put # Run the following code to print help notes: #;
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
%put %nrstr( %%SasPackagesFrameworkNotes(generatePackage helpPackage) );
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
%put # #;
%put #################################################################################;
%put ;
options &options_tmp.;
%GOTO ENDofSPFNotes;
%end;
%if %sysevalf(%superq(SPFmacroName)=,boolean) %then
%do;
%put ================================================================;
%put %str( ) SAS Packages Framework provides the following macros:;
%put ================================================================;
%do i = 1 %to &N.;
%let element = %scan(&list., &i.);
%if &i. IN (3 6 9 10 12) %then %put %str( );
%if &i. > 9 %then %put %str( )&i.. %NRSTR(%%)&element.();
%else %put %str( )&i.. %NRSTR(%%)&element.();
%end;
%put =================================================================;
%end;
%else %if %str(*) IN (%superq(SPFmacroName)) %then
%do;
%do i = 1 %to &N.;
%let element = %scan(&list., &i.);
%put %str( );
%put ======;
%&element.(HELP)
%put ======;
%end;
%end;
%else
%do;
%let N = %sysfunc(countw(%superq(SPFmacroName)));
%do i = 1 %to &N.;
%let element = %qupcase(%scan(%superq(SPFmacroName), &i.));
%if %superq(element) in (%upcase(&LIST.)) %then
%do;
%let element = %unquote(&element.);
%put %str( );
%put ======;
%&element.(HELP);
%put ======;
%end;
%else
%do;
%put %str( );
%put ***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***;
%put WARNING: Cannot recognise name: %superq(element).;
%put WARNING- Valid values are: %superq(list);
%put ***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***;
%end;
%end;
%end;
%ENDofSPFNotes:
%mend SasPackagesFrameworkNotes;
/*
%SasPackagesFrameworkNotes()
%SasPackagesFrameworkNotes(HELP)
options mlogic symbolgen;
%SasPackagesFrameworkNotes(generatePackage)
%SasPackagesFrameworkNotes(generatePackage helpPackage)
%SasPackagesFrameworkNotes(generatePackage helpPackages SasPackagesFrameworkNotes isPackagesFilerefOK)
%SasPackagesFrameworkNotes(*)
*/
/* end of SPFinit.sas file */

View File

@@ -7,10 +7,9 @@
,debug=0 /* technical parameter */
,nobs=0 /* technical parameter */
)
/*** HELP START ***/
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20250729. Run %splitCodeForPackage() for help info.'
/*** HELP END ***/
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20251221. Run %splitCodeForPackage() for help info.'
;
/*%macro _();%mend _;*/
%if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then
%do;
%local options_tmp ;
@@ -25,7 +24,7 @@
%put #-------------------------------------------------------------------------------#;
%put # #;
%put # Utility macro to *split* single file with SAS package code into multiple #;
%put # files with separate snippets, version `20250729` #;
%put # files with separate snippets, version `20251221` #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
@@ -49,7 +48,7 @@
%put # #;
%put # - `packagePath=` *Required.* Location for package files after #;
%put # splitting into separate files and directories. #;
%put # If missing or not exist then `WORK` is uded. #;
%put # If missing or not exist then `WORK` is used. #;
%put # #;
%put # - `debug=` *Optional.* Turns on code printing for debugging. #;
%put # #;
@@ -107,7 +106,6 @@
%GOTO ENDofsplitCodeForPackage;
%end;
%local options_tmp2 ;
%let options_tmp2 = ls=%sysfunc(getoption(ls)) ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
@@ -173,7 +171,6 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ;
call symputX('packagePath',packagePath,"L");
run;
data w.files;
stop;
run;
@@ -199,7 +196,7 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ;
line = left(lowcase(_infile_));
block=scan(line,1," ");
if block in (
if block in (
'/*##$##-code-block-start-##$##'
'/*##$##-code-block-end-##$##'
);
@@ -403,7 +400,7 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ;
*/
if firstLine[j] then
do;
put '/* File generated with help of SAS Packages Framework, version 20250729. */';
put '/* File generated with help of SAS Packages Framework, version 20251221. */';
firstLine[j]=0;
end;
put _infile_;
@@ -419,5 +416,3 @@ options &options_tmp2.;
%ENDofsplitCodeForPackage:
%mend splitCodeForPackage;
/**/

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
---
# SAS Packages Framework, version `20250729`
# SAS Packages Framework, version `20251221`
---
@@ -18,6 +18,9 @@
* [the `extendPackagesFileref` macro](#extendpackagesfileref)
* [the `loadPackageAddCnt` macro](#loadpackageaddcnt)
* [the `splitCodeForPackage` macro](#splitcodeforpackage)
* [the `relocatePackage` macro](#relocatepackage)
* [the `isPackagesFilerefOK` macro](#ispackagesfilerefok)
* [the `SasPackagesFrameworkNotes` macro](#saspackagesframeworknotes)
* [Some more examples](#some-more-examples)
--------------------------------------------------------------------------------------------
@@ -25,13 +28,13 @@
## This is short SAS Packages Framework help information <a name="helpinfo"></a>
A **SAS package** is an automatically generated, single, stand alone *zip* file containing organised and ordered code structures, created by the developer and extended with additional automatically generated "driving" files (i.e. description, metadata, load, unload, and help files).
A **SAS package** is an automatically generated, single, stand alone *zip* file containing organized and ordered code structures, created by the developer and extended with additional automatically generated "driving" files (i.e. description, metadata, load, unload, and help files).
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 **`20250729`**.
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20251221`**.
**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).
**To get started with SAS Packages** try this [**`Introduction to SAS Packages`**](https://youtube.com/playlist?list=PLeMzGEImIT5eV13IGXQIgWmTFCJt_cLZG&si=ElQm0_ifq76mvUbq "Introduction to SAS Packages video series") video series or [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
**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).
@@ -52,7 +55,7 @@ them using the SPF can be found [**HERE**](https://github.com/yabwon/HoW-SASPack
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
--------------------------------------------------------------------------------------------
Macro to install SAS packages, version `20250729`
Macro to install SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -180,7 +183,7 @@ filename packages "C:/SAS_PACKAGES";
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
-------------------------------------------------------------------------------
Macro to get help about SAS packages, version `20250729`
Macro to get help about SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -258,7 +261,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 `20250729`
Macro to *load* SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -416,7 +419,7 @@ If created, those macros are automatically deleted when the `%unloadPackage()` m
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
-------------------------------------------------------------------------------
Macro wrapper for the loadPackage macro, version `20250729`
Macro wrapper for the loadPackage macro, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -459,7 +462,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%installPackage(SQLinDS DFA) %* install packages from the Internet;
%loadPackageS(SQLinDS, DFA) %* load packags content into the SAS session;
%loadPackageS(SQLinDS, DFA) %* load packages content into the SAS session;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -467,7 +470,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 `20250729`
Macro to unload SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -534,14 +537,14 @@ 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 `20250729`
Macro to list available SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and embedded inside the zip.
The `%listPackages()` macro lists packages available
in the packages folder. List is printed inthe SAS Log.
in the packages folder. List is printed in the SAS Log.
### Parameters:
@@ -577,7 +580,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 `20250729`
Macro to verify SAS package with it hash digest, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -631,7 +634,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 preview of a SAS packages, version `20250729`
Macro to get preview of a SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -700,7 +703,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 `20250729`
Macro to generate SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -718,49 +721,61 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
### Parameters:
1. `filesLocation=` Location of package files, example value:
`%sysfunc(pathname(work))/packagename`.
Default use case:
`%generatePackage(filesLocation=/path/to/packagename)`
If empty displays this help information.
1. `filesLocation=` Location of package files, example value:
`%sysfunc(pathname(work))/packagename`.
Default use case:
`%generatePackage(filesLocation=/path/to/packagename)`
If empty displays this help information.
Testing parameters:
- `testPackage=` Indicator if tests should be executed.
Default value: `Y`, means "execute tests"
- `testPackage=` Indicator if tests should be executed.
Default value: `Y`, means "execute tests"
- `packages=` Location of other packages for testing
if there are dependencies in loading the package.
Has to be a single directory, if more than one are
provided than only the first is used.
If path to location contains spaces it should be quoted!
- `packages=` Location of other packages for testing
if there are dependencies in loading the package.
Has to be a single directory, if more than one are
provided than only the first is used.
If path to location contains spaces it should be quoted!
- `testResults=` Location where tests results should be stored,
if null (the default) then the session WORK is used.
- `testResults=` Location where tests results should be stored,
if null (the default) then the session WORK is used.
- `sasexe=` Location of a DIRECTORY where the SAS binary is located,
if null (the default) then the `!SASROOT` is used.
- `workInTestResults=` Indicates if WORK directories for test sessions should
be located in the same place as results.
The default value: `0` means "do not do this".
Available values are `0` and `1`.
- `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.
- `testWorkPath=` Points a location where tests sessions work directories
should be stored. By default it is null what means that
a sub-directory of the main SAS session WORK is used.
Takes precedence over `workInTestResults=`.
- `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`.
- `sasexe=` Location of a DIRECTORY where the SAS binary is located,
if null (the default) then the `!SASROOT` is used.
- `markdownDoc=` Indicates if a markdown file with documentation
be generated from help information blocks.
The default value: `0` means "do not generate the file".
Available values are `0` and `1`.
- `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.
- `easyArch=` When creating documentation file (`markdownDoc=1`)
indicates if a copy of the zip and markdown files
with the version number in the file name be created
The default value: `0` means "do not create files".
Available values are `0` and `1`.
- `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`.
Documentation parameters:
- `markdownDoc=` Indicates if a markdown file with documentation
be generated from help information blocks.
The default value: `0` means "do not generate the file".
Available values are `0` and `1`.
- `easyArch=` When creating documentation file (`markdownDoc=1`)
indicates if a copy of the zip and markdown files
with the version number in the file name be created
The default value: `0` means "do not create files".
Available values are `0` and `1`.
-------------------------------------------------------------------------------
@@ -915,14 +930,14 @@ 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 `20250729`
Macro to list directories pointed by 'packages' fileref, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and embedded inside the zip.
The `%extendPackagesFileref()` macro lists directories pointed by
the packages fileref. It allows to add new dierctories to packages folder list.
the packages fileref. It allows to add new directories to packages folder list.
### Parameters:
@@ -957,7 +972,7 @@ filename packages ("D:/NEW_DIR" %extendPackagesFileref()); %* add new directory;
## This is short help information for the `loadPackageAddCnt` macro <a name="loadpackageaddcnt"></a>
-------------------------------------------------------------------------------
Macro to load *additional content* for a SAS package, version `20250729`
Macro to load *additional content* for a SAS package, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -1051,7 +1066,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
-------------------------------------------------------------------------------
Utility macro to *split* single file with SAS package code into multiple
files with separate snippets, version `20250729`
files with separate snippets, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
@@ -1075,7 +1090,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
- `packagePath=` *Required.* Location for package files after
splitting into separate files and directories.
If missing or not exist then `WORK` is uded.
If missing or not exist then `WORK` is used.
- `debug=` *Optional.* Turns on code printing for debugging.
@@ -1129,6 +1144,220 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
,packagePath=C:/split/ )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## This is short help information for the `relocatePackage` macro <a name="relocatepackage"></a>
-------------------------------------------------------------------------------
Macro to *locally copy or move* (relocate) SAS packages, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and included by
a single `load.sas` file (also embedded inside the zip).
The `%relocatePackage()` is a utility macro for local copying or moving
SAS packages. The macro transfers packages located in the `PACKAGES`
fileref to a selected directory (`DISK` device), folderpath (`FILESRVC`
device), or a zip file (`ZIP` device).
The macro allows for a bidirectional transfer of packages, i.e., from the
`PACKAGES` fileref to the selected *target*, or from the selected *source*
to the `PACKAGES` fileref.
-------------------------------------------------------------------------------
### Parameters:
1. `packageName` *Required.* Name of a package, e.g. myPackage.
A space-separated(!) list of packages to transfer is
also accepted. If empty displays this help information.
- `source=` *Required/Optional.* Source location for packages.
When used, indicates a directory (`DISK` device),
a folderpath (`FILESRVC` device), or a zip file (`ZIP`
device) *from* where packages will be copied.
In this case `PACKAGES` fileref is target location.
Cannot be used together with `target=` parameter.
- `target=` *Required/Optional.* Target location for packages.
When used, indicates a directory (`DISK` device),
a folderpath (`FILESRVC` device), or a zip file (`ZIP`
device) *to* where packages will be copied.
In this case `PACKAGES` fileref is source location.
Cannot be used together with `source=` parameter.
- `sDevice=` *Required/Optional.* When `source=` is used this
parameter provides which type of device to be use.
Default value is `DISK`, values `ZIP` and `FILESRVC`
are allowed. For `FILESRVC` the `folderpath=` is used.
- `tDevice=` *Required/Optional.* When `target=` is used this
parameter provides which type of device to be use.
Default value is `DISK`, values `ZIP` and `FILESRVC`
are allowed. For `FILESRVC` the `folderpath=` is used.
- `checksum=` *Optional.* Indicates if packages should be copied only
if the source (from file) checksum is different than
the target (to file). Default value is 0 (always copy).
- `move=` *Optional.* Indicates if packages should be moved from
source to target, default value is `0`,
when set to `1`: after *successful* copying packages
in the source are *deleted*. Use carefully!
- `debug=` *Optional.* Indicates if debug notes should be printed,
default value is `0`, when set to `1`: debug info
is printed.
- `try=` *Optional.* Number of tries when copy is unsuccessful,
default value is `3`, allowed values are integers
from 1 to 9. Time between tries is quarter of a second.
-------------------------------------------------------------------------------
Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation`
to learn more.
Tutorials available at: `https://github.com/yabwon/HoW-SASPackages`
### Example 1 ##################################################################
Enabling the SAS Package Framework from the local
directory, copying SQLinDS package from Viya Files
service, and loading the package to the SAS session.
Assume that the `SPFinit.sas` file is located in the "/home/user/PCKG"
directory and Viya Files service location is "/files/packages/"
Run the following code in your SAS session:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
filename packages "/home/user/PCKG"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%relocatePackage(SQLinDS %* copy the package from Viya Files service;
,source=/files/packages/
,sDevice=FILESRVC)
%loadPackage(SQLinDS) %* load the package content into the SAS session;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example 2 ##################################################################
Enabling the SAS Package Framework from the local directory
and creating a "bundle" file by moving 3 packages: the BasePlus,
the SQLinDS, and the MacroArray package into the target file.
Assume that the `SPFinit.sas` file
is located in the "C:/SAS_PACKAGES/" folder.
Run the following code in your SAS session:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
%include packages(SPFinit.sas); %* enable the framework;
%relocatePackage(BasePlus SQLinDS MacroArray %* create a bundle of packages;
,target=D:/archive/bundle_2025_12_15.zip
,tDevice=ZIP, move=1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## This is short help information for the `isPackagesFilerefOK` macro <a name="ispackagesfilerefok"></a>
-----------------------------------------------------------------------------------------
Macro to check if the `packages` fileref is "correct", version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and embedded inside the zip.
The `%isPackagesFilerefOK()` macro checks if the `packages` fileref
is correct, i.e. all listed directories exist, are accessible (can be open), and
are assigned with the DISK device.
The Macro works as a macro function. It returns `1` when everything is OK, and
it returns `0` if at least one issue exists.
### Parameters:
1. `vERRb` - *Optional* Indicates if the macro should return value AND be verbose
(e.g., print errors and notes) or just return value.
When used as: `%isPackagesFilerefOK(HELP)` it displays this help information.
-----------------------------------------------------------------------------------------
Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation`
to learn more.
Tutorials available at: `https://github.com/yabwon/HoW-SASPackages`
### Example #############################################################################
Enabling the SAS Package Framework from the local
directory, expanding PACKAGES fileref, and checking
if the new one is still correct for installing new package.
Assume that the `SPFinit.sas` file
is located in the "/sas/PACKAGES/" directory.
Run the following code in your SAS session:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
filename packages "/sas/PACKAGES"; %* set packages filename;
%include packages(SPFinit.sas); %* enable the framework;
filename packages ("~/myPCKGs" %extendPackagesFileref()); %* add new directory;
%if %IsPackagesFilerefOK() %then %* check fileref;
%do; %InstallPackage(SQLinDS) %end; %* install SQLinDS;
%listPackages() %* list packages;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## This is short help information for the `SasPackagesFrameworkNotes` macro <a name="saspackagesframeworknotes"></a>
-------------------------------------------------------------------------------
Macro prints help notes for SAS Packages Framework macros, version `20251221`
A SAS package is a zip file containing a group
of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and included by
a single `load.sas` file (also embedded inside the zip).
The `%SasPackagesFrameworkNotes()` macro provides help notes about
components of the SAS Packages Framework.
-------------------------------------------------------------------------------
### Parameters:
1. `SPFmacroName` *Required.* Names of a SPF components.
Names should be space separated, asterisk(*) is
allowed too. In such case ALL help notes are printed
If equal `HELP` displays this help information.
If empty displays list of SPF macros.
-------------------------------------------------------------------------------
Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation`
to learn more.
Tutorials available at: `https://github.com/yabwon/HoW-SASPackages`
### Example 1 ##################################################################
Run the following code to print all SPF help notes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%SasPackagesFrameworkNotes(*) %* print ALL notes;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example 2 ##################################################################
Run the following code to list all SPF macros:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%SasPackagesFrameworkNotes() %* list all macro names;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example 3 ##################################################################
Run the following code to print help notes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%SasPackagesFrameworkNotes(generatePackage helpPackage)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

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

@@ -10,7 +10,7 @@ Packages:
---
- **SQLinDS**\[2.3.0\], based on Mike Rhoads' article *Use the Full Power of SAS in Your Function-Style Macros*. The package allows to write SQL queries in the data step, e.g.
- **SQLinDS**\[2.3.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(
@@ -22,7 +22,7 @@ data class;
WH = weight + height;
run;
```
SHA256 digest for SQLinDS: F*3C010734B76CA7459C4D35087C899121011CD4AA2932B56335FF11A805C8EF8D
SHA256 digest for SQLinDS: F*606A24A2A6B06DAAD2D443FA9A9819D9564235A5CD8599FD15586F1EFFCB41BC
[Documentation for SQLinDS](https://github.com/SASPAC/blob/main/sqlinds.md "Documentation for SQLinDS")
@@ -86,7 +86,7 @@ SHA256 digest for macroArray: F*3F3893F1FCD78719543703E4353F4CC19811D247C016F220
---
- **BasePlus**\[2.1.0\] adds a bunch of functionalities I am missing in BASE SAS, such as:
- **BasePlus**\[3.1.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
```sas
call arrMissToRight(myArray);
call arrFillMiss(17, myArray);
@@ -117,8 +117,10 @@ format x bool.;
%put %monthShift(2023,1,-5);
%put #%expandDataSetsList(lib=sashelp,datasets=_all_)#;
%workLib(ABC)
```
SHA256 digest for BasePlus: F*DFA83F8E0D7424DEB63D49620392068BC68D766552E2804CB6B01DE8E5A87769
SHA256 digest for BasePlus: F*6394CE27FBCF48D475F682CBCF8CA8B4FDD6D40D2672EF571F4A561BDDF274A6
[Documentation for BasePlus](https://github.com/SASPAC/blob/main/baseplus.md "Documentation for BasePlus")

View File

@@ -1,3 +1,27 @@
/* 20251122 */
SQLinDS: F*606A24A2A6B06DAAD2D443FA9A9819D9564235A5CD8599FD15586F1EFFCB41BC
/* 20251105 */
BasePlus: F*6394CE27FBCF48D475F682CBCF8CA8B4FDD6D40D2672EF571F4A561BDDF274A6
/* 20251020 */
BasePlus: F*9FFBC40A2B7FC51161C7D6D120DADC3ACEF8087E4EB43BB1A3F0FBC1F1CBD5AC
/* 20251015 */
BasePlus: F*B9F6D8F1EDD1ECDA89F4BE327C4F4202649475D1D9DFB476279B633D9F14125D
/* 20250905 */
BasePlus: F*DB0811D8F207641BD45FCE30CB75D03CDF8D06849EBEA268BB575358FAA4E76C
/* 20250807 */
BasePlus: F*19FE220C82DE4B9990B4AC352A9D9DEF5FAF2FD601BE756B2F3A2AC39CDAF381
/* 20250805 */
BasePlus: F*B2D318DD9708D74E5A7C419F7CAE1BF46D662B7F6AEE7E6B1B9D9B6858A5C41A
/* 20250804 */
BasePlus: F*71DC1AFA709B2977E8AEA452721776F62EEC8240ABD658AC83AA6D4310FC49B6
/* 20240909 */
BasePlus: F*DFA83F8E0D7424DEB63D49620392068BC68D766552E2804CB6B01DE8E5A87769

View File

@@ -9,22 +9,22 @@
### Version information:
- Package: BasePlus
- Version: 2.1.0
- Generated: 2024-09-09T12:55:04
- Author(s): Bartosz Jablonski (yabwon@gmail.com), Quentin McMullen (qmcmullen@gmail.com)
- Version: 3.1.1
- Generated: 2025-11-05T15:10:31
- Author(s): Bartosz Jablonski (yabwon@gmail.com), contributors are Quentin McMullen (qmcmullen@gmail.com) and Ryo Nakaya (nakaya.ryou@gmail.com)
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
- License: MIT
- File SHA256: `F*DFA83F8E0D7424DEB63D49620392068BC68D766552E2804CB6B01DE8E5A87769` for this version
- Content SHA256: `C*AB16F5B6538515607C3C254E401DC1ACA7293AB36990227F6E7792145CEEAB87` for this version
- File SHA256: `F*6394CE27FBCF48D475F682CBCF8CA8B4FDD6D40D2672EF571F4A561BDDF274A6` for this version
- Content SHA256: `C*3CA28DF8F3E6D6670D7FD44788D347452F24F4BCF18115873E7EBC742FE30CA4` for this version
---
# The `BasePlus` package, version: `2.1.0`;
# The `BasePlus` package, version: `3.1.1`;
---
# The BasePlus package [ver. 2.1.0] <a name="baseplus-package"></a> ###############################################
# The BasePlus package [ver. 3.1.1] <a name="baseplus-package"></a> ###############################################
The **BasePlus** package implements useful
functions and functionalities I miss in the BASE SAS.
@@ -47,7 +47,8 @@ Kudos to all who inspired me to generate this package:
*Quentin McMullen*,
*Kurt Bremser*,
*Leonid Batkhan*,
*Louise Hadden*.
*Louise Hadden*,
*Ryo Nakaya*.
---
@@ -387,6 +388,11 @@ proc print data=b_x;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 29** Create library ABC assigned to `<WORK>/ABC` directory:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%workLib(abc)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
---
@@ -403,7 +409,7 @@ localization (only if additional content was deployed during the installation pr
--------------------------------------------------------------------
*SAS package generated by SAS Package Framework, version `20240711`*
*SAS package generated by SAS Package Framework, version `20251017`*
--------------------------------------------------------------------
@@ -490,10 +496,11 @@ The `BasePlus` package consists of the following content:
78. [`%translate()` macro ](#translate-macro-78 )
79. [`%tranwrd()` macro ](#tranwrd-macro-79 )
80. [`%unifyvarscasesize()` macro ](#unifyvarscasesize-macro-80 )
81. [`%workpath()` macro ](#workpath-macro-81 )
81. [`%worklib()` macro ](#worklib-macro-81 )
82. [`%workpath()` macro ](#workpath-macro-82 )
82. [License note](#license)
83. [License note](#license)
---
@@ -838,6 +845,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,longFormat=>
<,fileExt=>
<,maxDepth=>
<,backslashSens=>
)
~~~~~~~~~~~~~~~~~~~~~~~
@@ -868,6 +876,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
* `maxDepth=0` - *Optional*, if not zero then indicates
maximum depth of search in the root path.
* `backslashSens=0` - *Optional*, if not zero then it indicates
that backslash(`\`) symbol in files and dirs
names is detectable under Linux. Accepted
values: `0` and `1`. Ignored under Windows.
### EXAMPLES AND USECASES: ####################################################
@@ -989,7 +1002,12 @@ The QgetVars() returns quoted value [by %superq()].
See examples below for the details.
The `%getVars()` macro executes like a pure macro code.
When `mcArray=` is not used the `%getVars()` macro executes like
a pure macro code. When `mcArray=` is not null (creation of a
macro variable array is requested) them a single semicolon is returned.
When `validvarname=ANY` in set special care should be kept.
See dedicated examples below.
### SYNTAX: ###################################################################
@@ -1003,6 +1021,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,quote=>
<,mcArray=>
<,ignoreCases>
<,nlit=>
)
~~~~~~~~~~~~~~~~~~~~~~~
@@ -1025,23 +1044,32 @@ The basic syntax is the following, the `<...>` means optional parameters:
* `mcArray=` - *Optional*, default value is blank.
1) When *null* - the macro behaves like a macro function
and returns a text string with variables list.
2) When *not null* - behaviour of the macro is altered.
and ban be used in the `%put` or `%let=` statements.
The returned text is a string with variables list.
2) When *not null* - behavior of the macro is altered.
In such case a macro array of selected variables, named
with `mcArray` value as a prefix, is created.
Furthermore a macro named as `mcArray` value is generated.
(see the macroArray package for the details).
When `mcArray=` parameter is active the `getVars` macro
cannot be called within the `%put` statement. Execution like:
`%put %getVars(..., mcArray=XXX);` will result with
an Explicit & Radical Refuse Of Run (aka ERROR).
should not be called within the `%put` or `%let=` statements.
A single semicolon is produced as the macro result, hence
execution like: `%put %getVars(..., mcArray=XXX) some text;`
will result with an Explicit & Radical Refuse Of Run (aka ERROR).
* `ignoreCases=` - *Optional*, default value is 1.
* `ignoreCases=` - *Optional*, default value is 1.
Indicates if search should be case insensitive.
* `nlit=` - *Optional*, default value is 0.
Introduced to improve `validvarname=ANY` handling.
Indicates if the `NLITERAL()` function should be
executed to cover spacial characters.
### EXAMPLES AND USECASES: ####################################################
**When `validvarname=` option is _not_ `ANY`.**
**EXAMPLE 1.** A list of all variables from the
sashelp.class dataset:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
@@ -1267,6 +1295,44 @@ run;
%put %do_over(XYZ);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**When the `validvarname=ANY` option is set.**
**EXAMPLE 12.** Get all variables and handle special characters.
Without `nlit=1` the code will fail.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
options validvarname = any;
data varnameANY;
set sashelp.class(obs=3);
'A&B'n=42;
'space name'n=101;
'2025-08'n=234;
'2025%09'n=235;
"2025'10"n=236;
'2025"11'n=237;
run;
%put %getVars(varnameANY, nlit=1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 13.** Create macro variable array ABC for all variables.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%getVars(varnameANY, mcArray=ABC, nlit=1);
%put %ABC(1) %ABC(6) %ABC(7) %ABC(11);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 14.** Get only variables with illegal characters in names.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%let notV7compliant = %getVars(varnameANY, pattern=[^a-z0-9_], nlit=1);
%put &notV7compliant.;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 14.** Print variables starting with a digit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%put %getVars(varnameANY, pattern=^\d, nlit=1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
@@ -1929,6 +1995,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
* `ignoreCases=` - *Optional*, default value is 1.
Indicates if search should be case insensitive.
* `nlit=` - *Optional*, default value is 0.
Introduced to improve `validvarname=ANY` handling.
Indicates if the `NLITERAL()` function should be
executed to cover spacial characters.
### EXAMPLES AND USECASES: ####################################################
@@ -5958,6 +6029,11 @@ See examples below for the details.
The `%findDSwithVarVal()` macro does not execute as a pure macro code.
**NOTE:**
When a library is assigned with different engine than:
"BASE","SPDE","V6","V7","V8","V9","CVP"
observation number is not returned.
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
@@ -6395,7 +6471,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
3. `false` - *Required*, value returned when condition is false.
4 `v=` - *Optional*, v for verbose. If set to `1` extra notes
* `v=` - *Optional*, v for verbose. If set to `1` extra notes
are printed.
---
@@ -6592,7 +6668,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
The letters() macro function allows to print a list of Roman
letters starting from `start` up to `end` incremented by `by`.
The letters list can be uppercases or lowercase (parameter `c=U` or `c=L`),
The letters list can be uppercase or lowercase (parameter `c=U` or `c=L`),
can be quoted (e.g. `q=""` or `q=[]`), and can be separated by `s=`.
Values of `start`, `end`, and `by` have to be integers in range between 1 ad 26.
@@ -6620,12 +6696,12 @@ The basic syntax is the following, the `<...>` means optional parameters:
Values of `start`, `end`, and `by` are separated by
colon and must be between 1 ad 26.
If value is outside range it is set to
`start=1`, `en=26`, and `by=1`. If `end` is missing
then is set to value of `start`.
`start=1`, `end=26`, and `by=1`. If `end` is missing
then it is set to value of `start`.
If `end` is smaller than `start` list is reversed
* `c = U` - *Optional*, it is a lowercase letters indicator.
Select `L` or `l`. Default value is `U` for upcase.
Select `L` or `l`. Default value is `U` for uppercase.
* `q = ` - *Optional*, it is a quite around elements of the list.
Default value is empty. Use `%str()` for one quote symbol.
@@ -7555,7 +7631,71 @@ run;
---
## `%workpath()` macro <a name="workpath-macro-81"></a> ######
## `%worklib()` macro <a name="worklib-macro-81"></a> ######
## >>> `%workLib()` macro: <<< <a name="worklib-macro"></a> #######################
The `%workLib()` macro creates and assigns a WORK-scoped sub-library.
Purpose:
The macro creates (if needed) and assigns a SAS library as a sub-directory
under the current `WORK` location. This is useful for isolating temporary
outputs per task while ensuring automatic cleanup at the end of the SAS session.
Basic engines libraries, like `BASE`, `V*`, and simple `SPDE`, can be set.
### SYNTAX: ###################################################################
The basic syntax is the following, the `<...>` means optional parameters:
~~~~~~~~~~~~~~~~~~~~~~~sas
%workLib(lib,<engine>)
~~~~~~~~~~~~~~~~~~~~~~~
**Arguments description**:
- `lib` - *Required*: Name of a library (and sub-folder)
to create under WORK. The value must be a valid
nonempty SAS libref (8 characters max, starting
with a letter or underscore).
- `engine` - *Optional*, Name of a basic, directory level,
SAS engine, e.g. `BASE`. When empty the default
engine is used.
---
### Details
- Builds a target path: `<WORK>/<lib>`.
- All data written to this libref are temporary and will be removed
when the WORK library is cleared at session end.
- If a directory with the same name already exists under WORK,
the macro prints a note and simply assigns the LIBNAME to
that location.
- The `dcreate()` function is used to create sub-directory.
### EXAMPLES AND USECASES: ####################################################
**EXAMPLE 1.** Create library ABC assigned to `<WORK>/ABC` directory:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%workLib(abc)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 2.** Create libraries with different engines:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%workLib(b,BASE)
%workLib(v,V6) %* for Windows only.;
%workLib(s,SPDE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
---
## `%workpath()` macro <a name="workpath-macro-82"></a> ######
## >>> `%workPath()` macro: <<< <a name="workpath-macro"></a> #######################
@@ -7598,7 +7738,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
# License <a name="license"></a> ######
Copyright (c) 2020 - 2024 Bartosz Jablonski
Copyright (c) 2020 - 2025 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

@@ -1,14 +1,30 @@
- [The SQLinDS package](#sqlinds-package)
- [Content description](#content-description)
* [library `dsSQL`](#library-dssql)
* [`%dsSQL_inner()` macro](#dssql-inner-macro)
* [`%SQL()` macro](#dssql-inner-macro)
* [`dsSQL()` function](#dssql-function)
* [License](#license)
# Documentation for the `SQLinDS` package.
----------------------------------------------------------------
*SQL queries in Data Step*
----------------------------------------------------------------
### Version information:
- Package: SQLinDS
- Version: 2.3.1
- Generated: 2025-11-22T12:47:32
- Author(s): Mike Rhoads (RhoadsM1@Westat.com), contributor Bartosz Jablonski
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
- License: MIT
- File SHA256: `F*606A24A2A6B06DAAD2D443FA9A9819D9564235A5CD8599FD15586F1EFFCB41BC` for this version
- Content SHA256: `C*4CCCF31DA9D94E0EE2DA612724D395056B7BA07CB593C93947835BB8319B33EB` for this version
---
# The `SQLinDS` package, version: `2.3.1`;
---
# The SQLinDS package [ver. 2.3.0] <a name="sqlinds-package"></a> ###############################################
### The SQLinDS package [ver. 2.3.1]
The **SQLinDS** package is an implementation of
the *macro-function-sandwich* concept introduced in the
@@ -20,13 +36,13 @@ The article is available at:
Copy of the article can also be found in *additional content* directory.
Package provides ability to *execute* SQL queries inside a data step, e.g.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data class;
set %SQL(select * from sashelp.class);
set %SQL(select name, age from sashelp.class);
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the help for the `%SQL()` macro to find more examples.
### Content ###################################################################
@@ -41,67 +57,96 @@ SQLinDS package contains the following components:
---
Package contains:
1. libname dssql
2. macro dssql_inner
3. macro sql
4. function dssql
5. kmfsnip sqlinds
Required SAS Components:
*Base SAS Software*
Package contains additional content, run: %loadPackageAddCnt(SQLinDS) to load it
or look for the sqlinds_AdditionalContent directory in the Packages fileref
localization (only if additional content was deployed during the installation process).
*SAS package generated by generatePackage, version 20231111*
The SHA256 hash digest for package SQLinDS:
`F*3C010734B76CA7459C4D35087C899121011CD4AA2932B56335FF11A805C8EF8D`
---
# Content description ############################################################################################
## >>> library `dsSQL`: <<< <a name="library-dssql"></a> ########################
---
Required SAS Components:
- Base SAS Software
---
---
Package contains additional content, run: `%loadPackageAddCnt(SQLinDS)` to load it
or look for the `sqlinds_AdditionalContent` directory in the `packages` fileref
localization (only if additional content was deployed during the installation process).
---------------------------------------------------------------------
*SAS package generated by SAS Package Framework, version `20251122`,*
*under `WIN`(`X64_10PRO`) operating system,*
*using SAS release: `9.04.01M9P06042025`.*
---------------------------------------------------------------------
# The `SQLinDS` package content
The `SQLinDS` package consists of the following content:
1. [`dssql` libname ](#dssql-libname-1 )
2. [`%dssql_inner()` macro ](#dssqlinner-macro-2 )
3. [`%sql()` macro ](#sql-macro-3 )
4. [`dssql()` function ](#dssql-function-4 )
5. [`sqlinds` kmfsnip ](#sqlinds-kmfsnip-5 )
6. [License note](#license)
---
## `dssql` libname <a name="dssql-libname-1"></a> ######
The `dsSQL` library stores temporary views
generated during the `%SQL()` macro execution.
If possible a subdirectory of the `WORK` location is created, like:
If possible a sub-directory of the `WORK` location is created, like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))/dsSQLtmp";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if not possible, then redirects to the `WORK` location, like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
---
## `%dssql_inner()` macro <a name="dssqlinner-macro-2"></a> ######
The `%dsSQL_Inner()` macro is an **internal**
macro called by `dsSQL()` function.
## >>> `%dsSQL_Inner()` macro: <<< <a name="dssql-inner-macro"></a> #############
**Internal** macro called by `dsSQL()` function.
The macro generates a uniquely named SQL view on the fly
which is then stored in the `dsSQL` library.
The `%dsSQL_Inner()` is *not* designed to be
called on its own.
Recommended for *SAS 9.3* and higher.
---
## >>> `%SQL()` macro: <<< <a name="dssql-macro"></a> ###########################
The **main** macro which allows to use
SQL queries in the data step.
---
## `%sql()` macro <a name="sql-macro-3"></a> ######
The `%SQL()` macro is the **main**
macro in the package. The macro allows
to use SQL queries in the data step.
Recommended for *SAS 9.3* and higher.
Based on the article *"Use the Full Power of SAS in Your Function-Style Macros"*
Implementation is based on the article:
*"Use the Full Power of SAS in Your Function-Style Macros"*
by *Mike Rhoads* (Westat, Rockville), available at:
[https://support.sas.com/resources/papers/proceedings12/004-2012.pdf](https://support.sas.com/resources/papers/proceedings12/004-2012.pdf)
@@ -109,10 +154,10 @@ Copy of the article can also be found in *additional content* directory.
### SYNTAX: ###################################################################
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
%sql(<nonempty sql querry code>)
%sql(<nonempty Proc SQL query code>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The sql query code is limited to *32000* bytes.
The THE query code is limited to approximately *32000* bytes.
### EXAMPLES: #################################################################
@@ -126,26 +171,34 @@ run;
**EXAMPLE 2**: query with dataset options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data renamed;
set %SQL(select * from sashelp.class where sex = "F")(rename = (age=age2));
set %SQL(select name, age from sashelp.class
where sex = "F")(rename = (age=age2)
);
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 3**: dictionaries in the data step
**EXAMPLE 3**: Proc SQL dictionaries in the data step
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data dictionary;
set %SQL(select * from dictionary.macros);
set %SQL(select dict.* from dictionary.macros as dict);
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
---
## >>> `dsSQL()` function: <<< <a name="dssql-function"></a> ####################
## `dssql()` function <a name="dssql-function-4"></a> ######
The `dsSQL()` function is an **internal**
function called by the `%SQL()` macro.
**Internal** function called by the `%SQL()` macro.
The function pass a query code from the `%SQL()`
The function pass a query code from the `%SQL()`
macro to the `%dsSQL_Inner()` internal macro.
The `dsSQL()` is *not* designed to be
called on its own.
Recommended for *SAS 9.3* and higher.
### SYNTAX: ###################################################################
@@ -161,8 +214,27 @@ dsSQL(unique_index_2, query)
---
## License ####################################################################
---
## `sqlinds` kmfsnip <a name="sqlinds-kmfsnip-5"></a> ######
This is a help note for `sqlinds` KMF-abbreviation.
The snippet presents a template
for use of the `%SQL()` macro.
To read help info about the macro
run he following:
`%helpPackage(SQLinDS,'%sql()')`
---
---
# License <a name="license"></a> ######
Copyright (c) 2012 Mike Rhoads
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -182,5 +254,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---

Binary file not shown.