7.5.0 • Published 4 years ago

macrocore v7.5.0

Weekly downloads
58
License
MIT
Repository
github
Last release
4 years ago

Macro Core

Much quality. Many standards. The Macro Core library exists to save time and development effort! Herein ye shall find a veritable host of MIT-licenced, production quality SAS macros. These are a mix of tools, utilities, functions and code generators that are useful in the context of Application Development on the SAS platform (eg https://datacontroller.io). Contributions are welcomed.

You can download and compile them all in just two lines of SAS code:

filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas";
%inc mc;

Documentation: https://macropeople.github.io/macrocore.github.io/files.html

Components

base library (SAS9/Viya)

  • OS independent
  • Not metadata aware
  • No X command
  • Prefixes: mf, mp

meta library (SAS9 only)

  • OS independent
  • Metadata aware
  • No X command
  • Prefixes: mm

viya library (Viya only)

  • OS independent
  • No X command
  • Prefixes: mv

metax library (SAS9 only)

  • OS specific
  • Metadata aware
  • X command enabled
  • Prefixes: mmw,mmu,mmx

Installation

First, download the repo to a location your SAS system can access. Then update your sasautos path to include the components you wish to have available,eg:

options insert=(sasautos="/your/path/macrocore/base");
options insert=(sasautos="/your/path/macrocore/meta");

The above can be done directly in your sas program, via an autoexec, or an initialisation program.

Alternatively - for quick access - simply run the following! This file contains all the macros.

filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas";
%inc mc;

Standards

File Properties

  • filenames much match macro names
  • filenames must be lowercase
  • macro names must be lowercase
  • one macro per file
  • prefixes:
    • mf for macro functions (can be used in open code).
    • mp for macro procedures (which generate sas code)
    • mm for metadata macros (interface with the metadata server).
    • mmx for macros that use metadata and are XCMD enabled
    • mx for macros that are XCMD enabled
    • mv for macros that will only work in Viya
  • follow verb-noun convention
  • unix style line endings (lf)
  • individual lines should be no more than 80 characters long
  • UTF-8
  • no trailing white space

Header Properties

The Macro Core documentation is created using doxygen. A full list of attributes can be found here but the following are most relevant:

  • file. This needs to be present in order to be recognised by doxygen.
  • brief. This is a short (one sentence) description of the macro.
  • details. A longer description, which can contain doxygen markdown.
  • param. Name of each input param followed by a description.
  • return. Explanation of what is returned by the macro.
  • version. The EARLIEST SAS version in which this macro is known to work.
  • author. Author name, contact details optional

All macros must be commented in the doxygen format, to enable the online documentation.

Coding Standards

  • Indentation = 2 spaces. No tabs!
  • Macro variables should not have the trailing dot (&var not &var.) unless necessary to prevent incorrect resolution
  • The closing %mend; should not contain the macro name.
  • All macros should be defined with brackets, even if no variables are needed - ie %macro x(); not %macro x;
  • Mandatory parameters should be positional, all optional parameters should be keyword (var=) style.
  • All dataset references must be 2 level (eg work.blah, not blah). This is to avoid contention when options DATASTMTCHK=ALLKEYWORDS is in effect.
  • Avoid naming collisions! All macro variables should be local scope. Use system generated work tables where possible - eg data ; set sashelp.class; run; data &output; set &syslast; run;

General Notes

  • All macros should be compatible with SAS versions from support level B and above (so currently 9.2 and later). If an earlier version is not supported, then the macro should say as such in the header documentation, and exit gracefully (eg %if %sysevalf(&sysver<9.3) %then %return).
7.5.0

4 years ago

7.4.3

4 years ago

7.4.2

4 years ago

7.4.1

4 years ago

7.4.0

4 years ago

7.3.0

4 years ago

7.2.0

4 years ago

7.1.5

4 years ago

7.1.4

4 years ago

7.1.3

4 years ago

7.1.2

4 years ago

7.1.1

4 years ago

7.0.2

4 years ago

7.1.0

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

6.3.0

4 years ago

6.4.0

4 years ago

6.2.0

4 years ago

6.1.2

4 years ago

6.1.1

4 years ago

6.1.4

4 years ago

6.1.3

4 years ago

6.1.5

4 years ago

6.1.0

4 years ago

5.18.1

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.19.0

4 years ago

5.18.0

4 years ago

5.17.3

4 years ago

5.17.2

4 years ago

5.17.1

4 years ago

5.17.0

4 years ago

5.16.2

4 years ago

5.16.1

4 years ago

5.16.0

4 years ago

5.15.0

4 years ago

5.14.0

4 years ago

5.13.0

4 years ago

5.11.0

4 years ago

5.12.0

4 years ago

5.10.0

4 years ago

5.9.1

4 years ago

5.9.0

4 years ago

5.8.2

4 years ago

5.8.1

4 years ago

5.8.0

4 years ago

5.7.4

4 years ago

5.7.3

4 years ago

5.7.2

4 years ago

5.5.0

4 years ago

5.6.0

4 years ago

5.7.1

4 years ago

5.7.0

4 years ago

5.4.0

4 years ago

5.3.2

4 years ago

5.3.1

4 years ago

5.3.0

4 years ago

5.2.4

4 years ago

5.2.3

4 years ago

5.2.2

4 years ago

5.2.1

4 years ago

5.2.0

4 years ago

5.1.0

4 years ago

4.6.1

4 years ago

4.6.0

4 years ago

5.0.3

4 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.6.3

4 years ago

4.6.2

4 years ago

4.6.4

4 years ago

4.7.0

4 years ago

4.5.1

4 years ago

4.5.0

4 years ago

4.4.0

4 years ago

4.3.0

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.2

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.3.2

4 years ago

2.3.3

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.0

4 years ago