You know the routine: write a step, run it, scroll through a long log, open the data set, look for the one row that went wrong. DataStep Studio makes each of those moments shorter. One key runs your code. The log points straight to the line with the problem. Your data opens with a double-click. And when a DATA step or a macro does something you do not understand, you can watch it work, line by line.
It works with SAS OnDemand for Academics (free) and with a SAS 9.4 server of your company.

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. See Editions.
New in 0.2.21: %pry. Write %pry where you want to look and run your program as always: the run waits there,
and you look at its data and macro variables, try a fix and go on. See %pry: a breakpoint in the code.
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.
-
Install the extension. In VS Code open the Extensions view (
Shift+Cmd+Xon a Mac,Shift+Ctrl+Xon Windows), search for DataStep Studio and click Install. (Details) -
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) -
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)
-
Run something. Create a file
first.sas, typeDATA 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.
-
Read the log. The SAS Log opens below your program, in colour. Problems are marked right at their line in your program. (Details)
-
Look at the data. Press F12: the data set you just made opens. Click a column and press
ffor 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
- Open a terminal (Mac: Terminal, Windows: Command Prompt) and type
java -version. - Version 1.8 or higher (or 11, 17, 21 …)? Then you are done.
- Otherwise install Eclipse Temurin from adoptium.net. On Windows tick Add to PATH. On a
Mac
brew install --cask temurinworks too.
2.2 Python
- In the terminal type
python3 --version(Windows:py --version). - 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.
- In VS Code open the Extensions view (
Shift+Cmd+Xon a Mac,Shift+Ctrl+Xon Windows and Linux). - Search for DataStep Studio and click Install.
- The first time, VS Code asks Do you trust the publisher "DataStep Labs"? Click Trust Publisher & Install.
- 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.
-
Open the Command Palette (
Shift+Cmd+P/Shift+Ctrl+P). -
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
-
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.

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
-
Run DataStep Studio: Add New Connection Profile.
-
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 oneFrom 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) -
Press Connect Now (or F4 in a
.sasfile). The first time it asks for your password and keeps it in your computer's keychain, never in a file.

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 |

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.pythontakes 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 settingdatastepStudio.connectionProfiles, or write it withdatastep-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, 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
- Put the cursor anywhere in your program and press F4: the whole program runs.
- Select a few lines and press F4: only those run.
- 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 in Batch
Run your whole study, program after program, each in a clean session, while you keep working.
Try it
- In the Explorer, right-click a folder (or select several programs) → Run in Batch.
- Keep working: your own session is not touched.
- 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.sasbefore10_adlb.sas). Name them01_adsl.sas,02_adae.sas, … to set the order. A folder runs its own.sasfiles, 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.logandprogram.lstare 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
- Run a program with a mistake, for example
y = ;in a DATA step. - The SAS Log shows the ERROR in red. Click it: the cursor jumps to that line of your program.
- Look at your program: the line has a red squiggle. The Problems tab lists every ERROR, WARNING and important NOTE with its line.
- Open the Suspicious Log tab: only the lines that need a look, nothing else.

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.suspiciousNotesadds patterns (for exampleTable WORK\.\w+ created, with 0 rows),datastepStudio.log.suspiciousIgnorehides 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
- Run DataStep Studio: Open SAS Server Folder (or click the button in an empty Explorer).
- A second window opens. Its folder is your SAS OnDemand home: open, edit, save, create, rename and delete files there as usual.
- 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";andFILENAMEwith 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.excludeDirsandexcludeFilesleave 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.

A video of 1:45 shows it in use: datastep-studio.pages.dev/#file-manager.
Try it
- 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.
- Move with the arrow keys, open a folder with Enter, go up with Backspace. Tab changes sides.
- Put the cursor on a file and press F5, then Enter: it is copied to the other side.
- 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
- Double-click a data set in Libraries (or press F12 for the last one created, or
Ctrl+Alt+Don a data set name in your program). - Click a column and press
f: its frequencies. - Press
Ctrl+Alt+Ion 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 givescolumn = 'value', two or morecolumn IN (...). Watch: the value picker.


More keys (? lists all of them):
- Move with the arrow keys and PageUp/PageDown;
ggoes 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 like01JAN2020. - Enter on a cell keeps rows with that value; Shift+Enter removes them.
Ctrl+Alt+Eaddscolumn = valueto the WHERE box;Ctrl+Alt+Rshows 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+Ffinds 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
fpanel: 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.

10. Write code faster: autocomplete, hover, parameter hints
Stop looking up option names. DataStep Studio knows SAS, and it knows your data.
Try it
- Type
PROCand pick a procedure from the list. - In a step that reads
sashelp.class, typeWHEREand see the columns ofsashelp.class. - Rest the mouse on
INTCK: its description, its syntax and a link to the SAS documentation. - Type
INTCK(: a hint shows which argument comes next.

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.


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
- Right-click a macro call, for example
%derive_vars_dtm(...). - Choose Open Macro Definition / Included Program: the file that defines the macro opens at its
%MACROline. - 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%LETabove 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
- Right-click in a SAS program → Format SAS Program.
- 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,
%DOto%END,%MACROto%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). DEFINEstatements 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
ATTRIBorLABELlist) is set in columns, with the first entry under the keyword or behind it (LABEL x = "One", the next entries underx). &adsbecomes&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.

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

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.

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 |


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

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(...)betweenSETandRUN) 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
%IFbranch)? 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.

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.

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.

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.


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.

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.sasfor%_spl_begin), or in your workspace. When no definition is found, F11 runs the macro as one step and the Debug Console saysNo 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)
- Write
%pryon its own line where you want to look.%pry(when=&age. = 14)stops only in the loop whereageis 14;%pryalone stops every time. - Run the program as always (F4). The run stops at that line; the line is marked, as at a breakpoint.
- In the SAS Pry terminal (it opens by itself; the Debug Console works too), type a question and press Enter:
lsshows the macro variables (age = 14),vt _ageshows the data set as it is now,whereamithe lines around the stop. - 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.

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):
lsshows the variables of the current row:bmiis already computed,flagis not set yet.nruns one statement, theflagline:lsnow showsflag = Y(Janet'sbmiis 20.2). Note that inIF ... THEN x = 1;the part after THEN is a statement of its own:nstops there first.cgoes on to the next row whereage > 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.

| 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
-
In a SAS program type
sortand press Tab:PROC SORT DATA=have OUT=want; BY usubjid; RUN; -
Press Tab again to jump from
havetowanttousubjidand type over them. -
Try
ifelse,merge,headeror%nobsthe 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.

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.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(¶m.) = 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.