Skip to content

Cheat sheet

One page to keep open while you work. On a Mac, Cmd/Ctrl+Enter, Cmd/Ctrl+click and Ctrl+K use Cmd. All other keys with Ctrl, for example Ctrl+Alt+Up and Ctrl+Shift+F, use the Control key on a Mac too. F9 opens the Keys tab, where you can change any key. (Pro) marks the Professional edition, free during Early Access at the time of writing.

KeyWhat runsChapter
F4, Cmd/Ctrl+Enter, F3, F8the selection, else the whole program (F3/F8 go to the SAS extension when it is installed)20
Ctrl+Alt+UpRun To Line: from the top to the cursor20
Ctrl+Alt+DownRun From Line: from the step at the cursor to the end20
▷ menu → Run Stepthe step, SQL statement, macro call or %MACRO definition at the cursor20
Ctrl+Alt+R (in a program)Resolve Code: the code a macro call generates20
Ctrl+Alt+CSAS command box (WSAVE ALL keeps your layout)20
Command PaletteRun in Template, Run As Macro20
right-click a folder → Run in Batcheach program in a fresh session, in name order26
Stop SAS buttonstops the running code; WORK and macro variables stay20
KeyWhat it does
F2clear log and output
Ctrl+Alt+L / Ctrl+Alt+O / Ctrl+Alt+Tshow SAS Log / SAS Output / SAS Data
▲ Error / Error ▼previous / next problem in the log
Suspicious Log tabonly the messages a QC log check looks for
datastepStudio.log.suspiciousNotes / suspiciousIgnoreyour own rules / messages to ignore
F12open the last data set created
Ctrl+Alt+Dopen the data set at the cursor
Shift+F4close the data set
F9Keys tab
KeyWhat it does
?list every key
arrows, PageUp, PageDown, gmove; go to an observation
wWHERE clause
/search all columns
tfilter the column: >13, 1-5, a,b,c, !a, A*, ., 01JAN2020
ffrequencies of the column
Enter / Shift+Enterkeep / remove rows with this value
Ctrl+Alt+Eadd column = value to the WHERE
Ctrl+Alt+Ivalue picker: tick values, Enter keeps them
Ctrl+Alt+Rall rows again
s, a, dsort
h, chide a column, choose columns
l, vlabels on or off, raw or formatted values
F3close the tab

More in chapter 21.

Type or pressYou get
Ctrl+Space (Mac: Cmd+I when Control+Space switches the keyboard)suggestions: procedures, options, functions, librefs, columns, & macro variables, % macros
Cmd/Ctrl+click a macro call or %INCLUDEOpen Macro Definition / Included Program
a name + Tab: sort, merge, ifelse, firstlast, join, %nobs, dupcheck, bign, header, headerm, killa keyboard macro (81 built in); Tab jumps to the next field
right-click → Save Selection as Keyboard Macro…your own keyboard macro
Import Keyboard Macros from SAS (.kmf)your macros from the SAS Enhanced Editor
right-click → Format SAS Program; Ctrl+Shift+F on a selectionhouse-style code
Ctrl+Kcomment / uncomment lines
Ctrl+Shift+U / Ctrl+Shift+Lupper / lower case
Alt+PageUp / Alt+PageDownstart / end of the DO block
proc so + Enter, da + Enter (Pro)a step template
WHERE trt01p = ' (Pro)the values of the column, most frequent first
%cou + Enter (Pro)a call of your macro with every parameter
Ctrl+Shift+E / Ctrl+Shift+O (Pro)Enlarge / Optimize Macro Call

More in chapter 22.

KeyWhat it does
Debug DATA Step (title bar)start
F10one statement
F5to the next breakpoint
click the marginbreakpoint
right-click the dot → Edit Breakpointcondition: usubjid = "01-701-1023"
Jump to Cursorgo to another line
Variables viewthe PDV; change a value to try another path

More in chapter 23.

KeyWhat it does
Debug Macro (title bar)open the call pane, or debug the call at the cursor
Start Debug (or F5 in the pane)start
F5 / F10 / F11 / Shift+F11continue / step over / step into / step out
right-click the dot → Edit Condition&i. = 3
Debug Console%EVAL(&i. * 2), or SAS code inside the paused macro
×N in the margincode coverage; Clear Macro Code Coverage
%MACRO name();write () for a macro without parameters

More in chapter 25.

Where to write it

LineStops
%pryevery time the run reaches it
%pry(when=&i. = 3)in a macro, when the macro condition is true
%pry(when=age > 14)in a DATA step, before the next statement, for each row where it is true
%pry(rescue=Y)after the first step with an ERROR (warning=Y: also a WARNING)

At the prompt

GroupCommands
wherewhereami, bt, up, down
macro variablesls, ls -g, &i
datavt work.x, vt work.x(FIRSTOBS=101 OBS=120), print (OBS=50), print 50, show, forward, backward
filter and shapewhere age > 13, where clear, find Alfred, contents, keep a b, drop c, sort age desc
analysecount, freq sex, freq trta aesev, means age, profile, dups usubjid, compare work.other by usubjid, sql SELECT ...
try code%LET i = 5;, a step (* continues, ! restarts), edit then F4
go onnext/n, next 3, Enter repeats, step/s, finish/f, continue/c, !!!
stop laterbreak 12 if &i. = 3, watch &total
helpshow-source %m, ? PROC REPORT, wtf?, hist, reload %m, help

Commands: Open Pry Terminal (works without a stop), New SAS Program at the %pry Pause, Continue After %pry. Setting: datastepStudio.debug.pry off makes %pry do nothing.

More in chapter 24.

CommandWhat it does
F4 in a local folderchanged files are copied to ~/datastep-studio/<project>-<id>, then the program runs there
Open SAS Server Folderedit files on SAS OnDemand directly
Open File Manager (Pro)your computer and the server side by side: Space mark, F5 Enter copy, F6 Enter move, Tab other side
datastepStudio.autoexeccode that runs after every connect, also in batch