BookmarkSubscribeRSS Feed
DanielRingqvist
SAS Employee

If your datastep code or Proc SQL (or any Proc) is more than a page, perhaps several pages, it’s pretty tedious to select all code before you can submit. I have an SQL that is 4 pages long myself... There is a nice solution to this in SAS Studio on Viya 4 as well as in SAS Enterprise Guide and DMS (Base SAS).

In SAS Studio you right mouse anywhere in your datastep/proc and select Run Region, and that “region” is submitted. It has the shortcut key Shift+F8 by default, and you can change this in Options > Manage Keyboard Shortcuts.  

Run region - Viya4.png

 

In SAS Enterprise Guide and DMS you have to create a “Keyboard macro”. You can export this Keyboard Macro as a .kmf file and give to others so it's easy to share, and I'll share mine right now. You can get this kmf file below in the ZIP SelectCurrentCode. Unzip and click (Import...] in Program > Manage macros and snippets and after importing you assign it to e.g. F8. So having assigned SelectCurrentCode to F8 you would do F8 and then F3 to select the current datastep/proc and run it. How nice is this!? The title says "a single keystroke" but it's actually two, but still... 😉

The KMF file works for DMS as well. Images below just show EG though. 

 

EG Edit Keyboard Macro.png

Run region - EG - F8.png

5 REPLIES 5
ballardw
Super User

In DMS at least, this will include any block of comments before the collapsed section. And leave them collapsed in the editor.

Not a deal breaker but is occasionally annoying as I figured this out in SAS 8.

 

Cntrl-Alt - (minus on the numeric keypad) will collapse all code in the editor in DMS so is handy for submitting two or more blocks (data step or procedures) easily.

DanielRingqvist
SAS Employee
Yes, comments will be selected lines as well. Does not bother me much though 😉

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Discussion stats
  • 5 replies
  • 2070 views
  • 9 likes
  • 4 in conversation