20221002
**SAS Packages Framework**, version `20221002` - Modifications in the `%installPackage()` macro it is allowed to call installation of packages with version number (if used with `mirror=0`), for example: `%installPackage(baseplus(1.17) macroarray(1.0) dfa(0.5) GSM)`, - For the `%installPackage()` and in the `%loadPackageS()` macros the list of packages standardised before execution to the form `package1(ver1) package2(ver2) package3(ver3)`, - Fix for directories "with spaces" for `%installPackage()`. - Documentation updated.
SAS_PACKAGES - a SAS Packages Framework and Repository
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. The latest version of SPF is 20221002.
To get started with SAS Packages try this 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 article (see the ./SPF/Documentation directory).
Short description of the SAS Packages Framework macros can be found here
Videos (the newer the better):
- SAS Global Forum 2020 V.E. (April 2020)
- Sasensei International Dojo (April 2020)
- SAS dla Administratorów i Praktyków 2020 (October 2020, in Polish)
- Boston Area SAS Users Group webinar (November 2020)
- SAS Global Forum 2021 V.E. (May 20th, 2021)
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 and up vote the idea!
The User:
To use a package:
- Create a folder for your packages, under Windows OS family, e.g.
C:/SAS_PACKAGESor under Linux/UNIX OS family, e.g./home/<username>/SAS_PACKAGES.
and then either:
- Download the
SPFinit.sasfile (the SAS Packages Framework) into the local packages folder. - [Optional] Manually download the
<packageName>.zipfile into the local packages folder. - and Execute:
filename packages "<directory/containing/packages/>"; /* setup directory for packages */
%include packages(SPFinit.sas); /* enable the framework */
/* %installPackage(packageName) */ /* install the package, unless you downloaded it manually */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
or if you need it just for "one time" only Execute:
filename packages "%sysfunc(pathname(work))"; /* setup temporary directory for packages in the WORK */
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */
%installPackage(packageName) /* install the package */
%helpPackage(packageName) /* get help about the package */
%loadPackage(packageName) /* load the package content into the SAS session */
Workshop video for the User [May 6th, 2020] [a bit outdated but gives the idea how it works]
The Developer:
To create your own package:
- Read the
SAS Packages - The Way to Share (a How-To) - Paper 4725-2020 - extended versionarticle to learn more details. - Read the
My First SAS Package: A How-To - Paper 1079-2021article available at communities.sas.comhereor locallyhere - Download and use the
SPFinit.sasfile (the SAS Packages Framework), the part of the framework required for testing is there too.
If you have any questions, suggestions, or ideas do not hesitate to contact me!
Update[September 30th, 2022]: New dedicated repository: SASPAC - the SAS Packages Archive is available as new location for packages storage. Location of SASPAC is: https://github.com/SASPAC
Update[November 11th, 2021]: %extendPackagesFileref() macro is available.
Update[October 15th, 2020]: %previewPackage() macro is available.
Update[September 11th, 2020]: %loadPackageS() and %verifyPackage() macros are available.
Update[July 30th, 2020]: All components of SAS Packages Framework are now in one file SPFinit.sas (located in the ./SPF directory). Documentation moved to ./SPF/Documentation directory. Packages zip files moved to ./packages directory.
Update[June 10th, 2020]: To see help info about framework macros and their parameters just run: %generatePackage(), %installPackage(), %helpPackage(), %loadPackage(), and %unloadPackage() with empty parameter list.
Update[June 3rd, 2020]: %installPackage() macro is available. The %installPackage() macro is embedded in the loadpackage.sas part of the framework.
Where the SAS Packages Framework is used:
This is a list of locations where the SAS Packages Framework is used:
- Warsaw (Poland)
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 so more people will know.
Available packages:
For "backward compatibility"/historical point of view the following packages are available under the ./packages directory.
Since September 2022 the default location for packages is SASPAC - the SAS Packages Archive located under: https://github.com/SASPAC where each package is stored as a separate repository with historical versions too.
Packages:
- SQLinDS[2.2], based on Mike Rhoads' article Use the Full Power of SAS in Your Function-Style Macros. The package allows to write SQL queries in the data step, e.g.
data class;
set %SQL(select * from sashelp.class order by age);
run;
SHA256 digest for SQLinDS: 96D0EFE02DF1AE0D7D875A10CAF7EF63CDEF85DD0CF9418934BEFAF0C067D453
- MacroCore[1], a macro library for SAS application developers. Over 100 macros for Base SAS, metadata, and Viya. Provided by the SASjs framework.
SHA256 digest for MacroCore: A23C29529F3CE7D0C8BEE9545C5D22D5B5594907547374A5135B8E5A48D7687B
- DFA (Dynamic Function Arrays)[0.5], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run
%helpPackage(DFA,createDFArray)to find examples.
SHA256 digest for DFA: 5BFFCE78439E1CDDCBB15C95CD287AA4195BF64BB17DDB8FE374EC3535B4F491
- macroArray[1.0], implementation of an array concept in a macrolanguage, e.g.
%array(ABC[17] (111:127), macarray=Y);
%macro test();
%do i = 1 %to 17;
%put &i.) %ABC(&i.);
%end;
%mend;
%test()
%let %ABC(13,i) = 99999; /* i = insert */
%do_over(ABC, phrase=%nrstr(
%put &_i_.%) %ABC(&_i_.);
),
which = 1:H:2
);
SHA256 digest for macroArray: ED12BC96F8A4E9E7C4D651EC1E15479DB9B55D98B274B63C507ED842081F7AB7
- BasePlus[1.17] adds a bunch of functionalities I am missing in BASE SAS, such as:
call arrMissToRight(myArray);
call arrFillMiss(17, myArray);
call arrFill(42, myArray);
rc = delDataset("DataSetToDrop");
string = catXFn("date9.", "#", myArray);
format x bool.;
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
%rainCloudPlot(sashelp.cars,DriveTrain,Invoice)
%zipLibrary(sashelp,libOut=work)
SHA256 digest for BasePlus: 56B260350FEB7D5118F581B9EFD1B9CE1F0298DCB9A4C000A7654E2FF3F0298C
- GSM (Generate Secure Macros)[0.20], package allows to create secured macros stored in SAS Proc FCMP functions. The dataset with functions can be shared between different operating systems and allows to generate macros on site without showing their code.
SHA256 digest for GSM: 2AEBC150FBA99A4AAB0265A21C57E89200BFD96B633B898F32743D1C8831A159
- dynMacroArray[0.2], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA). Development of this package is currently on hold.
SHA256 digest for dynMacroArray: D7E0B8F85C05EBF8622204E0D2F3E990D48D0A9B3911051C3AD44DC98954DDCF