Skip to content

Feature Request: Support configurable *preamble* code for all submissions (Run Selected / Run All SAS Code) #1652

@dingdayu

Description

@dingdayu

Is your feature request related to a problem? Please describe.

Description:
Currently, the SAS Extension for VS Code allows users to submit code to SAS Viya (Compute server). However, there is no way to automatically prepend a block of SAS code (a preamble) every time a user runs Run Selected or All SAS Code / Run All SAS Code.

This feature exists in other language extensions (e.g. R, Stata, Python) as “Submit Before Text” or similar, and it is very useful for:

  • Defining session-specific macro variables.
  • Passing local file context (e.g., project path, filename) from VS Code to the SAS runtime.
  • Ensuring a consistent environment for all scripts without requiring manual copy-paste or editing autoexec.sas.

Describe the solution you'd like

Add a new user setting, for example:

"sas.submitBeforeText": [
  "%let _LOCAL_FILE=%nrstr(${file});",
  "%let _LOCAL_DIR=%nrstr(${fileDirname});",
  "%put NOTE: Local file is &_LOCAL_FILE;"
]

When the user executes Run Selected or All SAS Code or Run All SAS Code, the extension would automatically prepend this snippet to the submitted code before sending it to the SAS server.

Describe alternatives you've considered

  • Makes it easier to integrate project context (local paths, metadata) into SAS Viya sessions.
  • R and Stata extensions in VS Code provide similar “Submit Before/After Text” functionality.

Additional context

  • Many enterprise users rely on such hooks to align local project context with remote compute environments.

SAS version

Viya 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions