Bart Jablonski (yabwon) 9dedc53c31 **SAS Packages Framework**, version 20211216
**SAS Packages Framework**, version 20211216

- Bug fix in the `%verifyPackage()` macro
2021-12-16 10:36:08 +01:00
2021-12-02 08:54:39 +01:00
2019-10-13 10:50:44 +02:00
2019-11-26 12:14:17 +01:00

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 20211111.

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):


The User:

To use a package:

  • Create a folder for your packages, under Windows OS family, e.g. C:/SAS_PACKAGES or under Linux/UNIX OS family, e.g. /home/<username>/SAS_PACKAGES.

and then either:

  • 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 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:


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


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. If you want to share that you are using SPF let me know and I'll update the list.

The List:

  • Europe
    • Poland
      • Warsaw

Available packages:

Currently the following packages are available (see the ./packages directory):

  • SQLinDS[2.2], based on Mike Rhoads' article Use the Full Power of SAS in Your Function-Style Macros. The package allows to write SQL queries in the data step, e.g.
  data class;
    set %SQL(select * from sashelp.class order by age);
  run;

SHA256 digest for SQLinDS: F2BE3CC68C9A34DD324FD35C8287A4F89737E2E28E806E0DD7FB0EBF60F7C569

Documentation for SQLinDS

  • 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

Documentation for MacroCore

  • DFA (Dynamic Function Arrays)[0.5], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run %helpPackage(DFA,createDFArray) to find examples.

SHA256 digest for DFA: C32A81304A411C1EB6BA7B76EDB8D70550F3935F35A1506E2B8019A2036FB5FF

Documentation for DFA

  • macroArray[0.8], 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: 9FE227EF3144431B51063D599148BDD8873509D1B32F1AC2979EC566E1BB1487

Documentation for macroArray

  • BasePlus[1.12] 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: 105F0CEB95C49102BDB085DF67C785301F623CB337D466F07B5E051626E4AE61

Documentation for BasePlus

  • GSM (Generate Secure Macros)[0.17], 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: F6EE77A3C042E1E083E970BE255D126B52A75205DC1FB9A4A7337D0A89EEC7EB

Documentation for GSM

  • dynMacroArray[0.2], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)

SHA256 digest for dynMacroArray: 9FE227EF3144431B51063D599148BDD8873509D1B32F1AC2979EC566E1BB1487

======

Description
[PRODUCTION READY] - SAS Packages Framework and Repository
Readme MIT 65 MiB
Languages
SAS 100%