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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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