In SAS (Atleast SAS Enteprise Guide), it is possible to record Macros and assign keys. When recording Macros, you have to manually write down the code you want to store.
So for example, I could record a Macro and assign it a key so that when I press Ctrl + 1 (I chose that keyboard shortcut), the following text appears:
"This is My Macro That I recorded".
I was thinking, that it should (?) be possible to just paste in the text "This is My Macro That I recorded" (instead of having to write it manually) and then assign it a keyboard shortcut such as Ctrl + 1, this would be very handy if my Macro recording for instance contains 50 rows of code.
Any ideas?
In Enterprise Guide, go to:
Program > Manage macros and snippets. There you can for instance also assign keyboard shortcuts.
If you look at the actual keyboard macro you will likely see what that isn't likely to fly. I don't use EG but the older Display manager would let you use the Tools>Keyboard macros>macros menu to bring up a window with your macros. Then you could highlight a macro and select edit to see the actual macro. For macros that insert text you would see:
Insert character ('d')
Insert character ('a')
Insert character ('t')
Insert character ('a')
where the word "data" was to appear. Plus "insert carriage return" for the next line.
So editing keyboard macros as you suggest is probably not where you want to be. Look at custom tasks or code snippet tools.
Thanks ballardw. Do you know if it then is possible to "create a keyboard shortcut" that simply writes out the following:
"This is my Code that I have put as a Keyboard shortcut" ?
Code snippets seems to be a solution, but reading the documentation it only works for SAS Studio: "Code snippets enable you to quickly insert SAS code into your program and customize it to meet your needs."
Code snippets exactly does what I would like, as demonstrated by the picture (you can insert SAS code automatically):
Source: https://documentation.sas.com/doc/en/webeditorcdc/3.7/webeditorug/n002bgjjez3z63n16y88kjsobrha.htm
Hello @SasStatistics,
If the purpose of your (Enhanced Editor) macro is just to write constant text, it's easier to create it as follows than to record it:
(In the traditional Display Manager interface it's the same procedure except that the menu items are Tools → Keyboard Macros → Macros... .)
In Enterprise Guide, go to:
Program > Manage macros and snippets. There you can for instance also assign keyboard shortcuts.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.