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.
| Key | What runs | Chapter |
|---|---|---|
F4, Cmd/Ctrl+Enter, F3, F8 | the selection, else the whole program (F3/F8 go to the SAS extension when it is installed) | 20 |
Ctrl+Alt+Up | Run To Line: from the top to the cursor | 20 |
Ctrl+Alt+Down | Run From Line: from the step at the cursor to the end | 20 |
| ▷ menu → Run Step | the step, SQL statement, macro call or %MACRO definition at the cursor | 20 |
Ctrl+Alt+R (in a program) | Resolve Code: the code a macro call generates | 20 |
Ctrl+Alt+C | SAS command box (WSAVE ALL keeps your layout) | 20 |
| Command Palette | Run in Template, Run As Macro | 20 |
| right-click a folder → Run in Batch | each program in a fresh session, in name order | 26 |
| Stop SAS button | stops the running code; WORK and macro variables stay | 20 |
Log and session
Section titled “Log and session”| Key | What it does |
|---|---|
F2 | clear log and output |
Ctrl+Alt+L / Ctrl+Alt+O / Ctrl+Alt+T | show SAS Log / SAS Output / SAS Data |
| ▲ Error / Error ▼ | previous / next problem in the log |
| Suspicious Log tab | only the messages a QC log check looks for |
datastepStudio.log.suspiciousNotes / suspiciousIgnore | your own rules / messages to ignore |
F12 | open the last data set created |
Ctrl+Alt+D | open the data set at the cursor |
Shift+F4 | close the data set |
F9 | Keys tab |
Data viewer
Section titled “Data viewer”| Key | What it does |
|---|---|
? | list every key |
arrows, PageUp, PageDown, g | move; go to an observation |
w | WHERE clause |
/ | search all columns |
t | filter the column: >13, 1-5, a,b,c, !a, A*, ., 01JAN2020 |
f | frequencies of the column |
| Enter / Shift+Enter | keep / remove rows with this value |
Ctrl+Alt+E | add column = value to the WHERE |
Ctrl+Alt+I | value picker: tick values, Enter keeps them |
Ctrl+Alt+R | all rows again |
s, a, d | sort |
h, c | hide a column, choose columns |
l, v | labels on or off, raw or formatted values |
F3 | close the tab |
More in chapter 21.
| Type or press | You 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 %INCLUDE | Open Macro Definition / Included Program |
a name + Tab: sort, merge, ifelse, firstlast, join, %nobs, dupcheck, bign, header, headerm, kill | a 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 selection | house-style code |
Ctrl+K | comment / uncomment lines |
Ctrl+Shift+U / Ctrl+Shift+L | upper / lower case |
Alt+PageUp / Alt+PageDown | start / 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.
DATA step debugger (Pro)
Section titled “DATA step debugger (Pro)”| Key | What it does |
|---|---|
| Debug DATA Step (title bar) | start |
F10 | one statement |
F5 | to the next breakpoint |
| click the margin | breakpoint |
| right-click the dot → Edit Breakpoint | condition: usubjid = "01-701-1023" |
| Jump to Cursor | go to another line |
| Variables view | the PDV; change a value to try another path |
More in chapter 23.
Macro debugger (Pro)
Section titled “Macro debugger (Pro)”| Key | What 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+F11 | continue / 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 margin | code coverage; Clear Macro Code Coverage |
%MACRO name(); | write () for a macro without parameters |
More in chapter 25.
%pry (Pro)
Section titled “%pry (Pro)”Where to write it
| Line | Stops |
|---|---|
%pry | every 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
| Group | Commands |
|---|---|
| where | whereami, bt, up, down |
| macro variables | ls, ls -g, &i |
| data | vt work.x, vt work.x(FIRSTOBS=101 OBS=120), print (OBS=50), print 50, show, forward, backward |
| filter and shape | where age > 13, where clear, find Alfred, contents, keep a b, drop c, sort age desc |
| analyse | count, 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 on | next/n, next 3, Enter repeats, step/s, finish/f, continue/c, !!! |
| stop later | break 12 if &i. = 3, watch &total |
| help | show-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.
Files and server
Section titled “Files and server”| Command | What it does |
|---|---|
F4 in a local folder | changed files are copied to ~/datastep-studio/<project>-<id>, then the program runs there |
| Open SAS Server Folder | edit 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.autoexec | code that runs after every connect, also in batch |