Skip to content

Build SAS like you build everything else

One command line tool for the whole lifecycle of a SAS project: scaffold it, compile every dependency into each service, build a deployable artefact, deploy it to Viya, SAS 9 or SASjs Server, and test and document what you shipped.

npm i -g @sasjs/cli
  • Start a project


    Scaffold from a template, or add the SASjs tooling to code that already exists.

    sasjs create - sasjs init

  • Connect a target


    Point the CLI at a SAS environment once, locally or in your home directory, and every command can use it.

    sasjs add - sasjs auth

  • Ship it


    Compile, build and deploy in one step. The artefact is portable between Viya, SAS 9 and SASjs Server.

    sasjs cbd - how artefacts work

  • Test and document


    Run SAS unit tests with coverage, and generate a Doxygen site with data lineage from the same headers.

    sasjs test - sasjs doc

Commands

Every command has a page, and the same list is printed by sasjs help.

Command Alias What it does
sasjs add Prompts for the connection details of a SAS target and saves them; sasjs add cred adds credentials to an existing target
sasjs auth Obtains an access token for a target - client/secret (sasjs auth), or SAS username and password (sasjs auth login)
sasjs bd Runs build and then deploy, without recompiling first
sasjs build b Collates the compiled jobs, services and tests into a deployable build pack
sasjs cb Runs compile and then build
sasjs cbd Runs compile, build and then deploy
sasjs compile c Inlines all dependencies into a self-contained program per job, service and test
sasjs context Lists, exports, creates, edits and deletes SAS Viya compute contexts
sasjs create Scaffolds a SASjs project from a template
sasjs db Concatenates the .ddl and .sas files under sasjs/db into one file per database
sasjs deploy d Deploys the built artefact to the target's SAS environment
sasjs doc docs Generates the Doxygen documentation site, or the data lineage
sasjs flow Executes a flow (a JSON list of jobs) in order, logging the results to CSV
sasjs folder Creates, deletes, lists and moves SAS Viya folders
sasjs fs Synchronises files with a remote SAS directory (compile, sync, deploy)
sasjs help h Prints the available commands
sasjs init Adds SASjs to an existing project - config, doxygen templates, lint config and @sasjs/core
sasjs job Executes a SAS job on the target, with options for waiting, logging and streaming
sasjs lint Lints your SAS code and reports problems, or fixes them
sasjs request rq Calls a SASjs web service from the commandline
sasjs run r Runs an arbitrary SAS file (local path or URL) on the target
sasjs servicepack Deploys a service pack - a JSON collection of folders and services
sasjs snippets Generates a VS Code snippets file from the macro Doxygen headers
sasjs test Runs SAS unit tests and collects results, logs and coverage
sasjs version v Prints the installed version of the CLI
sasjs web w Builds the streaming web app services from the target's webSourcePath

Concepts

Page Covers
Artefacts Jobs, services and tests - what each file type is, and how it is compiled
SASjs Config File The sasjs/sasjsconfig.json settings, at root and target level
ENV File .env and .env.<target> variables such as ACCESS_TOKEN and VERBOSE
SASjs Runner The SAS 9 runner, which SAS 9 deployments need in metadata
FAQ Common questions and error messages