Macro Core¶
The runtime half of the framework: about 200 SAS macros for building applications, plus the plumbing the rest of SASjs depends on. It is a normal SASAUTOS library - usable on its own, without the CLI, the adapter or anything else.
/* the whole library, in one file, without touching the server */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;
/* or from npm, at a version you pin */
/* npm install @sasjs/core --save-dev */
What is in it¶
| Folder | What it covers |
|---|---|
base/ |
the general library: JSON and CSV output (mp_jsonout), table transfer, file and folder operations, error handling (mf_abort), hashing, encoding, dates and strings |
meta/ |
SAS 9 metadata: users, groups, libraries, folders, stored processes, and the web service plumbing |
metax/ |
metadata helpers built on the metadata data step functions (mmx_) |
fcmp/ |
functions for use inside proc fcmp (mcf_) |
ddl/ |
table DDL generation (mddl_) |
Naming is by prefix: mf_ for functions, mp_ for programs and output, mm_ for metadata, mmx_ for the metadata data step functions, mcf_ for proc fcmp functions, mddl_ for DDL.
Why it matters to the framework¶
sasjs compile embeds the macros a service uses into the compiled program. That is what makes a deployed service independent of SASAUTOS on the server and of the server's file system - the program that runs in production carries its own dependencies, at the version that was reviewed.
%webout(), which every service and test uses to return data, is generated by the compiler from this library.
Using it directly¶
The library is useful without the CLI:
%inc "path/to/core/all.sas";
%mf_abort(iftrue=(&syscc ne 0), msg=Something went wrong upstream)
%mp_jsonout(OPEN, jref=_webout)
%mp_jsonout(OBJ, work.results)
%mp_jsonout(CLOSE, jref=_webout)
Every macro carries a doxygen header with its parameters and an example, and the documentation site is generated from those headers.
Where to go next¶
- Documentation - every macro, generated from its header.
- Source and releases, and
@sasjs/coreon npm. - Services - the macros in the context they are normally used.