Skip to content

yabwon/SAS_PACKAGES

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAS_PACKAGES - a 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.

Don't forget to STAR (:star:) the repository! :-)


Current version:

The latest version of SPF is 20240529.

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

Recordings and Presentations:

Videos presenting the SPF and packages, from various conferences and meetups (the newer the better):

Tutorials:

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 explaining the idea.

  2. (D) Very simple "Hello World" example tutorial for developers. As a support a walk-through video

  3. (D) Article and all required materials for "My first SAS Package" tutorial.

  4. (DU) Materials from Hands-on-Workshop (4+ hours) tutorial: Share your code with 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 and up vote the idea!


The User:

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.

Then either:

  • Manually download the SPFinit.sas file (the SAS Packages Framework) into the local packages folder.
  • [Optional] Manually download the <packageName>.zip file into the local packages folder.
  • and Execute:
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 WORK as temporary directory for packages */
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */

%installPackage(packageName) /* install a package */
%helpPackage(packageName)    /* get help about the package */
%loadPackage(packageName)    /* load the package content into the SAS session */

or do it pragmatically:

  • Enable the framework [first time only]:
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */

or (shorter) with:

filename SPFinit url "https://bit.ly/SPFinit";
%include SPFinit; /* enable the framework */
  • Install the framework on your machine in the folder you created:
filename packages "<directory/containing/packages/>"; 
%installPackage(SPFinit) /* install the framework */
  • From now on run it like this:
filename packages "<directory/containing/packages/>";
%include packages(SPFinit.sas);

%installPackage(packageName) /* install a package */
%helpPackage(packageName)    /* get help about the package */
%loadPackage(packageName)    /* load the package content into the SAS session */

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. (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")

Workshop video for the User [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]


The Developer:

To create your own package:

The SAS Packages Framework (short) documentation to quickly see macros options and parameters.


If you have any questions, suggestions, or ideas do not hesitate to contact me!


Updates worth mentioning:

Update[December 10th, 2023]: markdownDoc= parameter added to %generatePackage() macro, which allows to generate markdown file with documentation. Content is taken from the help information notes and the description. (see here).

Update[November 11th, 2023]: KMFSNIP type for key macro abbreviations snippets added to the framework. (see here).

Update[February 7th, 2023]: ADDCNT **type for additional content feature and ** %loadPackageAddCnt() macro added to the framework. (see here).

Update[December 12th, 2022]: CASLUDF type for CASL user defined functions added to the framework. Utility macros for for loading content in proc IML and proc CAS added. (see here).

Update[November 21st, 2022]: %loadPackage() macro allows Cherry Picking of content (see here).

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 (:star:) so more people will know.


SPF_sticker


Available packages:

This section presents some examples of available SAS packages.

(!) Since September 2022 the default and official 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.

(!) For "backward compatibility"/historical point of view the following packages are also available under the ./packages directory in this repository.

Packages: