Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>DataStep Studio for SASNew to Visual Studio Code? Get it now.
DataStep Studio for SAS

DataStep Studio for SAS

Preview

DataStep Labs

|
85 installs
| (1) | Free
Write, run and debug SAS in VS Code: one key runs your code, the log points to the line, a data viewer, autocomplete, and a DATA step debugger, a macro debugger and %pry to stop a running program and look inside. For SAS 9.4 and SAS OnDemand. Independent product, not affiliated with SAS Institute In
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DataStep Studio for SAS

Write, run and debug SAS® programs. In VS Code.

You know the routine: run the whole program, scroll a 3,000-line log, add PUT _ALL_ or OPTIONS MPRINT MLOGIC SYMBOLGEN, run it all again. DataStep Studio ends that routine. Your program runs on your SAS (the free SAS OnDemand for Academics or your company's SAS 9.4 server), and the log, your data and your results come straight back into VS Code, next to your code. When a number looks wrong, you stop the run and look inside.

DataStep Studio, the film: your SAS in VS Code, the data viewer, the DATA step debugger and %pry

▶ Watch the film: DataStep Studio in 70 seconds, recorded in VS Code on SAS OnDemand.

Made by a SAS programmer for SAS programmers: the keys you know from the SAS Enhanced Editor work, and the things that cost time every day (searching the log, checking data, finding out why a macro does what it does) take a click.

Website and documentation: datastep-studio.pages.dev: Get started, the user manual, the how-to guide and the videos.

Community Early Access. All Professional features are available free of charge during Early Access. Early Access is temporary. Professional functionality may require a paid license following the Early Access period. Free Community functionality will remain available.

What changes in your day

  • One key runs exactly what you changed: the step, the selection, or the program up to the cursor.
  • The log points to the line. Every ERROR and WARNING is marked in your program, and the Suspicious Log shows only what a QC log check looks for.
  • Your data, one double-click away, without a PROC PRINT. Tick values and the WHERE is written for you.
  • Watch a DATA step run, statement by statement, with every variable of the PDV in view.
  • Step through a macro line by line, into the macros it calls, and see afterwards which lines never ran.
  • Stop your real program where you want with %pry and ask: the macro variables and the data sets, as they are at that moment.

What it does for you

Run your code with one key

Changed one line? Run just that step, not the whole 2,000-line program. F4 (or F3 / F8, as in SAS) runs the selection or the whole program. Run To Line runs from the top down to the cursor, Run Step the step at the cursor, Resolve Code shows the code a macro call generates. Running too long? The Stop SAS button stops it, and your WORK data stays.

A log that points to the problem

Your log is 3,000 lines long, and the one NOTE that matters is somewhere in the middle. DataStep Studio colours the log and marks every ERROR and WARNING right at its line in your program. The Suspicious Log shows only what needs a look: ERRORs, WARNINGs and the NOTEs a QC log check looks for (uninitialized, Missing values were generated, repeats of BY values …). A click jumps to the statement that caused it.

Suspicious Log: only the lines that need a look, each with its program line

Look at your data without a PROC PRINT

Double-click a data set and it opens in a table: filter with WHERE, sort, look at frequencies. Tick the values you want to keep, and the SAS condition is written for you. F12 opens the data set your last step created.

Every filter you know from VIEWTABLE and more: a WHERE (w), a filter per column (t with >80, 65-80, !MILD, APP*, . for missing, dates), Enter on a cell to keep its value, Shift+Enter to drop it, f for frequencies and statistics, search all columns, sort, choose columns, labels and raw values, and SQL to take the view into your program.

The data viewer: the frequencies of AESEV in the CDISC pilot ADAE, 1191 rows

▶ Watch the complete tutorial (7 minutes, 9 chapters): from the first double-click to the count of severe adverse events in the CDISC pilot ADAE.

See your SAS session at a glance

The Libraries view lists your librefs and data sets with their variables and labels. Variables shows your macro variables, Options every system option, which you can change in place.

Write code faster

Stop looking up option names. Autocomplete knows SAS procedures, statements, options, functions and formats, and also your librefs, your data sets and their columns. Rest the mouse on a function to see its syntax, with a link to the SAS documentation. Right-click a macro call to open the macro's definition.

Autocomplete after PROC

Keyboard macros, as in SAS. Type sort, merge, ifelse, %nobs or header and press Tab: the code is written for you, and Tab jumps to the parts you fill in. 80 come built in, and you can import your own from the SAS Enhanced Editor (.kmf).

Clean up a messy program. Right-click → Format SAS Program: keywords upper case, names lower case, two spaces per level, one statement per line, IF and ELSE lined up. Strings, comments and macro text stay untouched.

When a number looks wrong

Three ways to look inside a running program. Pick by your question:

Your question Use
Why is this variable wrong for these rows? the DATA step debugger: one row at a time, the PDV
How does this macro work, and does every branch work? the macro debugger: one macro, line by line
Why is this number wrong in my program? %pry where you suspect it: your real program waits there
Where does my program fail? %pry(rescue=Y): stops right after the first step that ends with an ERROR

Watch a DATA step work (Professional)

No more PUT _ALL_ and guessing. Step through a DATA step statement by statement and see every variable change: what RETAIN keeps, where FIRST. and LAST. flip, which records a MERGE brings with its IN= flags. A breakpoint with a condition such as usubjid = "01-701-1023" stops right at the subject you care about.

The DATA step debugger: every variable of the current observation

▶ Watch the complete tutorial (6 minutes, 8 chapters): a counter that never starts again, found and fixed.

Find out why a macro does what it does (Professional)

Put the cursor on a macro call in your program and click Debug Macro. Step through the macro, into the macros it calls, and watch its macro variables change. A breakpoint with a condition such as &i. = 3 stops in the round you care about. After the run, every line shows how often it ran, so you see which code your test never reached.

The macro debugger inside a nested call

▶ Watch the complete tutorial (5 minutes, 8 chapters): two macros from the book, line by line.

Freeze a run where you want to look: %pry (Professional)

%pry is a line you write into your program. When the run reaches it, the run freezes there, and you look at everything as it is at that moment: the macro variables, the data sets, the code around it. Then you let it go on. No more %PUT &=i;, MPRINT and running the whole program again to see one value.

  1. Write %pry where you want to look: in a macro, in a DATA step, or between two steps. %pry(when=&age. = 14) stops only when the condition holds; %pry(rescue=Y) stops right after the first step before it that ends with an ERROR.
  2. Run the program as always (F4). It stops at that line.
  3. Ask at the prompt: ls shows the macro variables, vt work.class_m the data set as it is now, where age > 13 and freq sex look into it. Or write a test program in the editor, with autocomplete, and press F4: it runs right there, at the stop.
  4. Type c to go on (next runs one more line or step and stops again).

%pry: the run stops, then whereami, vt, where and freq at the prompt

▶ Watch the complete tutorial (7 minutes, 8 chapters) · a macro bug found and fixed with %pry (3 min)

They work together: at a %pry stop, step goes into the macro called there, line by line.

Your files, where SAS is

Keep your programs on your computer and use Git as usual: before each run, the changed files are copied to the SAS server, so %INCLUDE and LIBNAME with relative paths just work. Or open your SAS home as a folder and edit the programs there. Run in Batch runs a whole folder of programs, each in a fresh SAS session, while you keep working.

Move files between your computer and the server (Professional)

The File Manager shows a folder of your computer on the left and a folder of the SAS server on the right. Mark files with Space, press F5 to copy or F6 to move them to the other side; or drag them, or copy and paste. Files travel zipped, so 25 programs reach the server in under a second, and every file arrives byte for byte. Nothing is overwritten or deleted without a question.

The File Manager: your computer on the left, the SAS server on the right

Get started in ten minutes

  1. Install Java 8 or newer and Python 3.8 or newer (on a Mac: xcode-select --install).
  2. Run DataStep Studio: Check Setup from the Command Palette. It finds Java and Python and installs the rest with one click.
  3. Run DataStep Studio: Add New Connection Profile: SAS OnDemand for Academics (your region and user ID) or a SAS 9.4 server (host, port, user). Your password is asked once and kept in your computer's keychain. A SAS 9.4 server that you reach through SSH works too, with your own SASPy configuration (manual, chapter 3).
  4. Open a .sas file and press F4.

Or with one command in a terminal. It installs the extension, checks Java, Python and SASPy, and names the next step for your computer:

  • Mac, Linux: curl -fsSL https://datastep-studio.pages.dev/install.sh | sh
  • Windows (PowerShell, new there): irm https://datastep-studio.pages.dev/install.ps1 | iex

Help → Get Started → Get started with DataStep Studio walks you through the same steps with pictures.

Try it in your browser, with nothing to install. The free book SAS for Clinical Programmers opens in GitHub Codespaces with DataStep Studio and all of its programs ready: you only need a free GitHub account and a free SAS OnDemand account. How it works.

Editions

Community: always free Professional: free during Early Access
All run modes, Stop SAS, Run in Batch DATA step debugger
SAS Log, Suspicious Log, SAS Output Macro debugger with code coverage
Data viewer with filters and WHERE keys Smart code: step templates, value lists, your macro calls
Libraries, Variables, Options, Created Files Enlarge / Optimize macro calls
Autocomplete, hover documentation, parameter hints Git on the SAS server
Format SAS Program, keyboard macros, the keys you know from SAS File Manager: your computer and the SAS server side by side
SAS Server window, project sync %pry: freeze a run where you want to look, or at the first ERROR

DataStep Studio: License and Edition shows what is on.

Your data stays yours

DataStep Studio collects nothing. Your programs, data sets and logs go only to the SAS server you connect to; there is no telemetry and no license server.

Help

  • Website: datastep-studio.pages.dev, with the manual, the how-to guide and the videos.
  • Manual and how-to guide: further down this page, and inside VS Code: DataStep Studio: Open Manual and Open How-To Guide (Command Palette: Shift+Cmd+P on a Mac, Ctrl+Shift+P on Windows and Linux).
  • Videos: the film (70 s) and the complete tutorials of the data viewer, the DATA step debugger, the macro debugger and %pry. Inside VS Code: DataStep Studio: Watch the Installation Video (every step from installing to both debuggers), Watch the 2-Minute Tour and Watch the Macro Debugger Video.
  • Questions: Q & A on this page, or the DataStep Studio thread in the SAS Community.
  • Something went wrong: DataStep Studio: Report a Problem copies the error message and the versions (home folders hidden), ready to paste into a question.
  • A question you would rather not ask in public (your company's server, your setup): DataStep Studio: Send Feedback → Write to the author. An email opens in your mail program with the versions filled in; you read it and send it yourself.

Feedback

Early Access lives from your feedback: what works, what is missing, what got in your way. Use Rating & Review and Q & A on this page, Write to the author (a private email, from DataStep Studio: Send Feedback), the SAS Community thread, or DataStep Studio: Send Feedback in VS Code.

Requirements

VS Code 1.85 or newer (Cursor and other VS Code builds work too), Java 8+, Python 3.8+ with SASPy 5.102 to 5.109 (Check Setup installs it), and SAS OnDemand for Academics or SAS 9.4 (through IOM; through SSH every feature except the DATA step debugger). If you also have the SAS extension for VS Code, disable it in the folders where you use DataStep Studio, or every suggestion appears twice.


DataStep Studio is an independent product and is not affiliated with, sponsored by or endorsed by SAS Institute Inc. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.


User manual

The same manual with pictures is inside VS Code: DataStep Studio: Open Manual.

Contents

  • Start here: your first five minutes
  1. What you need
  2. Install
  3. Connect to SAS
  4. The layout
  5. Run your code
  6. Read the log: SAS Log, Problems, Suspicious Log
  7. Work on the SAS server
  8. The data viewer
  9. Libraries, Variables, Options
  10. Write code faster: autocomplete, hover, parameter hints
  11. Smart code: step templates, values, your macros
  12. Debug a DATA step
  13. Debug a macro
  14. Keys
  15. Git on the SAS server
  16. Editions and license
  17. Settings
  18. Troubleshooting

Appendix: Keyboard macros


Start here: your first five minutes

New to DataStep Studio? Follow these steps once and you have run your first program, read its log and opened its data. Every step links to the chapter with the details.

  1. Install the extension. In VS Code open the Extensions view (Shift+Cmd+X on a Mac, Shift+Ctrl+X on Windows), search for DataStep Studio and click Install. (Details)

  2. Check your computer. Open the Command Palette (Shift+Cmd+P / Shift+Ctrl+P), type Check Setup and press Enter. It finds Java and Python and installs the rest with one click. (Details)

  3. Tell it where your SAS is. Run DataStep Studio: Add New Connection Profile. For SAS OnDemand you need only your region and your user ID. (Details)

  4. Run something. Create a file first.sas, type

    DATA work.class;
      SET sashelp.class;
      bmi = weight / height**2 * 703;
    RUN;
    

    and press F4. The first run connects to SAS and asks for your password once.

  5. Read the log. The SAS Log opens below your program, in colour. Problems are marked right at their line in your program. (Details)

  6. Look at the data. Press F12: the data set you just made opens. Click a column and press f for its frequencies. (Details)

That's it. The rest of this manual shows what else saves you time, chapter by chapter.


1. What you need

An editor, a SAS to run on, and two helpers that DataStep Studio uses to talk to SAS.

Editor Visual Studio Code 1.85 or newer (Cursor and other VS Code builds: install the .vsix file from the Marketplace page, Download Extension)
SAS A free SAS OnDemand for Academics account, or a SAS 9.4 server of your company that SAS Enterprise Guide connects to (IOM)
Java Java 8 or newer
Python Python 3.8 or newer

Why Java and Python? DataStep Studio talks to SAS through SASPy, SAS's own Python package, and SASPy uses Java. You install Java and Python once. Everything else, SASPy included, DataStep Studio sets up for you. You never edit a configuration file, and your password stays in your computer's keychain.

2. Install

About 10 minutes the first time. If Java and Python are already on your computer, skip straight to 2.3.

2.1 Java

  1. Open a terminal (Mac: Terminal, Windows: Command Prompt) and type java -version.
  2. Version 1.8 or higher (or 11, 17, 21 …)? Then you are done.
  3. Otherwise install Eclipse Temurin from adoptium.net. On Windows tick Add to PATH. On a Mac brew install --cask temurin works too.

2.2 Python

  1. In the terminal type python3 --version (Windows: py --version).
  2. Nothing found? On a Mac run xcode-select --install (Apple's developer tools include Python) or download it from python.org. On Windows download it from python.org and tick Add python.exe to PATH.

You do not need to install SASPy yourself.

2.3 The extension

Prefer to watch? DataStep Studio: Watch the Installation Video shows this chapter and the next, from installing to both debuggers.

  1. In VS Code open the Extensions view (Shift+Cmd+X on a Mac, Shift+Ctrl+X on Windows and Linux).
  2. Search for DataStep Studio and click Install.
  3. The first time, VS Code asks Do you trust the publisher "DataStep Labs"? Click Trust Publisher & Install.
  4. Reload VS Code if it asks. From now on updates arrive by themselves.

No access to the Marketplace (some company networks block it)? Get the file datastep-studio-<version>.vsix and use Extensions view → ⋯ → Install from VSIX….

2.4 Check Setup

This one command saves you an afternoon of setting up SASPy by hand.

  1. Open the Command Palette (Shift+Cmd+P / Shift+Ctrl+P).

  2. Run DataStep Studio: Check Setup. It reports what it found, for example:

    Java 17 ✓ · Python 3.12 with SASPy 5.109.3 ✓ · no connection profile

  3. SASPy missing? Click Install SASPy. DataStep Studio installs it in a small environment of its own, so your own Python stays untouched. Java or Python missing? The message tells you what to install and links to the download.

Check Setup: what is there, and what comes next

Help → Get Started → Get started with DataStep Studio walks you through the same steps with pictures.

2.5 Next to the official SAS extension

You can keep SAS Institute's own SAS extension installed. But both extensions offer suggestions for .sas files, so you would see everything twice. In the folders where you use DataStep Studio, switch the other one off for that folder only: Extensions view → SAS → Disable (Workspace).

While the SAS extension is installed, DataStep Studio leaves F3 and F8 to it and runs your code with F4 and Cmd/Ctrl+Enter.

2.6 One command instead: the install script

If you like a terminal better than clicking, one command does 2.3 and 2.4 and tells you what else is missing:

System Command
Mac, Linux (Terminal) curl -fsSL https://datastep-studio.pages.dev/install.sh \| sh
Windows (PowerShell) irm https://datastep-studio.pages.dev/install.ps1 \| iex

On Windows the script is new. If it stops with something you do not understand, follow 2.1 to 2.4: they work as before.

Prefer to watch? The install script in two minutes: the command, the report, the setup tool, and connecting with your own SASPy configuration (3.3).

It puts the extension into your editor and prints a report: editor, extension, Java, Python, SASPy, connection, network. For everything that is missing it names the next step for your system:

[ok]    editor      VS Code
[ok]    extension   DataStep Studio 0.2.19 in VS Code
[ok]    java        Java 17 (/usr/bin/java)
[ok]    python      Python 3.12.1 (/usr/bin/python3)
[todo]  saspy       not found
         run: ~/.vscode/extensions/datastep-labs.datastep-studio-0.2.19/bin/datastep-setup fix saspy
         Installs SASPy into an environment of DataStep Studio's own. Your Python is not changed.
[todo]  connection  no connection profile
         ...
Next: saspy

The tool that writes the report is in the extension's folder afterwards (bin/datastep-setup, on Windows bin\datastep-setup.cmd):

Command What it does
check the report again
fix what the tool can do itself: it installs SASPy
profile --type oda --region <region> --user <user> writes a SAS OnDemand profile (--region also takes the web address of SAS Studio)
profile --type iom --host <host> --port 8591 --user <user> writes a profile for a SAS 9.4 server

A profile written this way appears in the editor by itself. The tool never asks for your SAS password; you type it in the editor at the first connect.

No access to the Marketplace? Download the script and the .vsix file, and run sh install.sh --vsix <file> (Windows: powershell -ExecutionPolicy Bypass -File install.ps1 -Vsix <file>).

3. Connect to SAS

Do this once. After that, pressing F4 is all it takes to run on SAS.

3.1 Add a connection profile

  1. Run DataStep Studio: Add New Connection Profile.

  2. Choose where your SAS is:

    You choose You enter
    SAS OnDemand for Academics your home region and your user ID (or the e-mail address you sign in with)
    SAS 9.4 server (IOM) host, port (usually 8591) and user; the application server only if your administrator named one
    From the SAS extension: … nothing: your SAS 9.4 profiles from the SAS extension are filled in
    My own SASPy configuration the name of a configuration in your sascfg_personal.py (see 3.3)
  3. Press Connect Now (or F4 in a .sas file). The first time it asks for your password and keeps it in your computer's keychain, never in a file.

Add New Connection Profile: where is your SAS?

Where do I find my SAS OnDemand region? Sign in at welcome.oda.sas.com and open SAS Studio. The web address contains the region code:

Region code in the address Home region
usw2 United States 1
usw2-2 United States 2
euw1 Europe 1
apse1 Asia Pacific 1
apse1-2 Asia Pacific 2

The home region, with its two servers

Good to know

  • Wrong password? The error offers Enter Password Again. DataStep Studio: Forget Saved Password does the same at any time.
  • Switch Connection Profile changes between profiles, Delete Connection Profile removes one. The status bar shows which one is active.
  • DataStep Studio is tested with SAS OnDemand. A company SAS 9.4 server uses the same kind of connection; single sign-on may need your administrator's help.
  • A SAS 9.4 server that you reach through SSH works with your own SASPy configuration (3.3). The DATA step debugger does not start through SSH: it needs one of the connections above. Not supported yet: SAS Viya, and SAS 9.4 through COM.

3.2 Settings that can matter

Setting Default When to change it
datastepStudio.java (found) Java is in an unusual place: the full path to java / java.exe
datastepStudio.python (found) You want a particular Python with SASPy: its full path

3.3 Advanced: your own SASPy configuration

For you if you already use SASPy from Python, or if you want your connection in two files of your own instead of a profile. Everyone else is done after 3.1.

Prefer to watch? The second half of this video shows both files and the connection.

SASPy reads two files. One says where SAS is, the other holds your user and password. DataStep Studio can use them as they are.

1. sascfg_personal.py: where SAS is. Put it in the folder .config/saspy of your home folder (~/.config/saspy/sascfg_personal.py; on Windows C:\Users\<you>\.config\saspy\sascfg_personal.py). It names one or more configurations. For SAS OnDemand, home region Europe 1:

SAS_config_names = ['oda']

oda = {'java'    : '/usr/bin/java',
       'iomhost' : ['odaws01-euw1.oda.sas.com', 'odaws02-euw1.oda.sas.com'],
       'iomport' : 8591,
       'authkey' : 'oda',
       'encoding': 'utf-8'}
Line What to write
SAS_config_names the names of the configurations in this file
java the full path to Java (which java on a Mac or Linux, where java on Windows)
iomhost the servers of your home region: the table in 3.1 has the region codes, SAS's SAS OnDemand page the server names
authkey the name under which the next file holds your user and password

For a SAS 9.4 server of your company the same, with its host and port (and 'appserver' only when your administrator named one):

SAS_config_names = ['oda', 'prod']

prod = {'java'    : '/usr/bin/java',
        'iomhost' : 'sas.example.com',
        'iomport' : 8591,
        'authkey' : 'prod',
        'encoding': 'utf-8'}

For a SAS 9.4 server that you reach through SSH, the configuration names the SSH program, the server and the path to SAS on the server (your administrator knows it). SSH must sign you in without a password, with an SSH key; the authinfo file below is not needed for it. The DATA step debugger does not start through SSH.

SAS_config_names = ['oda', 'prod', 'prod_ssh']

prod_ssh = {'ssh'     : '/usr/bin/ssh',
            'host'    : 'sas.example.com',
            'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8',
            'encoding': 'utf-8'}

2. The authinfo file: your user and password. A text file in your home folder: ~/.authinfo on a Mac or Linux, C:\Users\<you>\_authinfo on Windows. One line for each authkey:

oda user your-user-id password your-password
prod user your-company-user password your-company-password

The password stands in this file as plain text. Make the file readable for you alone (Mac, Linux: chmod 600 ~/.authinfo), and do not put it into a project folder or a repository. If you would rather not keep a password in a file, use a profile as in 3.1: then it is in your computer's keychain.

3. Tell DataStep Studio which configuration to use. Any one of these:

Way What you do
Nothing Add no profile at all. DataStep Studio then uses the configuration named in the setting datastepStudio.cfgname (default oda).
In the editor Add New Connection Profile → My own SASPy configuration → the name of the configuration, for example prod.
In a terminal datastep-setup profile --type saspy --cfgname prod (the setup tool of 2.6). The profile appears in the editor by itself.

Then connect (F4 in a .sas file). No password is asked: SASPy takes it from the authinfo file.

Good to know

  • datastep-setup check (2.6) tells you whether your configuration is found: your own SASPy configuration "oda". When the setting names a configuration the file does not have, it lists the names the file has.
  • The file is somewhere else? Name it in the setting datastepStudio.cfgfile.
  • DataStep Studio must use the Python that has your SASPy. It finds it by itself; datastepStudio.python takes the full path when it does not. The DATA step debugger needs SASPy 5.102 to 5.109.
  • A profile with the password from the authinfo file. A profile from 3.1 can take its password from there instead of the keychain: add "authkey": "oda" to the profile in the setting datastepStudio.connectionProfiles, or write it with datastep-setup profile --type oda --region euw1 --user your-user-id --authkey oda.
  • More on both files: SASPy's configuration guide.

3.4 The session

  • The status bar shows SAS when you are connected and SAS running 0:12 while a program runs.
  • While you work, DataStep Studio keeps the session alive. After 30 minutes of quiet it closes it, so you never hold a session for nothing. The next run simply connects again.
  • Each DataStep Studio window has its own SAS session, with its own WORK and macro variables.

4. The layout

Everything SAS shows you, in one window: your program, the log, your libraries and your data.

When SAS connects, its tabs open in their places:

  • Right side bar: Libraries, Results, Keys, Variables, Options
  • Bottom panel: SAS Log, Suspicious Log, SAS Output, Created Files

Drag any tab where you like; VS Code remembers it. Like in the SAS Enhanced Editor, WSAVE ALL saves which SAS tabs are showing: type it in the SAS command box (Ctrl+Alt+C) or run DataStep Studio: Save Layout (WSAVE ALL).

5. Run your code

Change one line and run just that step, not the whole 2,000-line program.

Try it

  1. Put the cursor anywhere in your program and press F4: the whole program runs.
  2. Select a few lines and press F4: only those run.
  3. Put the cursor in the middle of a program and press Ctrl+Alt+Up: everything from the top down to here runs. A step is never cut in half.

All the ways to run:

Run mode Key What runs
Run F4, Cmd/Ctrl+Enter; F3, F8 as in SAS the selection, else the whole program
Run To Line Ctrl+Alt+Up from the top down to the cursor line
Run From Line Ctrl+Alt+Down from the step at the cursor to the end
Run Step ▷ menu in the title bar the step, SQL statement, macro definition or macro call at the cursor
Run in Template Command Palette your code wrapped in a template, e.g. ODS_RTF to get an RTF file (setting datastepStudio.templates)
Run As Macro Command Palette %DO/%IF code selected inside a macro; it asks for the macro's parameters
Resolve Code Ctrl+Alt+R shows the code a macro call generates, nicely formatted, beside your program
SAS command Ctrl+Alt+C one line of SAS from a small command box with history
Open Last Data Set F12 opens the data set the last step created
Clear Log and Output F2 empties the SAS Log, Suspicious Log and SAS Output

Running too long? While SAS runs, a Stop SAS button appears in the status bar and in the program's title bar. One click stops the running code, like Ctrl+Break in SAS. Your session, WORK data and macro variables stay.

Run: the coloured SAS log, the ERROR in Problems at its line

Graphs in SAS Output

PROC SGPLOT and the plots of PROC REG show below the listing, as in the Results Viewer.

PROC SGPLOT DATA=sashelp.class;
  SCATTER X=height Y=weight / GROUP=sex;
RUN;

Run it: the graph appears in SAS Output, below the text of the same run. Procedures that draw on their own (PROC REG, PROC TTEST ...) show all their plots. Click a graph to open it in the program your computer has for pictures, larger.

  • DataStep Studio tells SAS to write the pictures to a folder in WORK (GPATH= of ODS LISTING). Without it, SAS OnDemand stops every PROC SGPLOT with ERROR: Cannot write image.
  • ODS LISTING CLOSE in your program stays as you wrote it: when the listing is closed, no pictures come.
  • Not shown: graphs of the older SAS/GRAPH procedures (GCHART, GPLOT), and graphs of batch runs.
  • To switch it off, set datastepStudio.graphs.show to off. SAS then writes the pictures where GPATH= says.

Results: go to a procedure's output

A long run prints many tables. The Results tab lists them, as the Results window of Display Manager does.

Open the Results tab in the right side bar, next to Libraries. It lists every run of the session. Under each run you see the procedures that printed (The MEANS Procedure, The FREQ Procedure, DATA step for FILE PRINT) and the graphs. Click one: SAS Output comes to the front at that place, marked for a moment. The newest run is open; older ones open with a click.

  • Clear Log and Output (F2) also empties the Results tab.
  • Output that went only to another destination (ODS LISTING CLOSE with ODS RTF) is not in SAS Output, so it is not listed. To open that file, see the next section.

Open ODS files after a run

Your PowerPoint, PDF or Word file opens when the run ends, as in Display Manager.

You write a report with ODS POWERPOINT, run it, and then look for the file on the server to open it. With DataStep Studio the file comes to you: when the run ends, a message names the files the run wrote.

ODS POWERPOINT FILE="%SYSFUNC(PATHNAME(WORK))/class.pptx";
PROC PRINT DATA=sashelp.class(OBS=5);
RUN;
ODS POWERPOINT CLOSE;

Run it and click Open in the message: class.pptx opens in PowerPoint (or the program your computer has for .pptx). Always Open opens the files at once from now on, without the message. Never stops the messages.

  • It works for every ODS file that SAS names in the log: ODS PDF, ODS RTF, ODS POWERPOINT, ODS EXCEL, ODS WORD, ODS HTML5 and the tagsets. The file can be in any folder, and FILE= can name a fileref.
  • The file opens from a copy on your computer. The file on the server stays where SAS wrote it.
  • Batch runs do not open files. Run in Template opens the file its template names, once.
Setting What it does
datastepStudio.odsFiles.open ask (default): a message with Open; always: open at once; never: do nothing
datastepStudio.odsFiles.types the file types to open: pdf, rtf, pptx, xlsx, docx. Add html if you want HTML pages too; they open without their pictures

The Created Files tab lists the other files in WORK; click one to open it.

Run in Batch

Run your whole study, program after program, each in a clean session, while you keep working.

Try it

  1. In the Explorer, right-click a folder (or select several programs) → Run in Batch.
  2. Keep working: your own session is not touched.
  3. When it is done, a message tells you how it went. Show Summary opens the overview; the second button opens the first log with errors.

Good to know

  • Programs run in the order of their names, numbers by value (2_adae.sas before 10_adlb.sas). Name them 01_adsl.sas, 02_adae.sas, … to set the order. A folder runs its own .sas files, not those of its subfolders.
  • Each program gets a fresh SAS session: empty WORK, no leftover macro variables, your autoexec. So a program that works in batch really stands on its own.
  • program.log and program.lst are written next to each program. ERRORs and WARNINGs also appear in Problems.
  • Cancel in the progress message stops after the running program. A fresh session takes a few seconds per program on SAS OnDemand.

6. Read the log: SAS Log, Problems, Suspicious Log

Your log is 3,000 lines long, and the one NOTE that matters is somewhere in the middle. Here you find it in seconds.

Try it

  1. Run a program with a mistake, for example y = ; in a DATA step.
  2. The SAS Log shows the ERROR in red. Click it: the cursor jumps to that line of your program.
  3. Look at your program: the line has a red squiggle. The Problems tab lists every ERROR, WARNING and important NOTE with its line.
  4. Open the Suspicious Log tab: only the lines that need a look, nothing else.

Suspicious Log: only the critical lines, with their program line

Good to know

  • The SAS Log is coloured: ERROR red, WARNING yellow, NOTE blue. ▲ Error / Error ▼ jump from problem to problem.
  • The Suspicious Log collects, from every run, all ERRORs and WARNINGs plus the NOTEs a QC log check looks for: uninitialized, Missing values were generated, repeats of BY values, remerging summary statistics, converted to numeric/character, Invalid data, Division by zero, 0 observations, LOST CARD and more.
  • Your own rules: datastepStudio.log.suspiciousNotes adds patterns (for example Table WORK\.\w+ created, with 0 rows), datastepStudio.log.suspiciousIgnore hides messages you know are harmless.

7. Work on the SAS server

Edit the programs on your SAS server as if they were on your own computer. Or keep them on your computer and let DataStep Studio copy them to the server for you.

Programs on the server

  1. Run DataStep Studio: Open SAS Server Folder (or click the button in an empty Explorer).
  2. A second window opens. Its folder is your SAS OnDemand home: open, edit, save, create, rename and delete files there as usual.
  3. A program there runs in its own server folder, so %INCLUDE "macros/x.sas" works relative to it.

The first time, VS Code asks whether you trust this new folder (Restricted Mode). DataStep Studio shows a Trust… button: click it, then Trust. You do this only once. Until then you can still edit and run, but the debuggers wait.

Programs on your computer

Keep your files where you like and use Git and GitHub as usual. Before each run, DataStep Studio copies the files of your project that changed to a folder in your SAS home, ~/datastep-studio/<project>-<id>, and runs the program there. A run without changes costs a few milliseconds. Files that SAS writes come back to your computer; data sets stay on the server.

The status bar shows where your project lives on the server, for example ☁ study-3f2a9c1e. Click it to open that folder in the SAS Server window.

Good to know

  • Relative paths just work. SAS's working folder is set to the program's folder on the server, so %INCLUDE "macros/setup.sas", LIBNAME adam "data/adam"; and FILENAME with relative paths behave as on a SAS on your own computer.
  • Copy by hand: in the SAS Server window, drag files or folders from Finder or Windows Explorer onto a folder.
  • A very large project (more than 2,000 files or 200 MB) makes DataStep Studio ask once which folder to copy. Choose Upload Folder changes it; datastepStudio.sync.excludeDirs and excludeFiles leave things out.

File Manager: your computer and the server side by side

(Professional)

Copy a folder of programs to the server, or fetch the logs and outputs of a run, without leaving the keyboard.

DataStep Studio: Open File Manager opens a tab with two lists: a folder of your computer on the left, a folder of the SAS server on the right. It works like the two-pane file managers you may know: one side has the cursor, and Copy and Move send the chosen files to the folder the other side shows. In the Explorer, a right click on a folder offers the same command and starts there.

The File Manager: your computer on the left, the SAS server on the right, three marked files copied

A video of 1:45 shows it in use: datastep-studio.pages.dev/#file-manager.

Try it

  1. Run DataStep Studio: Open File Manager. The first time, the left side shows the folder of your program and the right side its copy on the server (or your SAS home). Later both sides start where you left them.
  2. Move with the arrow keys, open a folder with Enter, go up with Backspace. Tab changes sides.
  3. Put the cursor on a file and press F5, then Enter: it is copied to the other side.
  4. Mark several files with Space, press F6 and Enter: they are moved.
Key What it does
Tab the other side
Enter, Backspace open the folder or file; the folder above
Space or Insert, Shift+arrows mark files (Ctrl+A / Cmd+A marks all, Esc takes the marks off)
typing letters show only the names that hold them (* stands for anything); Esc shows all again
F5, F6 copy or move the chosen files to the other side
Ctrl+C / X / V (Cmd on a Mac) copy or cut, then paste into the folder you are in, also on the same side
F3, F4 open the file in an editor tab (a server file is edited and saved on the server)
F7, F2, F8 or Delete new folder, rename, delete
Ctrl+R (Cmd+R) read both folders again
Ctrl+L (Cmd+L) type a folder; ~ is your home folder, and folders below it are shown that way

With the mouse: a double click opens a folder or a file. Cmd+click (Ctrl+click on Windows) and Shift+click mark several files, as in the Finder and the Explorer; a click below the rows takes the marks off. Marked files are shown in red. Drag files to the other side (copy, with Shift move) or onto a folder; a right click opens a menu; a click on a column heading sorts. The function keys belong to the File Manager only while its tab has the focus, and the Keys tab (F9) can give its commands other keys.

Good to know

  • Nothing is overwritten or deleted without a question. A name that exists in the target folder is asked about first (Replace or Skip). What you delete on your computer goes to the Trash; the server has no Trash, and the question says so.
  • A move removes the source only after the copy is checked: every file must have arrived with its size.
  • It is fast because it asks SAS as rarely as possible. A server folder you have seen shows at once, the folders below it are read ahead, and many files travel together, zipped: 25 programs (500 KB) go up in under a second. Data that does not shrink in a zip, such as most data sets, takes about 5 seconds per megabyte on SAS OnDemand.
  • It does not hang when SAS OnDemand does not answer. Each request to SAS carries little, and one that gets no answer within 20 seconds is sent once more. If that one stays unanswered too, a message says so, and SAS is free again.
  • It works while SAS is busy: during a long run or a debug session, a second SAS session does the file work.
  • Copies are exact, byte for byte: line ends, encodings and binary files (data sets, PDF, Excel) arrive unchanged.
  • Names that start with a dot are not shown on the server (SAS cannot list them); on your computer the eye button shows them. Folders copied to the server leave such files behind unless the eye button is on.
  • Times on the server side are the server's clock, which can differ from your computer's.

8. The data viewer

Check a data set without writing a single PROC PRINT, and turn what you see into a WHERE clause.

Prefer to watch? The complete tutorial, 7 minutes, recorded on SAS OnDemand with the CDISC pilot ADAE: open a data set (0:43), move around (1:26), one column at a glance (1:55), filter with a WHERE (2:33), a filter per column (3:05), the value picker (3:53), sort, columns, labels, raw (4:31), search, Open…, the keys (5:19), severe adverse events, from the first click to the count (5:46).

Try it

  1. Double-click a data set in Libraries (or press F12 for the last one created, or Ctrl+Alt+D on a data set name in your program).
  2. Click a column and press f: its frequencies.
  3. Press Ctrl+Alt+I on a column: tick the values you want, and the SAS condition is written for you as you tick. Enter keeps only those rows. The value of the current cell is ticked already; one value gives column = 'value', two or more column IN (...). Watch: the value picker.

The data viewer

Value picker: tick the values, the SAS condition is built live

More keys (? lists all of them):

  • Move with the arrow keys and PageUp/PageDown; g goes to an observation number.
  • Filter: type a WHERE clause (w), search all columns (/), or filter per column (t) with >13, 1-5, a,b,c, !a, A*, . for missing, or dates like 01JAN2020.
  • Enter on a cell keeps rows with that value; Shift+Enter removes them. Ctrl+Alt+E adds column = value to the WHERE box; Ctrl+Alt+R shows all rows again.
  • Sort (s, a, d), hide or choose columns (h, c), labels (l), raw or formatted values (v).
  • F3 closes the data set tab, as in a SAS data window.

More keys and buttons:

  • Home / End: first or last column (with Shift also the first or last row); Shift+PageUp / Shift+PageDown: first or last page; Ctrl+Shift+F finds a column by its name or label.
  • A click on a column heading sorts by it; Shift+click adds a second sort column.
  • In the f panel: the first lines show rows, distinct values, missing, and for numbers min, max and mean. A click on a value keeps only that value, Alt+click removes it, Space ticks several and Enter keeps them.
  • Delete or Backspace on a cell removes that column's filter; the × on a WHERE chip removes that part.
  • Columns: type part of a name or label and click Only matching to show only those columns.
  • SQL shows the view as PROC SQL code to copy into a program; Open… opens another data set by name.

9. Libraries, Variables, Options

What is in my WORK? What is &cutoff right now? Is MPRINT on? One look instead of a PROC.

  • Libraries: your librefs and their data sets. Expand a data set (▸) to see its variables with type and label; click a variable to open the data set at that column.
  • Variables: the macro variables of your session. Filter them, or add name=value.
  • Options: every system option by group. Click one to change it; ↺ puts the old value back. 🔍 finds an option by name or description.

Options: change a system option in place

10. Write code faster: autocomplete, hover, parameter hints

Stop looking up option names. DataStep Studio knows SAS, and it knows your data.

Try it

  1. Type PROC and pick a procedure from the list.
  2. In a step that reads sashelp.class, type WHERE and see the columns of sashelp.class.
  3. Rest the mouse on INTCK: its description, its syntax and a link to the SAS documentation.
  4. Type INTCK(: a hint shows which argument comes next.

Autocomplete after PROC

Suggestions open as you type (or with Ctrl+Space): procedures, statements, options, functions, formats, data set options, system options, librefs and data sets, the columns of the data you read, macro variables after & (written as &name.) and macros after %. Nothing waits for SAS while you type.

Hover with the link to the SAS documentation Parameter hint

Open a macro's definition or an included program

Your program calls %derive_vars_dtm, and you wonder what it does. One click and you are there.

Try it

  1. Right-click a macro call, for example %derive_vars_dtm(...).
  2. Choose Open Macro Definition / Included Program: the file that defines the macro opens at its %MACRO line.
  3. Right-click a %INCLUDE "file" statement and choose the same entry: the included program opens. A macro variable in the path, as in %INCLUDE "&studydir./run_all.sas";, gets its value from the %LET above the statement, or from the SAS session when the value was set by a program you ran before. If no value is found, a message names the variable.

Faster still: Cmd+click (Mac) or Ctrl+click the call or the include.

The macro is searched where SAS itself would find it: in the program, in the files it %INCLUDEs, in its folder and the folders above it with their macros folders, and for a program on the SAS server also in SASAUTOS.

Format your code

Inherited a program where every line looks different? One right-click and it reads like your own.

Try it

  1. Right-click in a SAS program → Format SAS Program.
  2. Only want part of it? Highlight those lines and press Ctrl+Shift+F (also on a Mac).

Nothing changes unless you ask.

Before:

data adsl;set sashelp.class;
if age<13 then grp='child';else grp='teen';
run;

After:

DATA adsl;
  SET sashelp.class;
  IF age < 13 THEN grp = 'child';
  ELSE             grp = 'teen';
RUN;

What it does

  • SAS keywords, functions and formats in upper case; variables, data sets and your macro calls in lower case.
  • Two spaces per level: DATA or PROC to RUN, DO to END, %DO to %END, %MACRO to %MEND.
  • One statement per line, one blank between words, = aligned in a block of assignments, IF and ELSE lined up (also when one of the statements goes on over the next lines: those lines move with it).
  • DEFINE statements of PROC REPORT that follow each other have their / in one column.
  • An argument that is left out keeps one blank between its two commas: COMPRESS(x, , "c").
  • Long macro calls get one parameter per line, comma first. Long PROC SQL statements get one clause per line.
  • Any other statement that is longer than the line is broken at blanks: a list (KEEP, BY, SET ...) goes on under its first item, other statements two levels in. A text in quotes and macro text are never broken.
  • A statement with one entry per line (an ATTRIB or LABEL list) is set in columns, with the first entry under the keyword or behind it (LABEL x = "One", the next entries under x).
  • &ads becomes &ads..

What it never touches: the comments at the top of the program, strings, comments, DATALINES and macro text (where upper or lower case can matter). After formatting, DataStep Studio compares the program before and after, word by word. If anything but the layout would change, it leaves the program alone and tells you why.

The datastepStudio.format.* settings change the rules (case, indent, alignment, line length, one statement per line).

Programs that SAS writes. A code generator, or a macro that saves the code it produced, writes a SAS program during the run. Such a file comes out as one long line per statement. When the run says which file it wrote, with a log line

NOTE: Generated program: /home/you/study/gen/resolved/adae_pre.sas

DataStep Studio formats that file on the SAS server as soon as the run is over. Nobody has to ask, and the same check applies: the file is written back only when nothing but the layout changed. In your own generator, one line does it: %PUT NOTE: Generated program: &file.;. The setting datastepStudio.format.generatedPrograms turns this off.

11. Smart code: step templates, values, your macros

(Professional)

Write a whole PROC step in five seconds, and never look up the exact spelling of a treatment group again.

Step templates. Type proc so and press Enter: the whole PROC SORT step is written in house style. DATA= offers the data sets your program made above, and BY is filled with the BY you used before or with the usual key variables (USUBJID, PARAMCD …). Tab jumps to the next place to fill. Templates exist for SORT, PRINT, MEANS, SUMMARY, FREQ, SQL, TRANSPOSE, CONTENTS, DATASETS, REPORT, TABULATE, UNIVARIATE, SGPLOT, IMPORT, EXPORT, FORMAT, APPEND and COMPARE. Type da for DATA (SET), or DATA (MERGE a b) after two data sets sorted the same way.

The PROC SORT step written for you

Values in quotes. Type WHERE trt01p = ' and the values of that column in your data appear, the most frequent first.

Values of the column

Your macros. Type %deri and press Enter: a new call of your macro with every parameter, its defaults filled in. Tab moves from value to value.

A new call of your macro, every parameter

Enlarge and Optimize macro calls. Put the cursor on a call, or right-click it:

Enlarge Macro Call Ctrl+Shift+E shows every parameter of the macro: your values, the rest at their default
Optimize Macro Call Ctrl+Shift+O leaves out the parameters that are at their default; press again for one line

Enlarge Macro Call: every parameter with its default Optimize Macro Call: only what differs from the defaults

DataStep Studio knows the %MACRO definitions in your project. In the SAS Server window it also looks them up on the server: in the program's folder, the folders above it, their macros folders and SASAUTOS.

12. Debug a DATA step

(Professional)

Which tool when? DataStep Studio has three ways to look inside a running program. Pick by your question:

Your question Tool
Why is this variable wrong for these rows? the DATA step debugger (this chapter): one row at a time, the PDV, RETAIN, FIRST./LAST., MERGE with IN=
How does this macro work, and does every branch work? the macro debugger: one macro, line by line, with the parameters you choose, and after the run how often each line ran
Why is this number wrong in my program? %pry where you suspect it: your real program, run as always, waits there
Where does my program fail? %pry(rescue=Y): stops right after the first step that ends with an ERROR

They work together: at a %pry stop, step goes into the macro called there, line by line.

No more PUT _ALL_ and guessing. Watch the step run, statement by statement, and see every variable change.

Prefer to watch? The complete tutorial, 6 minutes, recorded on SAS OnDemand, finds and fixes a counter that never starts again: start it (0:50), one statement at a time (1:21), stop at one subject (1:58), try the fix first (2:28), watch a variable (2:43), fix it in the code (3:17), MERGE and the IN= flags (3:43), a step that calls a macro (4:46).

Try it

  1. Put the cursor in a DATA step.
  2. Click Debug DATA Step in the title bar (or run DataStep Studio: Debug DATA Step).
  3. Press F10 to run one statement at a time. The Variables view shows the PDV: every variable with its current value.
  4. Click in the margin next to a line to set a breakpoint, then press F5 to run until it.

DATA step debugger: the PDV in the Variables view

Follow one observation. Right-click a breakpoint → Edit Breakpoint and give it a condition, for example usubjid = "TEST12" or age > 14. The debugger stops only there. Watch: stop at one subject, then try the fix first: a value changed in the Variables view before the program is changed.

Good to know

  • Jump to Cursor moves to another line; rest the mouse on a variable for its value; change a value in the Variables view to try another path.
  • A DATA step that calls a macro (for example %derive_vars_dtm(...) between SET and RUN) works too. DataStep Studio first writes the step out with the macro's statements and opens it beside your program; the debugger steps through that. This only compiles the step, it reads and writes no data. Run the macro's definition (or the program that %INCLUDEs it) first, so SAS knows the macro. Watch: a step that calls a macro.
  • Want to know why the macro wrote that code (which %IF branch)? Use the macro debugger in the next chapter.

13. Debug a macro

(Professional)

Macros are hard to read and harder to debug. Here you step through them like any other code, and see every macro variable as it changes.

The quickest way in: write %pry where you want to look, and run as always. See %pry below.

Prefer to watch? The complete tutorial, 5 minutes, recorded on SAS OnDemand with the two macros below: start it (0:48), one line at a time (1:16), stop where it matters (1:49), look without changing the code (2:19), into the called macro (2:59), try another path (3:22), what ran, and how often (3:42), debug a call in your program (4:06). The one-minute version: DataStep Studio: Watch the Macro Debugger Video.

We'll use two small macros from the book SAS for Clinical Programmers on a tiny ADAE. %by_sev makes one subset per severity, counts its subjects and calls %nobs for its records:

DATA adae;
  INPUT usubjid :$11. aesev :$8. trtemfl :$1.;
  DATALINES;
01-701-1015 MILD     Y
01-701-1015 MILD     Y
01-701-1023 MILD     Y
01-701-1028 MILD     Y
01-701-1023 MODERATE Y
01-701-1057 MODERATE Y
01-701-1033 SEVERE   Y
01-701-1033 SEVERE   Y
01-701-1047 SEVERE   Y
01-701-1047 MILD     N
;
RUN;

%MACRO nobs(ds);
  %LOCAL dsid n rc;
  %LET dsid = %SYSFUNC(OPEN(&ds.));
  %IF &dsid. %THEN %DO;
    %LET n  = %SYSFUNC(ATTRN(&dsid., NLOBSF));
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
  %END;
  %ELSE %LET n = -1;
  &n.
%MEND nobs;

%MACRO by_sev(data=adae, sevs=MILD MODERATE SEVERE);
  %LOCAL i sev nrec nsub;
  %DO i = 1 %TO %SYSFUNC(COUNTW(&sevs., %STR( )));
    %LET sev = %SCAN(&sevs., &i., %STR( ));
    DATA _sev;
      SET &data.;
      WHERE trtemfl = "Y" AND aesev = "&sev.";
    RUN;
    %LET nrec = %nobs(_sev);
    PROC SQL NOPRINT;
      SELECT COUNT(DISTINCT usubjid) INTO :nsub TRIMMED FROM _sev;
    QUIT;
    %PUT NOTE: &sev.: &nsub. subjects, &nrec. records;
  %END;
%MEND by_sev;

Run it once with F4: it makes WORK.ADAE and tells SAS both macros.

1. Write the call. Put the cursor in %by_sev and click the blue Debug Macro button in the title bar. A call pane opens above the macro, with every parameter and its default: data = adae, sevs = MILD MODERATE SEVERE. Watch: start it, then one line at a time.

The call pane above the macro

2. Stop in the third round. Click in the margin of the line %LET nrec = %nobs(_sev); to set a breakpoint. Right-click the red dot → Edit Breakpoint… → &i. = 3.

3. Start. Click Start Debug in the call pane (or press F5 there). The debugger stops at the first statement, and the Variables view shows the macro variables.

Stopped at the first statement

4. Run to the breakpoint (F5): i = 3 and sev = SEVERE, but nrec = 2 and nsub = 2 are still the values of round 2 (MODERATE): the line with the breakpoint has not run yet. Watch: stop where it matters.

At the conditional breakpoint

5. Go inside %nobs (F11). The call stack shows both macros, and ds = _sev. F10 runs one statement at a time; at the end of %nobs, n = 3: SEVERE has 3 records. Shift+F11 goes back to %by_sev. Watch: into the called macro.

Inside %nobs, called from %by_sev After Step Over: n = 3

6. Finish. Remove the breakpoint and press F5. The SAS Log shows SEVERE: 2 subjects, 3 records, and every macro line shows how often it ran (×3 in the loop, ×1 before it). Lines that never ran are marked, which shows you code your test did not reach. Watch: what ran, and how often.

Code coverage after the run

Debug straight from your program. Put the cursor on a call in your program, for example %derive_vars_dtm(dtc_var=midtc, ...), and click Debug Macro. DataStep Studio finds the macro (in the files your program %INCLUDEs, its folder and the macros folders), opens it, and puts your call, exactly as written, in the call pane. Run your program up to the call first, so the data it needs exists. Watch: debug a call in your program.

While the macro is paused

  • Rest the mouse on &name. to see its value. The Debug Console evaluates macro expressions (%EVAL(&i. * 2)) and runs SAS code inside the paused macro.
  • Libraries shows the data sets the macro has made so far; double-click one to open it.
  • Change a value in the Variables view to try another path through the macro. Watch: look without changing the code and try another path.
  • F11 goes into a macro called on the line when DataStep Studio finds its definition: in the program, in a file it %INCLUDEs (also a file that an %INCLUDEd loader file includes), in a file named after the macro in the folder of those files (_spl_begin.sas for %_spl_begin), or in your workspace. When no definition is found, F11 runs the macro as one step and the Debug Console says No source for %name: stepped over.

%pry: a breakpoint in the code

(Professional)

Prefer to watch? The complete tutorial, 7 minutes shows everything in this section, recorded on SAS OnDemand. It starts with the old way: one macro run with MPRINT, MLOGIC and SYMBOLGEN writes 189 lines of log for 10 rows of data, and one value means searching all of them. Each part below links to its own chapter. Also: a macro bug found and fixed with %pry (2:55).

The idea. %pry is a line you write into your program. When the run reaches it, the run freezes there, and you can look at everything as it is at that moment: the macro variables, the data sets, the code around it. Then you let the run go on.

Why. You know the usual way: add %PUT &=i; or OPTIONS MPRINT MLOGIC SYMBOLGEN;, run the whole program again, search the log, and do it all once more. With %pry you run once, stop where it matters, and ask your questions there. The temporary data sets a macro deletes at its end are still there, and you can try a fix on the spot.

Your first %pry in four steps

Watch this part: your first %pry, from 0:52 (40 seconds). %pry(when=&i. = 3) stops the third round of a loop; ls, &sev and whereami answer at the stop, c lets the run go on.

%MACRO by_age(ds=);
  %DO age = 12 %TO 15;
    DATA _age;
      SET &ds.(WHERE=(age = &age.));
    RUN;
    %pry(when=&age. = 14)
    PROC PRINT DATA=_age;
    RUN;
  %END;
%MEND by_age;

%by_age(ds=sashelp.class)
  1. Write %pry on its own line where you want to look. %pry(when=&age. = 14) stops only in the loop where age is 14; %pry alone stops every time.
  2. Run the program as always (F4). The run stops at that line; the line is marked, as at a breakpoint.
  3. In the SAS Pry terminal (it opens by itself; the Debug Console works too), type a question and press Enter: ls shows the macro variables (age = 14), vt _age shows the data set as it is now, whereami the lines around the stop.
  4. Type c (continue): the run goes on. !!! ends it.
Where %pry can stop
Where you write it What happens
In a macro the macro waits at that line; also in a macro of a file you %INCLUDE or of your macros folder
In a DATA step the step stops just before the statement after %pry, once for every row where when= is true; use the row's variables, without &: %pry(when=age > 14) (see %pry in a DATA step)
Between two steps the program runs up to it and waits; your SAS session is free while it waits
Stop at the first ERROR: %pry(rescue=Y)

Watch this part: stop at the first ERROR, from 4:49 (35 seconds). A step in round 2 fails with ERROR: Variable AESER not found; the run stops right after it, wtf? repeats the ERROR, and ls and vt show the macro variables and data of that moment.

%pry(rescue=Y) also watches every step that runs before it. When one of them ends with an ERROR, the run stops right after that step, before the next one. The SAS Pry terminal names the ERROR, and everything is as it was when it happened: the macro variables of that loop, the data that went into the step. No log to search, no second run. When no step fails, the run stops at the %pry line as usual.

Option Default What it does
rescue=Y N watch the steps before this %pry
error= Y a step with an ERROR stops the run
warning= N warning=Y: a step with a WARNING stops it too

Before means from the start of the run: in a macro also the macros it calls and the ones that called it, but not the steps after the %pry line in its own macro. A chain of errors stops once, at the first. Your program's &SYSERR and &SYSCC stay as they are. rescue= works in macros and between steps, not inside a DATA step.

What you can do at the stop

Watch these parts: how did I get here, from 2:17 (35 seconds): bt shows that %nobs was called by %by_sev, up and down look from the caller, show-source prints the macro. Then move through the run, from 2:54 (1 minute): n, s, f, Enter, next 3, watch and break. All commands on one screen, at 6:36.

You want to Type
see where you are whereami (the lines around the stop), bt (which macro called which), up and down (look from the calling macro)
see the macro variables ls (this macro's), ls -g (your global ones), &i (one value)
look at a data set, as in VIEWTABLE vt work.class_m, then where age > 13, find Alfred, print (OBS=50), freq sex, means, dups usubjid
try something %LET i = 5;, a PROC or DATA step typed at the prompt, or edit: a SAS program in the editor, F4 runs it at the stop
go on next (n): the next line; step (s): into the macro called here; finish (f): to the end of this macro; continue (c): to the next %pry; !!!: end the run. next 3 takes three steps; Enter alone repeats the last next or step
more break 12 if &i. = 3 (stop at line 12 later), watch &total (stop where it changes), show-source %add_bmi, ? PROC REPORT, wtf? (the last error), hist, help

Only the macros around %pry are prepared for stepping (the ones with %pry, the ones they call, the ones that call them), so a large macro library runs as fast as without. The setting datastepStudio.debug.pry off makes %pry do nothing.

Data at the stop, as in VIEWTABLE

Watch this part: the data as it is now, from 1:33 (45 seconds). vt opens a data set at the stop, then where, freq aesev, dups usubjid and print (OBS=3) look into it.

vt work.class_m goes into a data set as it is at this point of the run and shows its first 20 rows (it also opens in the Data view). Other rows are chosen as in PROC PRINT: vt work.big(FIRSTOBS=101 OBS=120) shows rows 101 to 120, print (OBS=50) the first 50 (OBS= is the number of the last row, counted among the rows that meet the WHERE; OBS=MAX shows all; print 50 is short for OBS=50). where age > 13 stays until where clear; show, forward, backward, find, contents, keep, drop and sort age desc work on it. With the same WHERE: count, freq sex (two columns: a cross table), means, profile, dups usubjid, compare work.other by usubjid and sql SELECT .... The SAS Pry terminal does all of this without a stop too, on your SAS session.

%pry: freq at the stop, with the WHERE in effect

Code at the stop, in the editor

Watch this part: try the fix first, from 3:57 (50 seconds). A macro call and a %LET typed at the prompt, then edit: a PROC step written with autocomplete runs at the stop with F4. The short version: code at the stop, in 90 seconds.

edit at the prompt, or DataStep Studio: New SAS Program at the %pry Pause, opens a new SAS program with everything the editor offers: autocomplete, which knows the data sets the run has made so far, help on hover, keyboard macros. F4 there, or in any SAS program, runs the code at the stop, with its WORK and its macro variables (&age. is the value at the stop). Try a PROC step or a fix this way before you change the program; the log and the output come as from any run. At the prompt a step can go over several lines too: the prompt shows * until RUN; or QUIT;, ! starts again. SAS does not allow %IF, %DO or macro definitions in code that runs inside a paused macro.

%pry in a DATA step

Watch this part: %pry in a DATA step, from 5:22 (35 seconds). when= tests the row's variables: %pry(when=age >= 70) stops only for the subjects aged 70 or older, the Debug Console shows the row, n runs one statement. Longer, with sashelp.class: %pry in a DATA step, in 90 seconds.

DATA work.flagged;
  SET sashelp.class;
  bmi = weight / height**2 * 703;
  %pry(when=age > 14)
  flag = IFC(bmi > 20, "Y", "N");
  bmi = ROUND(bmi, 0.1);
RUN;

Run it with F4. The DATA step debugger starts and stops at flag = IFC(...), the statement right after %pry. It stops only for the rows where age > 14: in sashelp.class that is 5 of the 19 rows, the four 15-year-olds and Philip at 16. The Variables view shows the current row. At each stop, type in the Debug Console (the SAS Pry terminal is for macros and for %pry between steps):

  • ls shows the variables of the current row: bmi is already computed, flag is not set yet.
  • n runs one statement, the flag line: ls now shows flag = Y (Janet's bmi is 20.2). Note that in IF ... THEN x = 1; the part after THEN is a statement of its own: n stops there first.
  • c goes on to the next row where age > 14.

Why the next statement? %pry itself is not a DATA step statement, so nothing runs at that point while the step runs. DataStep Studio turns it into a breakpoint on the statement that follows it, the earliest point in the step where it can stop. The code before the DATA step runs first, the code after it when the step has ended.

Not the same as %pry in a macro:

In a macro In a DATA step
when= tests macro variables: when=&age. = 14 the variables of the current row: when=age > 14 (no &)
How often it stops each time the run reaches the line once for every row where when= is true
What waits the macro, between two steps the DATA step, between two statements
What you look at macro variables and the data sets made so far the variables of the current row
Where you type the SAS Pry terminal or the Debug Console the Debug Console

In a DATA step, %pry(when=...) is a conditional breakpoint written into the code.

Between steps

Watch this part: between steps, from 5:55 (40 seconds). A program without macros waits at %pry; next runs one step and waits again, vt shows what each step made, c runs the rest.

%pry between two steps, outside any macro: the program runs up to it and waits, and your SAS session is free while it waits. next runs the next step and waits again, which takes a long program step by step (next 3 takes three steps, Enter alone repeats the last one), and continue runs the rest up to the next %pry (also the status bar item, or DataStep Studio: Continue After %pry).

Without DataStep Studio

DataStep Studio: Open pry.sas gives you %pry in plain SAS for SAS Studio, Enterprise Guide or batch: %pry_on in the session that runs; in a second session %pry_do(whereami), %pry_do(%NRSTR(&i)), %pry_do(%NRSTR(PROC PRINT DATA=work.x; RUN;)), %pry_do(continue). No stepping there.

Good to know: SAS keeps the session's macros locked while a macro runs. reload %macro after a change therefore compiles it when the run ends; the next run uses it.

14. Keys

Use the keys your fingers already know, and change any of them.

F9 opens the Keys tab: every command with its keys. Click + and press the keys to add one, × removes one, ↺ goes back to the default.

Keys

Key What it does
F4, Cmd/Ctrl+Enter; F3, F8 Run
Ctrl+Alt+Up / Ctrl+Alt+Down Run To Line / Run From Line
F2 Clear Log and Output
F12 Open the last data set created
F9 Show Keys
Shift+F4 Close the open data set (in a data set tab also F3 and Alt+W)
Ctrl+Alt+R Resolve Code (in a program) / show all rows again (in a data set)
Ctrl+Alt+E / Ctrl+Alt+I WHERE with this value / pick values (in a data set)
Ctrl+Shift+E / Ctrl+Shift+O Enlarge / Optimize Macro Call
Ctrl+Alt+D Open the data set at the cursor
Ctrl+Alt+C SAS command box
Ctrl+Alt+L / Ctrl+Alt+O / Ctrl+Alt+T Show SAS Log / SAS Output / SAS Data

Keys you know from SAS

Switching from the SAS Enhanced Editor? Most of your keys work right away.

SAS Enhanced Editor Key in DataStep Studio Notes
Run or submit F3 or F8 also F4 and Cmd/Ctrl+Enter
Close the data set Shift+F4 in a data set tab also F3, as in a SAS data window
Comment / uncomment lines Ctrl+K puts /* */ around each line; press again to remove it
Stop the running code (Ctrl+Break) Stop SAS button appears while SAS runs; WORK stays
Upper case / lower case Ctrl+Shift+U / Ctrl+Shift+L the selection, or the word at the cursor
Clean up the code Ctrl+Shift+F formats the highlighted code
Matching DO / END Alt+PageUp / Alt+PageDown to the start / end of the block; press again for the block around it
Find / Replace / Go to line Ctrl+F / Ctrl+H / Ctrl+G VS Code's own
Copy / Paste / Cut, Undo, Select all as in SAS VS Code's own
Close the window Ctrl+F4 VS Code's own (Mac: Cmd+W)

On a Mac use Cmd where SAS uses Ctrl, except for Ctrl+Shift+U, Ctrl+Shift+L and Ctrl+Shift+F.

Why Ctrl+K and not Ctrl+/? On many keyboards, German ones for example, / needs Shift, so Ctrl+/ and Ctrl+Shift+/ would land on the same keys. Ctrl+K works everywhere. In SAS programs it replaces VS Code's two-key shortcuts that start with Ctrl+K.

When the official SAS extension is installed, F3 and F8 belong to it, and DataStep Studio runs with F4 and Cmd/Ctrl+Enter. The setting datastepStudio.sasKeys (auto, on, off) decides.

Keyboard macros

Stop typing the same PROC SORT for the hundredth time.

Type a short name in a program and press Tab: the code is written for you, as with abbreviations in the SAS Enhanced Editor.

Try it

  1. In a SAS program type sort and press Tab:

    PROC SORT DATA=have OUT=want; BY usubjid; RUN;
    
  2. Press Tab again to jump from have to want to usubjid and type over them.

  3. Try ifelse, merge, header or %nobs the same way.

80 keyboard macros come with DataStep Studio. Some favourites:

Type and Tab writes
sort, nodupkey, data, merge everyday steps
ifelse, select IF / ELSE IF / ELSE or SELECT, with an ERROR for anything not assigned
sql, join, into PROC SQL: a new table, a left join, values into a macro variable
freq, means, transpose, compare the procedure with its output data set
%nobs, %varexist, %varlist, %varfmt macros that tell you about a data set or a variable
dupcheck, bign, %required, qcopts quick checks: duplicate keys, subjects per group, a required parameter
rtf, xpt, import, export output and files
header, headerm, change a program or macro header, with the file name and today's date

All 80 with their code: Appendix: Keyboard macros.

Bring your own from SAS. In the SAS Enhanced Editor choose Tools → Keyboard Macros → Macros → Export. Then in VS Code run DataStep Studio: Import Keyboard Macros from SAS (.kmf). Your macros keep their names; one with the same name as a built-in one replaces it. Export (.kmf) works the other way round, so a team can share one set.

Make your own. Select some code, right-click → Save Selection as Keyboard Macro…, and give it a name.

Manage them. The Keys tab (F9) lists them under Keyboard macros: + gives one its own key, Edit opens its code, Delete removes it. A project's .vscode/settings.json can hold a team's set (datastepStudio.keyboardMacros); datastepStudio.builtInKeyboardMacros switches the built-in ones off.

15. Git on the SAS server

(Professional)

Your repository lives on the SAS server? Pull and push from VS Code.

In the SAS Server window, Pull from GitHub and Commit and Push to GitHub work on repositories cloned on the server. With datastepStudio.server.autoPush, every save becomes a commit and is pushed a moment later.

16. Editions and license

Everything you need to write, run and check SAS is free. Professional adds the debuggers and the smart helpers.

Community — always free Professional
Run modes, SAS Log, Suspicious Log, SAS Output ✓ ✓
Data viewer with filters and WHERE keys ✓ ✓
Libraries, Variables, Options (change values), Created Files ✓ ✓
SAS Server window, project sync ✓ ✓
Autocomplete, hover documentation, parameter hints ✓ ✓
Format SAS Program ✓ ✓
Keyboard macros (80 built in, import and export of SAS .kmf files) ✓ ✓
Run in Batch, Stop SAS ✓ ✓
Keys tab, keys you know from SAS, layouts (WSAVE ALL) ✓ ✓
DATA step debugger ✓
Macro debugger with call pane and code coverage ✓
%pry, the SAS Pry terminal, pry.sas ✓
Smart code: step templates, MERGE, value lists, your macro calls ✓
Enlarge / Optimize macro calls ✓
Git on the SAS server (pull, commit and push, auto push) ✓
File Manager: your computer and the SAS server side by side ✓

Community Early Access. All Professional features are available free of charge during Early Access. Early Access is temporary. Professional functionality may require a paid license following the Early Access period. Free Community functionality will remain available.

You don't need to sign up or enter anything. DataStep Studio: License and Edition shows your edition, its date and every feature: ✓ where it is on, 🔒 for a Professional feature after Early Access. Enter License… takes a license you received.

License and Edition

17. Settings

Everything works without changing a setting. When you want DataStep Studio to behave differently, open Settings (Cmd+, / Ctrl+,) and search for the name in the first column.

Setting Default What it is for
datastepStudio.connectionProfiles your connection profiles (Add New Connection Profile writes them; passwords stay in the keychain)
datastepStudio.java / datastepStudio.python found Java and Python with SASPy, when they are in an unusual place
datastepStudio.cfgname oda your own SASPy configuration, used when there is no profile
datastepStudio.autoexec OPTIONS NOTES; code that runs after connecting
datastepStudio.keepAliveMinutes / idleCloseMinutes 5 / 30 keep the session alive while you work; close it when idle
datastepStudio.layout.showOnConnect on open the SAS tabs when SAS connects
datastepStudio.data.openIn editor data sets as editor tabs or in the SAS Data panel
datastepStudio.templates your Run in Template templates (${CODE} marks your code)
datastepStudio.graphs.show on graphs of a run in SAS Output (Graphs in SAS Output)
datastepStudio.odsFiles.open / odsFiles.types ask / pdf, rtf, pptx, xlsx, docx open the ODS files a run wrote (Open ODS files after a run)
datastepStudio.log.suspiciousNotes / suspiciousIgnore your Suspicious Log rules
datastepStudio.keys your keys (the Keys tab writes it)
datastepStudio.sasKeys auto F3 and F8 run, as in SAS
datastepStudio.format.* the rules of Format SAS Program
datastepStudio.keyboardMacros your keyboard macros
datastepStudio.sync.askFolder on ask which folder to copy to SAS OnDemand
datastepStudio.server.autoPush off Git: commit and push each save (Professional)
datastepStudio.debug.pry / debug.pryTerminal on / on %pry stops a run; open the SAS Pry terminal at each stop (Professional)

18. Troubleshooting

Something does not work? Look for the sentence that matches what you see. Still stuck: DataStep Studio: Send Feedback.

Check Setup says Java or Python is missing, but it is installed. Set datastepStudio.java or datastepStudio.python to its full path. In a terminal, which java (Mac) or where java (Windows) shows it.

Connecting fails. The error offers the fix: Enter Password Again for a wrong or changed password, or Check Setup. Wrong home region? Run Add New Connection Profile again with the right one; the same name replaces the old profile.

"The application could not log on to the server … configuration is invalid". SAS OnDemand refused the session: a wrong user or password, or too many sessions of the same account at once (another DataStep Studio window, SAS Studio, a script). Close the others and connect again.

"Failed to start the server". SAS OnDemand refuses new sessions for a while after many starts or a crash. Wait a few minutes; don't retry in a loop.

The DATA step debugger says it needs SASPy 5.102 to 5.109. Run DataStep Studio: Check Setup and choose Install SASPy, then DataStep Studio: Restart SAS Session.

The SAS Server window shows a "!" on its folder, or no DataStep Studio commands. The window is in Restricted Mode. Trust it: Workspaces: Manage Workspace Trust → Trust (see Work on the SAS server), or update DataStep Studio.

Ctrl+Space does not open the suggestions on a Mac. macOS uses Control+Space to switch the keyboard language. Use Cmd+I, or turn off Select the previous input source in System Settings → Keyboard → Keyboard Shortcuts → Input Sources.

A key does nothing. Another extension may use it. The Keys tab shows the keys in effect; DataStep Studio: Make DataStep Studio Shortcuts Win in SAS Files puts DataStep Studio's keys first.

Enlarge Macro Call says the definition is not known. Open the file that defines the macro, or keep it in the program's folder, a folder above it, a macros folder next to one of them, or a SASAUTOS folder.

"Unable to write to User Settings … not a registered configuration". DataStep Studio was updated while the window was open. Run Developer: Reload Window.

WORK is full. SAS OnDemand limits the WORK space. Delete large data sets you no longer need (PROC DATASETS LIBRARY=WORK KILL NOLIST; QUIT;, or the keyboard macro kill).

None of this helps, or you have a question. Run DataStep Studio: Report a Problem. It copies the error message and the versions (the names of your home folders are hidden) and asks where the question should go:

  • Ask on the Marketplace page: in public, so others with the same problem find the answer.
  • Write to the author: in private. An email opens in your own mail program with the versions filled in. Nothing is sent until you send it. Use this for anything about your company's SAS server or your setup.

DataStep Studio: Send Feedback offers the same two ways for questions and ideas.

Appendix: Keyboard macros

The 81 keyboard macros DataStep Studio brings. Type the name in a SAS program and press Tab. In the code below, words such as have, want, usubjid or condition are the places Tab moves to; type over them. A header fills in the file name and today's date. Your own keyboard macros replace a built-in one of the same name.

Macro language

%macro New macro: %MACRO name(params); … %MEND

%MACRO name(params);

%MEND name;

%do Loop over the words of a list (%DO with %SCAN)

%DO i = 1 %TO %SYSFUNC(COUNTW(&list.));
  %LET word = %SCAN(&list., &i.);

%END;

%if %IF condition %THEN %DO; … %END;

%IF condition %THEN %DO;

%END;

%ifelse %IF … %THEN %DO; … %END; %ELSE %DO; … %END;

%IF condition %THEN %DO;

%END;
%ELSE %DO;

%END;

%error ERROR message from macro code (%PUT, split so log checks skip this line)

%PUT %STR(ERR)OR: [macro] message;

%warning WARNING message from macro code (%PUT, split so log checks skip this line)

%PUT %STR(WAR)NING: [macro] message;

%quote_list Defines %quote_list(list): every word in double quotes

%MACRO quote_list(list, dlm=%STR( ));
  %LOCAL i out;
  %DO i = 1 %TO %SYSFUNC(COUNTW(&list., &dlm.));
    %LET out = &out. "%SCAN(&list., &i., &dlm.)";
  %END;
  &out.
%MEND quote_list;

wrap Turn the selected code into a macro and call it

%MACRO wrap;

%MEND wrap;
%wrap;

Data set and variable information

%exist Does a data set exist? %SYSFUNC(EXIST(lib.dsn))

%SYSFUNC(EXIST(lib.dsn))

%nobs Defines %nobs(data): number of observations

%MACRO nobs(data);
  %LOCAL dsid n rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. %THEN %DO;
    %LET n  = %SYSFUNC(ATTRN(&dsid., NLOBS));
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &n.
  %END;
  %ELSE %PUT %STR(WAR)NING: [nobs] cannot open &data.;
%MEND nobs;

%varexist Defines %varexist(data, var): position of a variable, 0 if missing

%MACRO varexist(data, var);
  %LOCAL dsid pos rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. %THEN %DO;
    %LET pos = %SYSFUNC(VARNUM(&dsid., &var.));
    %LET rc  = %SYSFUNC(CLOSE(&dsid.));
    &pos.
  %END;
  %ELSE 0
%MEND varexist;

%vartype Defines %vartype(data, var): N or C

%MACRO vartype(data, var);
  %LOCAL dsid type rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. %THEN %DO;
    %LET type = %SYSFUNC(VARTYPE(&dsid., %SYSFUNC(VARNUM(&dsid., &var.))));
    %LET rc   = %SYSFUNC(CLOSE(&dsid.));
    &type.
  %END;
%MEND vartype;

%dslabel Defines %dslabel(data): label of a data set

%MACRO dslabel(data);
  %LOCAL dsid label rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. %THEN %DO;
    %LET label = %SYSFUNC(ATTRC(&dsid., LABEL));
    %LET rc    = %SYSFUNC(CLOSE(&dsid.));
    &label.
  %END;
  %ELSE %PUT %STR(WAR)NING: [dslabel] cannot open &data.;
%MEND dslabel;

%varfmt Defines %varfmt(data, var): format of a variable

%MACRO varfmt(data, var);
  %LOCAL dsid pos fmt rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. = 0 %THEN %PUT %STR(WAR)NING: [varfmt] cannot open &data.;
  %ELSE %DO;
    %LET pos = %SYSFUNC(VARNUM(&dsid., &var.));
    %IF &pos. %THEN %LET fmt = %SYSFUNC(VARFMT(&dsid., &pos.));
    %ELSE %PUT %STR(WAR)NING: [varfmt] &var. is not in &data.;
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &fmt.
  %END;
%MEND varfmt;

%varlabel Defines %varlabel(data, var): label of a variable

%MACRO varlabel(data, var);
  %LOCAL dsid pos label rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. = 0 %THEN %PUT %STR(WAR)NING: [varlabel] cannot open &data.;
  %ELSE %DO;
    %LET pos = %SYSFUNC(VARNUM(&dsid., &var.));
    %IF &pos. %THEN %LET label = %SYSFUNC(VARLABEL(&dsid., &pos.));
    %ELSE %PUT %STR(WAR)NING: [varlabel] &var. is not in &data.;
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &label.
  %END;
%MEND varlabel;

%varlen Defines %varlen(data, var): length of a variable

%MACRO varlen(data, var);
  %LOCAL dsid pos len rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. = 0 %THEN %PUT %STR(WAR)NING: [varlen] cannot open &data.;
  %ELSE %DO;
    %LET pos = %SYSFUNC(VARNUM(&dsid., &var.));
    %IF &pos. %THEN %LET len = %SYSFUNC(VARLEN(&dsid., &pos.));
    %ELSE %PUT %STR(WAR)NING: [varlen] &var. is not in &data.;
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &len.
  %END;
%MEND varlen;

%varlist Defines %varlist(data): all variable names, in their order

%MACRO varlist(data);
  %LOCAL dsid i list rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. = 0 %THEN %PUT %STR(WAR)NING: [varlist] cannot open &data.;
  %ELSE %DO;
    %DO i = 1 %TO %SYSFUNC(ATTRN(&dsid., NVARS));
      %LET list = &list. %SYSFUNC(VARNAME(&dsid., &i.));
    %END;
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &list.
  %END;
%MEND varlist;

%nvars Defines %nvars(data): number of variables

%MACRO nvars(data);
  %LOCAL dsid n rc;
  %LET dsid = %SYSFUNC(OPEN(&data.));
  %IF &dsid. = 0 %THEN %PUT %STR(WAR)NING: [nvars] cannot open &data.;
  %ELSE %DO;
    %LET n  = %SYSFUNC(ATTRN(&dsid., NVARS));
    %LET rc = %SYSFUNC(CLOSE(&dsid.));
    &n.
  %END;
%MEND nvars;

%libexist Is a libref assigned? 1 or 0

%EVAL(%SYSFUNC(LIBREF(lib)) = 0)

%fileexist Does a file exist? 1 or 0

%SYSFUNC(FILEEXIST(/path/file.sas))

%words Number of words in a list

%SYSFUNC(COUNTW(&list., %STR( )))

%today Today's date, e.g. for a footnote (08OCT2026)

%SYSFUNC(TODAY(), DATE9.)

DATA step

data New DATA step: DATA … SET … RUN

DATA want;
  SET have;

RUN;

merge Merge two data sets with IN= flags

DATA want;
  MERGE have1 (IN=in_a)
        have2 (IN=in_b);
  BY usubjid;
  IF in_a AND in_b;

RUN;

ifelse IF / ELSE IF / ELSE, ERROR when nothing is assigned

     IF condition1 THEN var = value1;
ELSE IF condition2 THEN var = value2;
ELSE                    PUT "ERR" "OR: var not assigned " usubjid=;

select SELECT / WHEN / OTHERWISE, ERROR when nothing is assigned

SELECT (var);
  WHEN (1) result = "one";
  WHEN (2) result = "two";
  OTHERWISE PUT "ERR" "OR: var not assigned " usubjid=;
END;

doarray DO loop over all elements of an array

DO i = 1 TO DIM(arr);

END;

dountil DO UNTIL loop

DO UNTIL (condition);

END;

error ERROR message from a DATA step (PUT, split so log checks skip this line)

PUT "ERR" "OR: message " usubjid=;

warning WARNING message from a DATA step (PUT, split so log checks skip this line)

PUT "WAR" "NING: message " usubjid=;

attrib Length, label and format of a variable in one statement

ATTRIB var LENGTH=$20 LABEL="label" FORMAT=$20.;

firstlast Sort, then FIRST. and LAST. of a BY group

PROC SORT DATA=have OUT=sorted; BY usubjid adt; RUN;

DATA want;
  SET sorted;
  BY usubjid adt;
  IF FIRST.usubjid THEN n = 0;
  n + 1;
  IF LAST.usubjid;
RUN;

hash Look values up in another data set with a hash, no sort and merge

DATA want;
  IF 0 THEN SET lookup;
  IF _N_ = 1 THEN DO;
    DECLARE HASH h(DATASET: "lookup");
    h.DEFINEKEY("usubjid");
    h.DEFINEDATA("var");
    h.DEFINEDONE();
  END;
  SET have;
  IF h.FIND() NE 0 THEN CALL MISSING(var);
RUN;

Procedures

sort Sort a data set (PROC SORT on one line)

PROC SORT DATA=have OUT=want; BY usubjid; RUN;

nodupkey Sort and drop duplicate keys (PROC SORT NODUPKEY)

PROC SORT DATA=have OUT=want NODUPKEY; BY usubjid; RUN;

sql New table with PROC SQL (SELECT, FROM, WHERE, ORDER BY)

PROC SQL;
  CREATE TABLE want AS
    SELECT *
    FROM have
    WHERE condition
    ORDER BY usubjid;
QUIT;

join Left join of two tables (PROC SQL)

PROC SQL;
  CREATE TABLE want AS
    SELECT a.*, b.var
    FROM have1 AS a
    LEFT JOIN have2 AS b
    ON a.usubjid = b.usubjid;
QUIT;

into Values of a column into a macro variable (SELECT INTO)

PROC SQL NOPRINT;
  SELECT var INTO :list SEPARATED BY " "
    FROM have
    WHERE condition;
QUIT;

columns Variable names of a data set into a macro variable

PROC SQL NOPRINT;
  SELECT name INTO :vars SEPARATED BY " "
    FROM dictionary.columns
    WHERE libname = "WORK" AND memname = "HAVE"
    ORDER BY varnum;
QUIT;

freq Counts into a data set (PROC FREQ)

PROC FREQ DATA=have NOPRINT;
  TABLES var1 * var2 / OUT=freq_out;
RUN;

means n, mean, SD, median, min, max into a data set (PROC MEANS)

PROC MEANS DATA=have NOPRINT NWAY;
  CLASS trt01p;
  VAR aval;
  OUTPUT OUT=stats N=n MEAN=mean STD=sd MEDIAN=median MIN=min MAX=max;
RUN;

summary Counts per group into a data set (PROC SUMMARY)

PROC SUMMARY DATA=have NWAY MISSING;
  CLASS var;
  OUTPUT OUT=counts (DROP=_TYPE_ RENAME=(_FREQ_ = count));
RUN;

rank Ranks of a variable (PROC RANK)

PROC RANK DATA=have OUT=ranked TIES=HIGH;
  VAR var;
  RANKS var_rank;
RUN;

transpose Long to wide (PROC TRANSPOSE)

PROC TRANSPOSE DATA=have OUT=wide PREFIX=col_;
  BY usubjid;
  ID paramcd;
  IDLABEL param;
  VAR aval;
RUN;

compare QC: compare two data sets, differences into a data set

PROC COMPARE BASE=prod COMPARE=qc OUT=diff OUTNOEQUAL OUTBASE OUTCOMP OUTDIF
             LISTALL CRITERION=0.0001 METHOD=ABSOLUTE;
  ID usubjid;
RUN;

contents List the variables of a data set (PROC CONTENTS)

PROC CONTENTS DATA=have SHORT VARNUM; RUN;

format New format (PROC FORMAT VALUE)

PROC FORMAT;
  VALUE name
    1 = "label"
    ;
RUN;

fmtlib Show the values of a format and keep them as a data set

PROC FORMAT LIBRARY=work FMTLIB CNTLOUT=fmt_out; SELECT name; RUN;

print Print the first rows of a data set (PROC PRINT)

PROC PRINT DATA=have (OBS=20) LABEL;
  WHERE condition;
RUN;

report Listing with PROC REPORT: order, display, a line after each group

PROC REPORT DATA=have NOWD HEADLINE HEADSKIP SPLIT="|";
  COLUMN grp var1 var2;
  DEFINE grp  / ORDER "Group";
  DEFINE var1 / DISPLAY "Label 1";
  DEFINE var2 / DISPLAY "Label 2";
  BREAK AFTER grp / SKIP;
RUN;

modify Rename, relabel or re-format without a DATA step (PROC DATASETS)

PROC DATASETS LIBRARY=work NOLIST;
  MODIFY have (LABEL="data set label");
  RENAME old = new;
  LABEL new = "label";
  FORMAT new DATE9.;
RUN;
QUIT;

sgplot A plot with PROC SGPLOT

PROC SGPLOT DATA=have;
  SCATTER X=x Y=y / GROUP=grp;
RUN;

QC and checks

dupcheck Duplicate keys into a data set (PROC SQL)

PROC SQL;
  CREATE TABLE dups AS
    SELECT usubjid, COUNT(*) AS n
    FROM have
    GROUP BY usubjid
    HAVING COUNT(*) > 1;
QUIT;

nsubj Number of distinct subjects into a macro variable

PROC SQL NOPRINT;
  SELECT COUNT(DISTINCT usubjid) INTO :nsubj TRIMMED
    FROM have;
QUIT;

bign Subjects per group into macro variables &n1. &n2. … (the N of a table header)

PROC SQL NOPRINT;
  SELECT COUNT(DISTINCT usubjid) INTO :n1-
    FROM adsl
    GROUP BY trt01pn
    ORDER BY trt01pn;
QUIT;

%required Stop a macro with an ERROR when a required parameter is empty

%IF %LENGTH(&param.) = 0 %THEN %DO;
  %PUT %STR(ERR)OR: [macro] param= is required.;
  %RETURN;
%END;

syserr Stop when the step before failed

%IF &SYSERR. > 4 %THEN %DO;
  %PUT %STR(ERR)OR: [program] the step before failed, SYSERR=&SYSERR.;
  %ABORT CANCEL;
%END;

qcopts Strict options: MERGE without BY, unknown variables in KEEP/DROP and uninitialised variables are errors

OPTIONS MERGENOBY=ERROR DKRICOND=ERROR DKROCOND=ERROR VARINITCHK=ERROR MSGLEVEL=I;

putuser Show all your macro variables in the log

%PUT _USER_;

Output and files

odsoutput A procedure's table as a data set (ODS TRACE names it, ODS OUTPUT keeps it)

ODS TRACE ON;
ODS OUTPUT Summary=want;

ODS TRACE OFF;

rtf Output to an RTF file

ODS ESCAPECHAR="^";
ODS LISTING CLOSE;
ODS RTF FILE="output.rtf" STYLE=Journal;

ODS RTF CLOSE;
ODS LISTING;

xpt A transport file (.xpt) of a data set, e.g. for a submission

LIBNAME xpt XPORT "/path/adsl.xpt";
PROC COPY IN=work OUT=xpt MEMTYPE=DATA;
  SELECT adsl;
RUN;
LIBNAME xpt CLEAR;

%dirlist Defines %dirlist(path): the files of a folder into a data set (filter= a pattern such as *.sas)

%MACRO dirlist(path, out=dirlist, filter=);
  DATA &out. (KEEP=name);
    LENGTH name $256 pattern $512;
    /* the file name pattern as a regular expression: * any characters, ? one character */
    pattern = CATS("/^", TRANWRD(TRANWRD(TRANWRD("&filter.", ".", "\."), "*", ".*"), "?", "."), "$/i");
    rc      = FILENAME("_dir", "&path.");
    did     = DOPEN("_dir");
    IF did > 0 THEN DO i = 1 TO DNUM(did);
      name = DREAD(did, i);
      %IF %LENGTH(&filter.) %THEN %DO;
        IF PRXMATCH(pattern, STRIP(name)) THEN OUTPUT;
      %END;
      %ELSE %DO;
        OUTPUT;
      %END;
    END;
    ELSE PUT "WAR" "NING: [dirlist] cannot open &path.";
    rc = DCLOSE(did);
    rc = FILENAME("_dir");
  RUN;
%MEND dirlist;

import Read an Excel or CSV file into a data set (PROC IMPORT)

PROC IMPORT DATAFILE="/path/file.xlsx" OUT=want DBMS=XLSX REPLACE;
  GETNAMES=YES;
RUN;

export Write a data set to a CSV or Excel file (PROC EXPORT)

PROC EXPORT DATA=have OUTFILE="/path/file.csv" DBMS=CSV REPLACE;
RUN;

Session

debug_on Macro debugging on (MPRINT MLOGIC SYMBOLGEN)

OPTIONS MPRINT MLOGIC SYMBOLGEN MPRINTNEST MLOGICNEST;

debug_off Macro debugging off

OPTIONS NOMPRINT NOMLOGIC NOSYMBOLGEN NOMPRINTNEST NOMLOGICNEST;

mfile Save the code a macro generates to a file

FILENAME mprint "resolved.sas";
OPTIONS MPRINT MFILE;

OPTIONS NOMFILE;
FILENAME mprint CLEAR;

options NOTES and SOURCE off for a while, then back as they were

%LET saved = %SYSFUNC(GETOPTION(NOTES)) %SYSFUNC(GETOPTION(SOURCE));
OPTIONS NONOTES NOSOURCE;

OPTIONS &saved.;

printto Output to a .lst file, then back

PROC PRINTTO PRINT="output.lst" NEW; RUN;

PROC PRINTTO; RUN;

sasautos Add a folder of macros to the autocall path

OPTIONS SASAUTOS=("/path/to/macros" sasautos);

session Unstick SAS after an unclosed quote, comment or macro

/* '); * "); */; *)%MEND;;
%PUT NOTE: macro code runs again;
DATA _NULL_; PUT "NOTE: DATA steps run again"; RUN;

reset Clear titles and footnotes, output back to normal

TITLE;
FOOTNOTE;
PROC PRINTTO; RUN;

delete Delete the WORK data sets that start with a prefix

PROC DATASETS LIBRARY=work NOLIST NOWARN;
  DELETE tmp_:;
RUN;
QUIT;

kill Delete all WORK data sets

PROC DATASETS LIBRARY=work KILL NOLIST NOWARN MEMTYPE=DATA;
RUN;
QUIT;

killsome Delete all WORK data sets except the ones named

PROC DATASETS LIBRARY=work KILL NOLIST NOWARN;
  SAVE keep_me / MEMTYPE=DATA;
  SAVE formats / MEMTYPE=CATALOG;
RUN;
QUIT;

symdel Delete all global macro variables

PROC SQL NOPRINT;
  CREATE TABLE _symdel AS
    SELECT name
    FROM dictionary.macros
    WHERE scope = "GLOBAL" AND SUBSTR(name, 1, 3) NE "SYS";
QUIT;
DATA _NULL_;
  SET _symdel;
  CALL SYMDEL(name, "NOWARN");
RUN;
PROC DELETE DATA=_symdel; RUN;

Headers and comments

comment Comment block

/***********************************************************************
* comment
***********************************************************************/

header Program header: study, program, programmer, date …

/*======================================================================
* STUDY            : study
* PROGRAM          : program.sas
* PROGRAMMER       : name
* CREATION DATE    : 2026-01-31
* DESCRIPTION      : description
* INPUT            : input
* OUTPUT           : output
* SAS VERSION      : SAS 9.4
*======================================================================*/

headerm Macro header: purpose, parameters, example …

/*======================================================================
* MACRO            : name
* PURPOSE          : purpose
* PROGRAMMER       : name
* CREATION DATE    : 2026-01-31
* PARAMETERS       : param description
* OUTPUT           : output
* EXAMPLE          : %name()
* SAS VERSION      : SAS 9.4
*======================================================================*/

change Change note: who, when, why

/***********************************************************************
* CHANGED BY       : name
* DATE             : 2026-01-31
* REASON           : reason
***********************************************************************/

The SAS syntax data for autocomplete and hover comes from the SAS Extension for Visual Studio Code by SAS Institute Inc., and a modified SASPy class (both Apache License 2.0; see THIRD_PARTY_NOTICES.txt). SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. DataStep Studio is an independent project and is not affiliated with or endorsed by SAS Institute Inc.


How-to guide

Short recipes for everyday SAS work: what you want to do, and the steps to get there. The user manual explains every feature in full.


Connect for the first time

  1. Run DataStep Studio: Check Setup. It finds Java and Python. If SASPy is missing, click Install SASPy.
  2. Run DataStep Studio: Add New Connection Profile → SAS OnDemand for Academics.
  3. Choose your home region (it is in the web address of SAS Studio, e.g. euw1 = Europe 1) and enter your user ID.
  4. Click Connect Now and enter your password. It is asked once and kept in your computer's keychain.
  5. Open a .sas file and press F4.

Switch between SAS OnDemand and the company server

  1. Add a second profile: Add New Connection Profile → SAS 9.4 server (IOM) → host, port, user.
  2. Run DataStep Studio: Switch Connection Profile and pick the one you want.

The status bar shows the active profile. The next run connects with it.

Run only the step I am in

  1. Put the cursor in the step.
  2. Click Run Step in the title bar (the ▷ menu).
  3. Pick what to run: a single SQL statement, the whole PROC or DATA step, the macro call or the %MACRO definition.

Run everything up to here

Put the cursor on a line and press Ctrl+Alt+Up. Everything from the top down to that line runs; a step that contains the line runs completely.

Stop a program that runs too long

Click Stop SAS in the status bar (it appears while SAS runs). The running code stops, like Ctrl+Break in SAS. Your WORK data sets and macro variables stay.

Find out why the log is not clean

  1. Open the Suspicious Log tab, next to the SAS Log.
  2. It lists only the ERRORs, WARNINGs and NOTEs that matter (uninitialized variables, missing values generated, repeats of BY values …), from every run.
  3. Click a line: the cursor jumps to the statement that caused it.

Flag a NOTE our team does not accept

  1. Open the settings and search for datastepStudio.log.suspiciousNotes.
  2. Click Add Item and enter a pattern, for example Table WORK\.\w+ created, with 0 rows.

A message you know is harmless goes into datastepStudio.log.suspiciousIgnore instead.

Look at the data set I just made

Press F12. Or double-click the data set in Libraries, or press Ctrl+Alt+D with the cursor on its name in your program.

Keep only two treatment arms in the data viewer

  1. Click a cell with one of the two arms, for example Drug 10 mg, in the treatment column.
  2. Press Ctrl+Alt+I: that value is ticked already. Tick the second, Drug 20 mg, with Space.
  3. Press Enter. The WHERE box now holds trt01p IN ('Drug 10 mg', 'Drug 20 mg').

Ctrl+Alt+E keeps only the value of the cell; Ctrl+Alt+R shows all rows again.

Write a PROC SORT in five seconds

Type sort and press Tab: PROC SORT DATA=have OUT=want; BY usubjid; RUN;. Press Tab to jump from have to want to usubjid and type over them. (With Professional, proc so + Enter also suggests your own data sets and keys.)

Type a WHERE value without looking it up

Type WHERE paramcd = ' and the values of PARAMCD in your data appear, the most frequent first. (Professional)

Open the macro my program calls

Right-click the call (for example %derive_vars_dtm(...)) → Open Macro Definition / Included Program. Or Cmd+click / Ctrl+click it. The file that defines the macro opens at its %MACRO line. On a %INCLUDE "file" statement the same opens the included program.

Call my macro with all its parameters

Type % and the first letters of your macro (%deri for %derive_vars_dtm) and press Enter. The call is written with every parameter and its defaults. Press Tab to go from value to value. (Professional)

Clean up a long macro call

Put the cursor in the call and press Ctrl+Shift+O: the parameters at their default disappear. Press it again: the call goes on one line. Ctrl+Shift+E shows every parameter again. (Professional)

Tidy up a messy program

Right-click in the program → Format SAS Program. Keywords go upper case, names lower case, two spaces per level, one statement per line. To format only a part, highlight it and press Ctrl+Shift+F. Changed your mind? Cmd+Z (Ctrl+Z) takes it back.

Comment out a few lines

Highlight the lines and press Ctrl+K (Mac: Cmd+K). Each line gets /* */. Press it again to remove them.

Bring my keyboard macros from SAS

  1. In the SAS Enhanced Editor: Tools → Keyboard Macros → Macros → Export. You get a .kmf file.
  2. In VS Code: DataStep Studio: Import Keyboard Macros from SAS (.kmf) and pick the file.
  3. Type a name in a program and press Tab.

Keep a piece of code I write again and again

  1. Highlight the code.
  2. Right-click → Save Selection as Keyboard Macro…
  3. Give it a name, for example adslmerge. From now on adslmerge + Tab writes it.

Run my whole study, program after program

  1. Name the programs in the order they should run: 01_adsl.sas, 02_adae.sas, …
  2. In the Explorer, right-click their folder → Run in Batch.
  3. Keep working. Each program runs in a fresh SAS session and gets its .log file next to it.

Debug a macro loop (Professional)

  1. Open the program with the macro and click the blue Debug Macro button in the title bar.
  2. In the call pane above the macro, fill in the parameters.
  3. Click in the margin of a line inside the loop to set a breakpoint. Right-click it → Edit Breakpoint… → &i. = 5.
  4. Click Start Debug. F5 runs to the breakpoint; the Variables tab shows the macro variables.

Look inside a macro while it runs (Professional)

  1. Write %pry(when=&i. = 3) on its own line inside the macro, where you want to look.
  2. Run the program as always (F4). The run stops there, and the SAS Pry terminal opens.
  3. Type ls for the macro variables, vt work.mydata and freq sex for a data set as it is now.
  4. Type n to go on one line (Enter repeats it), c to go on to the end.
  5. To try code there: type edit, write the code in the editor that opens (autocomplete works), press F4.

Find the step that breaks a long run (Professional)

  1. Write %pry(rescue=Y) on its own line after the part that fails, for example at the end of the macro.
  2. Run as always (F4). The run stops right after the first step with an ERROR, before the next one.
  3. The SAS Pry terminal shows the ERROR. Type ls and vt to see the macro variables and the data of that moment.
  4. Fix the program, then type !!! to end the run, or c to let it go on.

Add warning=Y to stop at the first WARNING too.

Go through a program step by step (Professional)

  1. Write %pry on its own line before the step where you want to start, between two steps.
  2. Run as always (F4). Everything before it runs, then the program waits.
  3. Type next to run the next step and wait again; press Enter to do it once more. Look at the data with vt in between.
  4. Type c to run the rest.

Watch a DATA step work (Professional)

  1. Put the cursor in the DATA step and click Debug DATA Step in the title bar (or press F5).
  2. Press F10 to run one statement at a time. The Variables view shows every variable.
  3. To stop at one observation, give a breakpoint a condition, e.g. usubjid = "TEST12".

Change LINESIZE (or any system option)

  1. Open the Options tab and click 🔍.
  2. Type linesize, press Enter, type the new value, press Enter.

The row now shows (changed, was 132); ↺ puts the old value back.

Give a command my own key

Press F9 to open Keys. Click + next to the command and press the keys. ↺ puts the default back.

Keep my layout

Arrange the SAS tabs as you like, then type WSAVE ALL in the SAS command box (Ctrl+Alt+C). The same tabs open the next time SAS connects.

Keep my programs on my computer and run them on SAS OnDemand

Nothing to do: open the folder in VS Code and press F4. Before each run DataStep Studio copies the changed files of your project to the server and runs the program there, so %INCLUDE and LIBNAME with relative paths work. Use Git as usual on your computer.

Work directly on files on SAS OnDemand

Run DataStep Studio: Open SAS Server Folder. A window opens on your SAS OnDemand home: open, edit and save server programs as if they were local. To copy a folder there, drag it from Finder or Windows Explorer onto a folder in that window.

Copy programs to the server, or fetch logs and outputs (Professional)

  1. Run DataStep Studio: Open File Manager: your computer is on the left, the SAS server on the right.
  2. Go to the folders you need on both sides: arrow keys, Enter to open, Backspace to go up, Tab to change sides. Ctrl+L (Cmd+L) lets you type a folder; ~ is your home folder.
  3. Mark the files with Space (or Ctrl+A / Cmd+A for all).
  4. Press F5 to copy them to the other side, or F6 to move them. Enter confirms.

Dragging files to the other side works too. A name that exists there is asked about first.

See which edition I have

Run DataStep Studio: License and Edition. During Early Access it says Community Early Access: all Professional features are free.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft