DevOps with SASjs

Allan Bowe

The SASjs approach

Why Choose SASjs?

  • Open Source (MIT)
  • Cross Platform (Base SAS, SAS 9, Viya)
  • Active Development & Support

Why Use SASjs?

  • Git-Native SAS Projects
    • compile & build locally
    • deploy & execute remotely
  • Self-Documenting
  • Test Driven Development

Where to use SASjs?

  • VS Code / local IDE
  • Jenkins / scheduling systems
  • Bitbucket / Gitlab Pipelines, Github Actions
  • GIT Hooks
  • Web Apps
  • Data Engineering / Data Science projects

SASjs Framework

SASjs Core

  • ~170 macros geared towards Application Development
  • Functions, Procedures, Metadata, Viya, Lua, FCMP
  • npm install @sasjs/core

SASjs Adapter

  • Authentication
  • Bidirectional communication with SAS
  • npm install @sasjs/adapter

SASjs CLI

  • Opinionated Project Setup
  • DevOps, Documentation & Testing
  • npm install --global @sasjs/cli

SASjs SAS Files

  • Primary (deployed)
    • Jobs
    • Services
    • Tests
  • Supporting (compiled into Primary)
    • Macros
    • Includes

SASjs Lingo

  • AppLoc
    • "App Location"
    • Root folder in SAS Drive or Metadata
  • Target
    • "The place you deploy your app"
    • encompasses ALL attributes, eg serverUrl, appLoc, serverType

sasjs create

  • Prepare a SAS project with an opinionated structure
  • Structure is documented within sasjsconfig.json
  • Templates:
    • sasjs create myapp -t jobs
    • sasjs create myapp -t minimal
    • sasjs create myapp -t react
    • sasjs create myapp -t angular

Project Structure

sasjs add

  • Define a Target
  • Client / Secret
  • App Location (appLoc)

sasjs run

  • sasjs run code.sas

sasjs doc

Data Lineage

Doxygen Headers

sasjsconfig.json

  • Project configuration
    • docConfig
    • testConfig
    • jobConfig
    • deployConfig
    • macroFolders
    • ...
  • root / target level

sasjs compile

  • One file per Job / Service / Test
  • Init + Term programs
  • Macro Variables

sasjsbuild directory

sasjs build

  • Many files to 1 (or 2)
    • SAS program (SAS 9 + Viya)
      • Generated by default
    • JSON file (Viya only)
      • if deployServicePack:true

sasjs deploy

  • Loads JSON if deployServicePack:true and serverType:"SASVIYA
  • Executes deployScripts:
    • SAS Programs remotely
    • Everything else, locally
  • Compile, build & deploy in one step: sasjs cbd

Execution

Command Description
job Manage & Execute SAS Jobs
flow SAS job scheduler that takes a JSON file as input, and submit all the jobs sequentially, logging the results to an output CSV file
request Execute SASjs web services from the commandline
test Execute SAS unit tests and collect results in json/csv formats together with logs

sasjs test

  • filename.test[.integer].sas
  • Coverage shown on sasjs compile
  • Execute all with sasjs test
  • Execute some with sasjs test someFilterString
  • Assertion macros in @sasjs/core
  • Click URL to re-run a single test
  • Supported output formats: CSV, JSON, XML

sasjs lint

  • Catch common coding issues
  • Add as git pre-commit hook
  • Use in VS Code extension

Sample DevOps Workflow

  • git clone / git checkout -b branchname
  • make changes
  • sasjs cbd -t myPersonalTarget
  • sasjs test
  • git add / git commit - sasjs lint runs automatically
  • git push - backend pipeline builds & runs tests
  • PR is reviewed & merged. Backend pipeline deploys and generates docs.
    • sasjs cbd -t sharedTarget && sasjs doc

Other commands

Command Description
context List, export, create, edit, and delete SAS Compute contexts
folder Management of logical SAS folders
servicepack The SASjs Service Pack is a collection of services and folder objects. The servicepack command lets you deploy them easily

Coming Soon

  • CLI support for remote commands on SAS 9
    • sasjs run / deploy / job execute / request / test
  • Desktop (Base) SAS support for web apps

Products & Services

  • Data Controller for SAS
  • SAS 9 Health
  • Zabbix Performance Monitoring
  • SAS 9 API
  • Bespoke App Development
  • SASjs Framework Support & Extensions

Allan Bowe, Head of SAS Apps