BookmarkSubscribeRSS Feed

I'd like the Enhanced Editor of the next version of PC SAS to have a function to convert the spaces within a highlighted section of code to underscores.


It would take:

my new variable

and covert it to:



I'd suggest Ctrl + Shift + - as the shortcut. This is something that I would use numerous times per day.

Super User

I don't use EG but the Base SAS editor allows the creation of editor macros that would do this. You can also assign the short cut key combination of preference. From the Enhanced editor see if the Tools menu has a Keyboard Macros choice. If so it likely has record new macro that you would then do the search and replace. 

Lapis Lazuli | Level 10

What @ballardw is saying is true of EG; see Program >> Editor Macros or Enhanced Editor Keys.

Fluorite | Level 6

@ballardwGot it! Thanks! Wow, an enhancement without a release!

Rhodochrosite | Level 12

Ray?  Did you get your macro to work?  Its a great idea.  There's something about this Editor Macro business I don't quite get.  If you were sucessful could you share your instructions?

Fluorite | Level 6


Select the phrase to be converted to variable.

Tools | Keyboard Macros | Record New Macro


Find Text = ‘ ‘

Replace with = ‘_’

Click Replace in Selection button

Click Close

Tools | Keyboard Macros | Stop Recording

   In “Save Keyboard Macro” form, enter a macro name and description, and click Assign Key.

In the “Assign Key” form:

      Click in the Press new shortcut key field, and click your key choice. I used Shift + Ctlr + -

      Click Assign

      Click OK

I may have missed a step on the assignment, you can go back in and assign via Tools | Keyboard Macros | Macros and the Assign keys button.


You may want to add another step in the macro recording to replace ‘-‘ with ‘_’ as well.

Rhodochrosite | Level 12

yes...   Much easier to record it than construct it from the list of actions, which is what I was doing, thanks... 

SAS Employee
Status changed to: Not Planned

thanks for the posted workarounds!