mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2025-12-11 03:04:35 +00:00
Compare commits
128 Commits
20241129
...
37419f1826
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37419f1826 | ||
|
|
b71b0382c5 | ||
|
|
f61e68490a | ||
|
|
200bab261e | ||
|
|
b8d5f286d2 | ||
|
|
b69ee84a1d | ||
|
|
801a4731ec | ||
|
|
8d8186fc78 | ||
|
|
b4b319a2e0 | ||
|
|
9cf3332e60 | ||
|
|
998a23c980 | ||
|
|
3701986fab | ||
|
|
31a29b3528 | ||
|
|
fab9fb7166 | ||
|
|
1d83c65a9b | ||
|
|
71503379bf | ||
|
|
79bd3d0c0a | ||
|
|
f01ac518a6 | ||
|
|
e8d1269f6c | ||
|
|
62b7c64063 | ||
|
|
ef3afe837d | ||
|
|
ba34a71ffe | ||
|
|
f63ff497ee | ||
|
|
ff758fc2cc | ||
|
|
030a0932a8 | ||
|
|
35b30ca45e | ||
|
|
cc25b76144 | ||
|
|
bfdede5dd4 | ||
|
|
628641a6cf | ||
|
|
191d07c2c8 | ||
|
|
856c73758f | ||
|
|
2e47ab5e37 | ||
|
|
104c38ab2c | ||
|
|
9a7b81c2ad | ||
|
|
a56da0fa4f | ||
|
|
edeb1729b5 | ||
|
|
9b2ec979e4 | ||
|
|
efda10b412 | ||
|
|
78a79d1fc7 | ||
|
|
e61a9689df | ||
|
|
044019608f | ||
|
|
fedf5b894d | ||
|
|
3c30e7d17c | ||
|
|
a99b75ffe9 | ||
|
|
e7357877f0 | ||
|
|
05946c92ce | ||
|
|
b3b36174af | ||
|
|
62fd354c6d | ||
|
|
7f97b47a21 | ||
|
|
340d13e56f | ||
|
|
d68697ea77 | ||
|
|
9bb8354faa | ||
|
|
d0ff15fe80 | ||
|
|
fe70185832 | ||
|
|
83bef9fe30 | ||
|
|
fd0a67de4e | ||
|
|
60405c2226 | ||
|
|
b6c554d994 | ||
|
|
b7ce4778bb | ||
|
|
956cfce026 | ||
|
|
2c1a7eacc3 | ||
|
|
1a6f0c0013 | ||
|
|
8a30b5a918 | ||
|
|
b209d022b3 | ||
|
|
680c021f72 | ||
|
|
ad15aa0e3b | ||
|
|
b78dac17e7 | ||
|
|
974f617772 | ||
|
|
5550b0d1de | ||
|
|
0979066509 | ||
|
|
344619d195 | ||
|
|
a7c6a670bf | ||
|
|
01513d9cdb | ||
|
|
62ad0c1045 | ||
|
|
be6d41ae7d | ||
|
|
c92edcbbd6 | ||
|
|
b6f9a65f5f | ||
|
|
d8451c08bc | ||
|
|
565d7d3f6e | ||
|
|
f2a72739c7 | ||
|
|
394aaab3be | ||
|
|
88e97ecd7f | ||
|
|
ebcad71357 | ||
|
|
e9e3518b6a | ||
|
|
e17c325e5c | ||
|
|
6891d9d4c6 | ||
|
|
1f093a749b | ||
|
|
9331fa488d | ||
|
|
6194dcb2a0 | ||
|
|
bbd018bf61 | ||
|
|
f3b3b55dba | ||
|
|
bd3a78adfd | ||
|
|
6487d74aaf | ||
|
|
4c734caeec | ||
|
|
11400fe51d | ||
|
|
6e5d4c3872 | ||
|
|
3ccf2490e1 | ||
|
|
9273e80a16 | ||
|
|
5cbe17b513 | ||
|
|
21a713ced7 | ||
|
|
0af4000d33 | ||
|
|
ae423c362b | ||
|
|
705a600534 | ||
|
|
2137c04534 | ||
|
|
49bcb64e51 | ||
|
|
8bdf820958 | ||
|
|
2045048ff3 | ||
|
|
f4007a22df | ||
|
|
96952896a2 | ||
|
|
f886a42b77 | ||
|
|
612e955983 | ||
|
|
907ad0865d | ||
|
|
9d37f157c7 | ||
|
|
f5159f9557 | ||
|
|
033961fba2 | ||
|
|
1e31a9cec4 | ||
|
|
9f8560aa61 | ||
|
|
4599a6e06d | ||
|
|
28c8afac49 | ||
|
|
aac8a3ca0a | ||
|
|
82bb81624f | ||
|
|
9bccf5b9f5 | ||
|
|
cad068d931 | ||
|
|
b9c280d983 | ||
|
|
ca72c14569 | ||
|
|
aa84650b42 | ||
|
|
60354ce484 | ||
|
|
793d0c7d6a |
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 - 2024 Bartosz Jablonski
|
||||
Copyright (c) 2019 - 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
|
||||
|
||||
77
README.md
77
README.md
@@ -1,28 +1,35 @@
|
||||
# SAS_PACKAGES - a SAS Packages Framework
|
||||
# SAS Packages Framework
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Intro:
|
||||
|
||||
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).
|
||||
|
||||
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)! :-)
|
||||
|
||||
Don't forget to **STAR** (:star:) the repository! :-)
|
||||
|
||||
---
|
||||
|
||||
### Current version:
|
||||
|
||||
**The latest version** of SPF is **`20241129`**.
|
||||
**The latest version** of the **SAS Packages Framework** is **`20251126`**.
|
||||
|
||||
To get started with SAS Packages try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
|
||||
---
|
||||
|
||||
The documentation and more advance reading would be the [**`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") article (see the `./SPF/Documentation` directory).
|
||||
---
|
||||
|
||||
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")
|
||||
## Intro:
|
||||
|
||||
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 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 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:
|
||||
|
||||
@@ -37,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:
|
||||
@@ -45,30 +53,36 @@ 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)
|
||||
|
||||
3) (D) Article and all required materials for ["My first SAS Package"](https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation/Paper_1079-2021) tutorial.
|
||||
|
||||
4) (DU) Materials from Hands-on-Workshop (4+ hours) tutorial: [Share your code with SAS Packages](https://github.com/yabwon/HoW-SASPackages).
|
||||
4) (DU) Materials from Hands-on-Workshop (4+ hours) tutorial: [Share your code with SAS Packages](https://github.com/yabwon/HoW-SASPackages).
|
||||
It is a "zero to hero" tutorial that explains all the "bells and whistles" of using, and all the "nuts and bolts" of developing SAS packages.
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
### 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!
|
||||
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)!
|
||||
|
||||
---
|
||||
|
||||
### The User:
|
||||
### A Brief User Manual:
|
||||
|
||||
This is a brief intro. See below to find a link to detailed workshop materials.
|
||||
|
||||
#### Create directory
|
||||
|
||||
The first step to use a package with the SAS Packages Framework:
|
||||
|
||||
- Create a folder for your packages, under Windows OS family e.g., `C:/SAS_PACKAGES` or under Linux/UNIX OS family e.g., `/home/<username>/SAS_PACKAGES`.
|
||||
- Create a folder for your packages, under Windows OS family e.g., `C:/SAS_PACKAGES` or under Linux/UNIX OS family e.g., `/home/<username>/SAS_PACKAGES`. The path selected is totally up to you.
|
||||
|
||||
Then either:
|
||||
#### Manual installation
|
||||
|
||||
- Manually download the `SPFinit.sas` file (the SAS Packages Framework) into the local packages folder.
|
||||
- \[Optional\] Manually download the `<packageName>.zip` file into the local packages folder.
|
||||
@@ -84,7 +98,11 @@ filename packages "<directory/containing/packages/>"; /* setup directory
|
||||
%loadPackage(packageName) /* load the package content into the SAS session */
|
||||
```
|
||||
|
||||
or if you need it just for "one time" only:
|
||||
---
|
||||
|
||||
#### Automatic (one-time-only) installation
|
||||
|
||||
If you need it just for "one time" only, e.g., for test if you like it:
|
||||
|
||||
- Execute:
|
||||
|
||||
@@ -98,9 +116,13 @@ filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main
|
||||
%loadPackage(packageName) /* load the package content into the SAS session */
|
||||
```
|
||||
|
||||
or do it pragmatically:
|
||||
---
|
||||
|
||||
- Enable the framework [first time only]:
|
||||
#### Automatic (permanent) installation
|
||||
|
||||
To install SPF pragmatically:
|
||||
|
||||
- Enable the framework [do this first and one time only!]:
|
||||
|
||||
```sas
|
||||
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
|
||||
@@ -121,7 +143,7 @@ filename packages "<directory/containing/packages/>";
|
||||
%installPackage(SPFinit) /* install the framework */
|
||||
```
|
||||
|
||||
- From now on run it like this:
|
||||
- From now on, just like you would assign libraries, run the SPF and use packages like this:
|
||||
|
||||
```sas
|
||||
filename packages "<directory/containing/packages/>";
|
||||
@@ -134,16 +156,20 @@ filename packages "<directory/containing/packages/>";
|
||||
|
||||
---
|
||||
|
||||
The "Workshop video for the User" got outdated (in general). Newer version is coming soon, in the mean time see some of the videos from the "Recordings and Presentations" section above.
|
||||
[**Detailed workshop materials**](https://github.com/yabwon/HoW-SASPackages) (i.e. "from 0 to hero" instruction).
|
||||
|
||||
The youtube "Workshop video for the User" got outdated (in general). Newer version is coming soon, in the mean time see some of the videos from the "Recordings and Presentations" section above.
|
||||
(You can watch the workshop if you wish, link is working and some parts are still valid source of information e.g., "`ICE` loading" or "`disk` loading")
|
||||
|
||||
<s>[**Workshop video for the User**](https://youtu.be/qX_-HJ76g8Y) \[May 6th, 2020\] [~86 minutes, outdated (installPackage macro was not there yet) but gives the idea how it works especially load, help, unload, ICEload, and other details]</s>
|
||||
|
||||
---
|
||||
|
||||
### The Developer:
|
||||
---
|
||||
|
||||
To create your own package:
|
||||
### For The Developer:
|
||||
|
||||
In brief, to create your own package:
|
||||
|
||||
- Download (and use) the `SPFinit.sas` file (the SAS Packages Framework), the part of the framework required for *testing* is there too.
|
||||
|
||||
@@ -155,6 +181,8 @@ To create your own package:
|
||||
|
||||
The SAS Packages Framework [(short) documentation](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/SPFinit.md) to quickly see macros options and parameters.
|
||||
|
||||
[**Detailed workshop materials**](https://github.com/yabwon/HoW-SASPackages) (i.e. "from 0 to hero" detailed instruction with a bunch of examples).
|
||||
|
||||
---
|
||||
|
||||
### If you have any questions, suggestions, or ideas do not hesitate to contact me!
|
||||
@@ -194,12 +222,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.
|
||||
|
||||
---
|
||||
|
||||
|
||||
BIN
SPF/Documentation/Paper_012-SESUG2025.pdf
Normal file
BIN
SPF/Documentation/Paper_012-SESUG2025.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
SPF/Logo/SPFlogo.pdf
Normal file
BIN
SPF/Logo/SPFlogo.pdf
Normal file
Binary file not shown.
BIN
SPF/Logo/SPFlogo.png
Normal file
BIN
SPF/Logo/SPFlogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 475 KiB |
BIN
SPF/Logo/SPFlogo1200x770.png
Normal file
BIN
SPF/Logo/SPFlogo1200x770.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
@@ -6,7 +6,7 @@
|
||||
when empty the "packages" value is used */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20241129. Run %extendPackagesFileref(HELP) for help info.'
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20251126. 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 20241129
|
||||
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20241129` #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -43,6 +43,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20241129
|
||||
%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 # #;
|
||||
@@ -56,7 +57,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20241129
|
||||
%put # Run the following code in your SAS session: #;
|
||||
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
||||
%put %nrstr( filename packages ("C:/SAS_PK1" "C:/SAS_PK2"); %%* setup a directory for packages; );
|
||||
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
|
||||
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
|
||||
%put ;
|
||||
%put %nrstr( filename packages ("D:/NEW_DIR" %%extendPackagesFileref()); %%* add new directory; );
|
||||
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage() for help info.'
|
||||
des = 'Macro to get help about SAS package, version 20251126. 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 20241129. Run %helpPackage()
|
||||
%put ### This is short help information for the `helpPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get help about SAS packages, version `20241129` #;
|
||||
%put # Macro to get help about SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -93,6 +93,7 @@ des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage()
|
||||
%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 # #;
|
||||
@@ -131,8 +132,9 @@ des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage()
|
||||
options NOnotes NOsource ls=MAX ps=MAX msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
@@ -142,7 +144,7 @@ des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage()
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).&zip."));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -150,7 +152,7 @@ des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage()
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
@@ -158,7 +160,7 @@ des = 'Macro to get help about SAS package, version 20241129. Run %helpPackage()
|
||||
filename &_PackageFileref_. clear;
|
||||
options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
ENCODING =
|
||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||
%else utf8 ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*+installPackage+*/
|
||||
/* Macros to install SAS packages, version 20241129 */
|
||||
/* Macros to install SAS packages, version 20251126 */
|
||||
/* 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
|
||||
@@ -18,12 +18,15 @@
|
||||
, URLoptions = /* options for the `sourcePath` URLs */
|
||||
, loadAddCnt=0 /* should the additional content be loaded?
|
||||
default is 0 - means No, 1 means Yes */
|
||||
, instDoc=0 /* should the markdown file with documentation be installed?
|
||||
default is 0 - means No, 1 means Yes */
|
||||
, SFRCVN = /* name of a macro variable to store success-failure return code value */
|
||||
, github = /* name of a user or an organization in GitHub, all characters except [A-z0-9_.-] are compressed */
|
||||
)
|
||||
/secure
|
||||
minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to install SAS package, version 20241129. Run %%installPackage() for help info.'
|
||||
des = 'Macro to install SAS package, version 20251126. Run %%installPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
%do;
|
||||
@@ -38,7 +41,7 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%put ### This is short help information for the `installPackage` macro #;
|
||||
%put #--------------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to install SAS packages, version `20241129` #;
|
||||
%put # Macro to install SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -71,21 +74,23 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%put # `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/` #;
|
||||
%put # #;
|
||||
%put # - `mirror=` Indicates which web location for packages installation is used. #;
|
||||
%put # Value `0` indicates: #;
|
||||
%put # `https://github.com/SASPAC/` #;
|
||||
%put # Value `0` or `SASPAC` indicates: #;
|
||||
%put # `https://github.com/SASPAC/` #;
|
||||
%put # Value `1` indicates: #;
|
||||
%put # `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main` #;
|
||||
%put # `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main` #;
|
||||
%put # Value `2` indicates: #;
|
||||
%put # `https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES` #;
|
||||
%put # `https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES` #;
|
||||
%put # Value `3` or `PharmaForest` indicates: #;
|
||||
%put # `https://github.com/PharmaForest/` #;
|
||||
%put # Default value is `0`. #;
|
||||
%put # #;
|
||||
%put # - `version=` Indicates which historical version of a package to install. #;
|
||||
%put # Historical version are available only if `mirror=0` is set. #;
|
||||
%put # Historical version are currently available only if `mirror=0` is set. #;
|
||||
%put # Default value is null which means "install the latest". #;
|
||||
%put # When there are multiple packages to install version variable #;
|
||||
%put # When there are multiple packages to install the `version` variable #;
|
||||
%put # is scan sequentially. #;
|
||||
%put # #;
|
||||
%put # - `replace=` With default value of `1` it causes existing package file #;
|
||||
%put # - `replace=` With default value of `1`, it causes existing package file 0 #;
|
||||
%put # to be replaced by new downloaded file. #;
|
||||
%put # #;
|
||||
%put # - `URLuser=` A user name for the password protected URLs, no quotes needed. #;
|
||||
@@ -102,15 +107,26 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%put # directory in `<packageName>_AdditionalContent` folder. #;
|
||||
%put # For other locations use `%nrstr(%%loadPackageAddCnt())` macro. #;
|
||||
%put # #;
|
||||
%put # - `SFRCVN=` *Optional.* Provides a NAME for a macro variable to store value of the #;
|
||||
%put # *success-failure return code* of the installation process. Return value #;
|
||||
%put # has the following form: `<number of successes>.<number of failures>` #;
|
||||
%put # The macro variable is created as a *global* macro variable. #;
|
||||
%put # - `instDoc=` *Optional.* A package may be provided with a markdown file #;
|
||||
%put # containing combined documentation of the package. The option #;
|
||||
%put # indicates if the `.md` file should be also downloaded. #;
|
||||
%put # Default value of zero (`0`) means "No", one (`1`) means "Yes". #;
|
||||
%put # #;
|
||||
%put # - `SFRCVN=` *Optional.* Provides a NAME for a macro variable to store value of the #;
|
||||
%put # *success-failure return code* of the installation process. Return value #;
|
||||
%put # has the following form: `<number of successes>.<number of failures>` #;
|
||||
%put # The macro variable is created as a *global* macro variable. #;
|
||||
%put # #;
|
||||
%put # - `github=` *Optional.* A name of a user or an organization in GitHub. #;
|
||||
%put # Allows an easy set of the search path for packages available on GitHub: #;
|
||||
%put # `https://github.com/<github>/<packagename>/raw/.../` #;
|
||||
%put # All characters except `[A-z0-9_.-]` are compressed. #;
|
||||
%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 # #;
|
||||
@@ -135,7 +151,7 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%put # #;
|
||||
%put # Enabling the SAS Package Framework #;
|
||||
%put # from the local directory and installing & loading #;
|
||||
%put # the multiple packages from the Internet. #;
|
||||
%put # multiple packages with versions from the Internet. #;
|
||||
%put # #;
|
||||
%put # Assume that the `SPFinit.sas` file #;
|
||||
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
|
||||
@@ -182,40 +198,83 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
call symputX("firstPackagesPath", pathname("packages"), "L");
|
||||
run;
|
||||
|
||||
%let loadAddCnt = %sysevalf(NOT(0=%superq(loadAddCnt)));
|
||||
%let instDoc = %sysevalf(NOT(0=%superq(instDoc)));
|
||||
|
||||
%let replace = %sysevalf(1=%superq(replace));
|
||||
|
||||
%if %superq(sourcePath)= %then
|
||||
%do;
|
||||
%local SPFinitMirror;
|
||||
%local SPFinitMirror SPFinitMirrorMD;
|
||||
/* the defaults are: */
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
|
||||
|
||||
%if %qupcase(%superq(mirror))=SASPAC %then %let mirror = 0;
|
||||
%if %qupcase(%superq(mirror))=PHARMAFOREST %then %let mirror = 3;
|
||||
%if %superq(github) NE %then %let mirror = 4;
|
||||
|
||||
%if NOT (%superq(mirror) IN (0 1 2 3 4)) %then
|
||||
%do;
|
||||
%put WARNING: Unknown mirror: %superq(mirror)!;
|
||||
%put WARNING- Default will be used.;
|
||||
%let mirror = 0;
|
||||
%end;
|
||||
|
||||
%if 0 = %superq(mirror) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let sourcePath = https://github.com/SASPAC/; /*usercontent*/
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
%let sourcePath = https://github.com/SASPAC/; /*users content*/
|
||||
%goto mirrorEnd;
|
||||
%end;
|
||||
|
||||
%if 1 = %superq(mirror) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
%let sourcePath = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/packages/;
|
||||
%goto mirrorEnd;
|
||||
%end;
|
||||
|
||||
%if 2 = %superq(mirror) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/SPF/SPFinit.sas;
|
||||
%let SPFinitMirror = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/SPF/SPFinit.md;
|
||||
%let sourcePath = https://pages.mini.pw.edu.pl/~jablonskib/SASpublic/SAS_PACKAGES/packages/;
|
||||
%goto mirrorEnd;
|
||||
%end;
|
||||
|
||||
%if 3 = %superq(mirror) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
/* ingnore version support for pharmaForest for now */
|
||||
%let sourcePath = https://github.com/PharmaForest/; /*users content*/
|
||||
%goto mirrorEnd;
|
||||
%end;
|
||||
|
||||
%if 4 = %superq(mirror) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.md;
|
||||
/* ingnore version support for pharmaForest for now */
|
||||
%let github = %sysfunc(compress(%superq(github),%str(,.-),KAD));
|
||||
%put INFO: GitHub location used is: %superq(github).;
|
||||
%let sourcePath = https://github.com/&github./; /*users content*/
|
||||
%goto mirrorEnd;
|
||||
%end;
|
||||
|
||||
%mirrorEnd:
|
||||
%put INFO: Source path is &sourcePath.;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%let sourcePath = %sysfunc(dequote(%superq(sourcePath)))/;
|
||||
%let mirror=-1;
|
||||
%let SPFinitMirror = &sourcePath.SPFinit.sas;
|
||||
%let SPFinitMirror = &sourcePath.SPFinit.sas;
|
||||
%let SPFinitMirrorMD = &sourcePath.SPFinit.md;
|
||||
%end;
|
||||
|
||||
%local i str;
|
||||
@@ -232,7 +291,7 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
|
||||
%if %length("%sysfunc(compress(%superq(str),[,k))") NE %length("%sysfunc(compress(%superq(str),],k))") %then
|
||||
%do;
|
||||
%put ERROR: Syntax error in list of packages!;
|
||||
%put ERROR: Syntax error in the provided list of packages!;
|
||||
%put ERROR- %superq(packagesNames);
|
||||
%goto packagesListError;
|
||||
%end;
|
||||
@@ -255,17 +314,20 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%let vers=;
|
||||
%if %superq(versB) ne %then %let vers = &versB.;
|
||||
%if %superq(versA) ne %then %let vers = &versA.;
|
||||
%if -1 = &mirror %then /* ignore version when direct path is provided */
|
||||
%if %eval(-1 = &mirror) OR %eval(3 = &mirror) %then /* ignore version when direct path or PharmaForest is provided */
|
||||
%do;
|
||||
%let vers=;
|
||||
%end;
|
||||
%put ### &packageName.(&vers.) ###;
|
||||
|
||||
%put *** %lowcase(&packageName.) start *****************************************;
|
||||
%local in out _IOFileref_;
|
||||
data _null_; call symputX("_IOFileref_", put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
%put *** %sysfunc(lowcase(&packageName.)) start *****************************************;
|
||||
%local in out inMD outMD _IOFileref_;
|
||||
data _null_; call symputX("_IOFileref_", put(MD5(lowcase("&packageName.")), hex7. -L), "L"); run;
|
||||
%let in = i&_IOFileref_.;
|
||||
%let out = o&_IOFileref_.;
|
||||
%let inMD = j&_IOFileref_.;
|
||||
%let outMD = u&_IOFileref_.;
|
||||
|
||||
/* %let in = i%sysfunc(md5(&packageName.),hex7.); */
|
||||
/* %let out = o%sysfunc(md5(&packageName.),hex7.); */
|
||||
|
||||
@@ -275,37 +337,48 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
/* allows to install/download the framework file like any other package */
|
||||
%if %superq(mirror) in (0 1) AND (%superq(vers) ne) %then
|
||||
%do;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.sas;
|
||||
%let SPFinitMirror = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.sas;
|
||||
%let SPFinitMirrorMD = https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/&vers./SPF/SPFinit.md;
|
||||
%end;
|
||||
%if %superq(mirror) > 1 %then
|
||||
%put %str( )Mirror %superq(mirror) does not support versioning.;
|
||||
|
||||
filename &in URL
|
||||
/* source code file */
|
||||
filename &in. URL
|
||||
"&SPFinitMirror."
|
||||
recfm=N lrecl=1;
|
||||
filename &out
|
||||
filename &out.
|
||||
"&firstPackagesPath./SPFinit.sas"
|
||||
recfm=N lrecl=1;
|
||||
|
||||
/* documentation MD file */
|
||||
filename &inMD. URL
|
||||
"&SPFinitMirrorMD."
|
||||
recfm=N lrecl=1;
|
||||
filename &outMD.
|
||||
"&firstPackagesPath./SPFinit.md"
|
||||
recfm=N lrecl=1;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%if 0 = %superq(mirror) %then
|
||||
%if %superq(mirror) IN (0 3 4) %then /* SASPAC or PharmaForest or an arbitrary GitHub repo */
|
||||
%do;
|
||||
%let packageSubDir = %lowcase(&packageName.)/raw/main/;
|
||||
%let packageSubDir = %sysfunc(lowcase(&packageName.))/raw/main/;
|
||||
|
||||
%if %superq(vers) ne %then
|
||||
%do;
|
||||
/*%let packageSubDir = %lowcase(&packageName.)/main/hist/&version./;*/
|
||||
%let packageSubDir = %lowcase(&packageName.)/raw/&vers./;
|
||||
/*%let packageSubDir = %sysfunc(lowcase(&packageName.))/main/hist/&version./;*/
|
||||
%let packageSubDir = %sysfunc(lowcase(&packageName.))/raw/&vers./;
|
||||
%end;
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
%if %superq(mirror) > 0 %then
|
||||
%if %superq(mirror) NE 0 %then
|
||||
%put %str( )Mirror %superq(mirror) does not support versioning.;
|
||||
%end;
|
||||
|
||||
filename &in URL "&sourcePath.&packageSubDir.%lowcase(&packageName.).zip"
|
||||
/* zip */
|
||||
filename &in. URL "&sourcePath.&packageSubDir.%sysfunc(lowcase(&packageName.)).zip"
|
||||
%if (%superq(URLuser) ne ) %then
|
||||
%do;
|
||||
user = "&URLuser."
|
||||
@@ -313,7 +386,17 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%end;
|
||||
&URLoptions.
|
||||
recfm=N lrecl=1;
|
||||
filename &out "&firstPackagesPath./%lowcase(&packageName.).zip" recfm=N lrecl=1;
|
||||
filename &out. "&firstPackagesPath./%sysfunc(lowcase(&packageName.)).zip" recfm=N lrecl=1;
|
||||
/* markdown */
|
||||
filename &inMD. URL "&sourcePath.&packageSubDir.%sysfunc(lowcase(&packageName.)).md"
|
||||
%if (%superq(URLuser) ne ) %then
|
||||
%do;
|
||||
user = "&URLuser."
|
||||
pass = "&URLuser."
|
||||
%end;
|
||||
&URLoptions.
|
||||
recfm=N lrecl=1;
|
||||
filename &outMD. "&firstPackagesPath./%sysfunc(lowcase(&packageName.)).md" recfm=N lrecl=1;
|
||||
%end;
|
||||
/*
|
||||
filename in list;
|
||||
@@ -323,12 +406,21 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
%local installationRC;
|
||||
%let installationRC=1;
|
||||
data _null_;
|
||||
length filein 8 out_path in_path $ 4096;
|
||||
length filein fileinMD 8
|
||||
out_path in_path out_pathMD in_pathMD rcTXT $ 4096
|
||||
out_ref in_ref out_refMD in_refMD $ 8
|
||||
;
|
||||
out_path = pathname ("&out");
|
||||
in_path = pathname ("&in" );
|
||||
out_pathMD = pathname ("&outMD");
|
||||
in_pathMD = pathname ("&inMD" );
|
||||
out_ref = symget ("out");
|
||||
in_ref = symget ("in" );
|
||||
out_refMD = symget ("outMD");
|
||||
in_refMD = symget ("inMD" );
|
||||
rcTXT=' ';
|
||||
|
||||
|
||||
filein = fopen( "&in", 'S', 1, 'B');
|
||||
filein = fopen(in_ref, 'S', 1, 'B');
|
||||
if filein = 0 then
|
||||
put "ERROR: Source file:" /
|
||||
"ERROR- " in_path /
|
||||
@@ -348,21 +440,23 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
rc = FCLOSE(filein);
|
||||
put;
|
||||
|
||||
if FEXIST("&out") = 0 then
|
||||
if FEXIST(out_ref) = 0 then
|
||||
do;
|
||||
put @2 "Installing the &packageName. package"
|
||||
/ @2 "in the &firstPackagesPath. directory.";
|
||||
rc = FCOPY("&in", "&out");
|
||||
rc = FCOPY(in_ref, out_ref);
|
||||
rcTXT=sysmsg();
|
||||
end;
|
||||
else if FEXIST("&out") = 1 then
|
||||
else if FEXIST(out_ref) = 1 then
|
||||
do;
|
||||
if symgetn("replace")=1 then
|
||||
do;
|
||||
put @2 "The following file will be replaced during "
|
||||
/ @2 "installation of the &packageName. package: "
|
||||
/ @5 out_path;
|
||||
rc = FDELETE("&out");
|
||||
rc = FCOPY("&in", "&out");
|
||||
rc = FDELETE(out_ref);
|
||||
rc = FCOPY(in_ref, out_ref);
|
||||
rcTXT=sysmsg();
|
||||
end;
|
||||
else
|
||||
do;
|
||||
@@ -371,13 +465,41 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
rc = 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
put @2 "Done with return code " rc= "(zero = success)";
|
||||
put @2 "Done with return code " rc= "(zero = success)" / rcTXT;
|
||||
call symputX("installationRC", rc, "L");
|
||||
|
||||
/* try to install documentation file */
|
||||
if 1=symgetn("instDoc") then
|
||||
do;
|
||||
fileinMD = fopen(in_refMD, 'S', 1, 'B');
|
||||
rcMD = FCLOSE(fileinMD);
|
||||
|
||||
if fileinMD then
|
||||
do;
|
||||
if 0=FEXIST(out_refMD) then
|
||||
do;
|
||||
rcMD = FCOPY(in_refMD, out_refMD);
|
||||
if rcMD=0 then
|
||||
put @2 "Package documentation installed on request." ; /* / out_pathMD / in_pathMD; */
|
||||
end;
|
||||
else if 1=FEXIST(out_refMD) and 1=symgetn("replace") then
|
||||
do;
|
||||
rcMD = FDELETE(out_refMD);
|
||||
if rcMD=0 then
|
||||
rcMD2 = FCOPY(in_refMD, out_refMD);
|
||||
if rcMD=0 AND rcMD2=0 then
|
||||
put @2 "Package documentation installed on demand." ; /* / out_pathMD / in_pathMD; */
|
||||
end;
|
||||
end;
|
||||
else
|
||||
put @2 "Package documentation in markdown format not available." ; /* / out_pathMD / in_pathMD;*/
|
||||
end;
|
||||
run;
|
||||
|
||||
filename &in clear;
|
||||
filename &out clear;
|
||||
filename &in. clear;
|
||||
filename &out. clear;
|
||||
filename &inMD. clear;
|
||||
filename &outMD. clear;
|
||||
|
||||
%if 0 = &installationRC. %then
|
||||
%do;
|
||||
@@ -406,7 +528,7 @@ des = 'Macro to install SAS package, version 20241129. Run %%installPackage() fo
|
||||
)
|
||||
%put - Additional content loading - End -;
|
||||
%end;
|
||||
%put *** %lowcase(&packageName.) end *******************************************;
|
||||
%put *** %sysfunc(lowcase(&packageName.)) end *******************************************;
|
||||
/*-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-*/
|
||||
%end;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Macro to list SAS packages in packages folder.
|
||||
|
||||
Version 20241129
|
||||
Version 20251126
|
||||
|
||||
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 20241129.'
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20251126.'
|
||||
;
|
||||
%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 `20241129` #;
|
||||
%put # Macro to list available SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -57,6 +57,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
|
||||
%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 # #;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load SAS package, version 20241129. Run %loadPackage() for help info.'
|
||||
des = 'Macro to load SAS package, version 20251126. 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 `20241129` #;
|
||||
%put # Macro to *load* SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -120,6 +120,7 @@ minoperator
|
||||
%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 # #;
|
||||
@@ -178,8 +179,9 @@ minoperator
|
||||
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
@@ -189,7 +191,7 @@ minoperator
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).&zip."));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -225,7 +227,7 @@ minoperator
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
@@ -265,7 +267,7 @@ minoperator
|
||||
|
||||
options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
ENCODING =
|
||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||
%else utf8 ;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
is provided in required version */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load additional content for a SAS package, version 20241129. Run %loadPackageAddCnt() for help info.'
|
||||
des = 'Macro to load additional content for a SAS package, version 20251126. 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 `20241129` #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -75,6 +75,7 @@ minoperator
|
||||
%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 # #;
|
||||
@@ -115,10 +116,9 @@ minoperator
|
||||
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "A" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L");
|
||||
call symputX("_TargetFileref_", "T" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L");
|
||||
call symputX("_PackageFileref_", "A" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
call symputX("_TargetFileref_", "T" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
@@ -129,7 +129,7 @@ minoperator
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).&zip."));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -137,14 +137,14 @@ minoperator
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).&zip."
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip."
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* check existence of addcnt.zip inside package */
|
||||
"&path./%lowcase(&packageName.).&zip."
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip."
|
||||
member='addcnt.zip'
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
@@ -152,7 +152,7 @@ minoperator
|
||||
|
||||
/* get metadata */
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip."
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip."
|
||||
;
|
||||
%include &_PackageFileref_.(packagemetadata.sas) / &source2.;
|
||||
filename &_PackageFileref_. clear;
|
||||
@@ -191,7 +191,7 @@ minoperator
|
||||
|
||||
/*options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;*/
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip."
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip."
|
||||
member='addcnt.zip'
|
||||
;
|
||||
/*********************/
|
||||
@@ -199,10 +199,10 @@ minoperator
|
||||
%if %sysfunc(fexist(&_TargetFileref_.)) %then
|
||||
%do;
|
||||
|
||||
%if %sysfunc(fileexist(%sysfunc(pathname(&_TargetFileref_.))/%lowcase(&packageName.)_AdditionalContent)) %then
|
||||
%if %sysfunc(fileexist(%sysfunc(pathname(&_TargetFileref_.))/%sysfunc(lowcase(&packageName.))_AdditionalContent)) %then
|
||||
%do; /* dir for AC already exists */
|
||||
%put WARNING: Target location:;
|
||||
%put WARNING- %sysfunc(pathname(&_TargetFileref_.))/%lowcase(&packageName.)_AdditionalContent;
|
||||
%put WARNING- %sysfunc(pathname(&_TargetFileref_.))/%sysfunc(lowcase(&packageName.))_AdditionalContent;
|
||||
%put WARNING- already exist. Please remove it manually to upload additional contents.;
|
||||
%put WARNING- Additional Content will not be loaded.;
|
||||
%put WARNING- ;
|
||||
@@ -213,12 +213,12 @@ minoperator
|
||||
/* create target location */
|
||||
%put INFO:;
|
||||
%put Additional content will be located in:;
|
||||
%put %sysfunc(dcreate(%lowcase(&packageName.)_AdditionalContent,%sysfunc(pathname(&_TargetFileref_.))));
|
||||
%put %sysfunc(dcreate(%sysfunc(lowcase(&packageName.))_AdditionalContent,%sysfunc(pathname(&_TargetFileref_.))));
|
||||
|
||||
%if NOT (%sysfunc(fileexist(%sysfunc(pathname(&_TargetFileref_.))/%lowcase(&packageName.)_AdditionalContent))) %then
|
||||
%if NOT (%sysfunc(fileexist(%sysfunc(pathname(&_TargetFileref_.))/%sysfunc(lowcase(&packageName.))_AdditionalContent))) %then
|
||||
%do; /* dir for AC cannot be generated */
|
||||
%put ERROR: Cannot create target location:;
|
||||
%put ERROR- %sysfunc(pathname(&_TargetFileref_.))/%lowcase(&packageName.)_AdditionalContent;
|
||||
%put ERROR- %sysfunc(pathname(&_TargetFileref_.))/%sysfunc(lowcase(&packageName.))_AdditionalContent;
|
||||
%put ERROR- Additional Content will not be loaded.;
|
||||
%put ERROR- ;
|
||||
%end;
|
||||
@@ -237,7 +237,7 @@ minoperator
|
||||
|
||||
if fexist("in") then
|
||||
do;
|
||||
rc2=filename("out", pathname("WORK")!!"/%lowcase(&packageName.)addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
rc2=filename("out", pathname("WORK")!!"/%sysfunc(lowcase(&packageName.))addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
@@ -266,9 +266,9 @@ minoperator
|
||||
%if &AdditionalContent. %then
|
||||
%do;
|
||||
filename f DUMMY;
|
||||
filename f ZIP "%sysfunc(pathname(WORK))/%lowcase(&packageName.)addcnt.zip";
|
||||
filename f ZIP "%sysfunc(pathname(WORK))/%sysfunc(lowcase(&packageName.))addcnt.zip";
|
||||
options dlCreateDir;
|
||||
libname outData "%sysfunc(pathname(&_TargetFileref_.))/%lowcase(&packageName.)_AdditionalContent";
|
||||
libname outData "%sysfunc(pathname(&_TargetFileref_.))/%sysfunc(lowcase(&packageName.))_AdditionalContent";
|
||||
|
||||
data WORK.__&_TargetFileref_._zip___;
|
||||
did = dopen("f");
|
||||
@@ -291,6 +291,8 @@ minoperator
|
||||
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;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20241129. Run %loadPackages() for help info.'
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20251126. 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 `20241129` #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -52,6 +52,7 @@ parmbuff
|
||||
%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 # #;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to preview content of a SAS package, version 20241129. Run %previewPackage() for help info.'
|
||||
des = 'Macro to preview content of a SAS package, version 20251126. 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 20241129. Run %preview
|
||||
%put ### This is short help information for the `previewPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get preview of a SAS packages, version `20241129` #;
|
||||
%put # Macro to get preview of a SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -82,6 +82,7 @@ des = 'Macro to preview content of a SAS package, version 20241129. Run %preview
|
||||
%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 # #;
|
||||
@@ -117,8 +118,9 @@ des = 'Macro to preview content of a SAS package, version 20241129. Run %preview
|
||||
options NOnotes NOsource ls=MAX ps=MAX msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
@@ -128,7 +130,7 @@ des = 'Macro to preview content of a SAS package, version 20241129. Run %preview
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).&zip."));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -136,7 +138,7 @@ des = 'Macro to preview content of a SAS package, version 20241129. Run %preview
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
@@ -144,7 +146,7 @@ des = 'Macro to preview content of a SAS package, version 20241129. Run %preview
|
||||
filename &_PackageFileref_. clear;
|
||||
options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
ENCODING =
|
||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||
%else utf8 ;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
,nobs=0 /* technical parameter */
|
||||
)
|
||||
/*** HELP START ***/
|
||||
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20241129. Run %splitCodeForPackage() for help info.'
|
||||
/ des = 'Utility macro to split "one big" code into multiple files for a SAS package, version 20251126. Run %splitCodeForPackage() for help info.'
|
||||
;
|
||||
/*%macro _();%mend _;*/
|
||||
%if (%superq(codeFile) = ) OR (%qupcase(&codeFile.) = HELP) %then
|
||||
@@ -25,7 +25,7 @@
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Utility macro to *split* single file with SAS package code into multiple #;
|
||||
%put # files with separate snippets, version `20241129` #;
|
||||
%put # files with separate snippets, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -60,6 +60,7 @@
|
||||
%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 # #;
|
||||
@@ -106,7 +107,6 @@
|
||||
%GOTO ENDofsplitCodeForPackage;
|
||||
%end;
|
||||
|
||||
|
||||
%local options_tmp2 ;
|
||||
%let options_tmp2 = ls=%sysfunc(getoption(ls)) ps=%sysfunc(getoption(ps))
|
||||
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
|
||||
@@ -172,7 +172,6 @@ options nomprint nosymbolgen nomlogic notes source ls=MAX ps=MAX msglevel=N ;
|
||||
call symputX('packagePath',packagePath,"L");
|
||||
run;
|
||||
|
||||
|
||||
data w.files;
|
||||
stop;
|
||||
run;
|
||||
@@ -198,7 +197,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-##$##'
|
||||
);
|
||||
@@ -402,7 +401,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 20241129. */';
|
||||
put '/* File generated with help of SAS Packages Framework, version 20251126. */';
|
||||
firstLine[j]=0;
|
||||
end;
|
||||
put _infile_;
|
||||
@@ -418,5 +417,4 @@ options &options_tmp2.;
|
||||
%ENDofsplitCodeForPackage:
|
||||
%mend splitCodeForPackage;
|
||||
|
||||
|
||||
/**/
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for help info.'
|
||||
des = 'Macro to unload SAS package, version 20251126. 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 20241129. Run %unloadPackage() for h
|
||||
%put ### This is short help information for the `unloadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to unload SAS packages, version `20241129` #;
|
||||
%put # Macro to unload SAS packages, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -75,6 +75,7 @@ des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for h
|
||||
%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 # #;
|
||||
@@ -113,8 +114,9 @@ des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for h
|
||||
options NOnotes NOsource ls=MAX ps=MAX msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
@@ -124,7 +126,7 @@ des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for h
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).&zip."));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! ".&zip."));
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -132,7 +134,7 @@ des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for h
|
||||
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
@@ -140,7 +142,7 @@ des = 'Macro to unload SAS package, version 20241129. Run %unloadPackage() for h
|
||||
filename &_PackageFileref_. clear;
|
||||
options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
filename &_PackageFileref_. &ZIP.
|
||||
"&path./%lowcase(&packageName.).&zip." %unquote(&options.)
|
||||
"&path./%sysfunc(lowcase(&packageName.)).&zip." %unquote(&options.)
|
||||
ENCODING =
|
||||
%if %bquote(&packageEncoding.) NE %then &packageEncoding. ;
|
||||
%else utf8 ;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
hashing_file() function, SAS 9.4M6 */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20241129. Run %verifyPackage() for help info.'
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20251126. 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 20241129. Run %
|
||||
%put ### This is short help information for the `verifyPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20241129` #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20251126` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -58,6 +58,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20241129. Run %
|
||||
%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 # #;
|
||||
@@ -96,8 +97,9 @@ des = 'Macro to verify SAS package with the hash digest, version 20241129. Run %
|
||||
options NOnotes NOsource ls=MAX ps=MAX NOfullstimer NOstimer msglevel=N NOmautocomploc;
|
||||
|
||||
%local _PackageFileref_;
|
||||
/* %let _PackageFileref_ = P%sysfunc(MD5(%lowcase(&packageName.)),hex7.); */
|
||||
data _null_; call symputX("_PackageFileref_", "P" !! put(MD5("%lowcase(&packageName.)"), hex7. -L), "L"); run;
|
||||
data _null_;
|
||||
call symputX("_PackageFileref_", "P" !! put(MD5(lowcase("&packageName.")), hex7. -L), "L");
|
||||
run;
|
||||
|
||||
/* when the packages reference is multi-directory search for the first one containing the package */
|
||||
data _null_;
|
||||
@@ -107,7 +109,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20241129. Run %
|
||||
if char(packages,1) ^= "(" then packages = quote(strip(packages)); /* for paths with spaces */
|
||||
do i = 1 to kcountw(packages, "()", "QS");
|
||||
p = dequote(kscanx(packages, i, "()", "QS"));
|
||||
exists + fileexist(catx("/", p, "%lowcase(&packageName.).zip"));
|
||||
exists + fileexist(catx("/", p, lowcase("&packageName.") !! "zip")); /* check on zip files only! */
|
||||
if exists then leave;
|
||||
end;
|
||||
if exists then call symputx("path", p, "L");
|
||||
@@ -115,7 +117,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20241129. Run %
|
||||
|
||||
filename &_PackageFileref_.
|
||||
/* put location of package myPackageFile.zip here */
|
||||
"&path./%lowcase(&packageName.).zip"
|
||||
"&path./%sysfunc(lowcase(&packageName.)).zip"
|
||||
;
|
||||
%if %sysfunc(fexist(&_PackageFileref_.)) %then
|
||||
%do;
|
||||
|
||||
1359
SPF/SPFinit.md
1359
SPF/SPFinit.md
File diff suppressed because it is too large
Load Diff
1009
SPF/SPFinit.sas
1009
SPF/SPFinit.sas
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2019 - 2024 Bartosz Jablonski
|
||||
Copyright (c) 2019 - 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
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 ¬V7compliant.;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**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.
@@ -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.
Reference in New Issue
Block a user