Hi all,
I'm trying to create a keyboard shortcut that will automatically make marked text into a comment.
What I want is for it to do the following:
/* [marked text] */ ;
My problem is, I don't know how to reference marked text when creating the shortcut.
Thank you in advance
Hi @Posterne,
This is a good idea! Thanks for sharing.
It seems that you don't necessarily want to comment out a whole line (which is what the Ctrl+/ shortcut does -- but not so easily on non-English keyboards btw.), but only selected text such as a word or a couple of words or several lines of code.
You can set up a keyboard macro containing a sequence of Enhanced Editor commands for this task:
As you can see from the commands, the macro uses the clipboard. Hence, you shouldn't use it while you have something important in the clipboard. But I think this is only a minor limitation.
*EDIT: "no conflicts" refers only to other Enhanced Editor keyboard shortcuts. There could still be a conflict with a definition from the KEYS window and with shortcuts from the operating system or other software. So, select the shortcut with that in mind.
What software are you using. The old Locally installed SAS editor used to let you press:
Control + /
To comment a line, and
Control + Shift + /
To uncomment (or a keystroke like that, been a while since I used it). Unfortunately the editors are really quite old and clunky now, the "Enhanced Editor" came out with version 8, and hasn't had any updates. Not sure what Enterprise uses or the other packages. It would be great to have a decent editor/IDE, but I don't see it happening any time soon.
What I tend to do is drop a new row before and after and put the /* and */ on these extra lines, that way you only need to add/remove those rows to comment/uncomment.
As for kjeyboard shortcuts, you would need to be a bit more specific.
I'm using SAS base 9,4 and as far as I can see, there is no "create comment" shortcut (at least not listed in "Keys"). So I'm in trhe enhanced editor, in "Keys", and i want to make the open shortcut ctl + F3 a shortcut to making marked text into a comment.
Then you should be able to use Cntrl+/:
http://www.sascommunity.org/wiki/Tips:Ctrl_%2B_/_is_a_quick_and_easy_way_to_comment_out_SAS_code
Hi @Posterne,
This is a good idea! Thanks for sharing.
It seems that you don't necessarily want to comment out a whole line (which is what the Ctrl+/ shortcut does -- but not so easily on non-English keyboards btw.), but only selected text such as a word or a couple of words or several lines of code.
You can set up a keyboard macro containing a sequence of Enhanced Editor commands for this task:
As you can see from the commands, the macro uses the clipboard. Hence, you shouldn't use it while you have something important in the clipboard. But I think this is only a minor limitation.
*EDIT: "no conflicts" refers only to other Enhanced Editor keyboard shortcuts. There could still be a conflict with a definition from the KEYS window and with shortcuts from the operating system or other software. So, select the shortcut with that in mind.
Just what i needed!
I will use it, too. Thanks again.
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.