- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I often see others' well-aligned program header comments (e.g., see below), but I still have no idea how the authors made them. Is there a keyboard shortcut that allows us to align comments?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm with @Tom on this one. This is how I do it: it is still as tidy but you don't waste time having comment blocks on each line:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Not in an editor supplied by SAS that I am aware of.
Some people use other-than-SAS-supplied editors that have features that do that. Others insert spaces manually and use a monospace font.
The Enhanced Editor in Display Manager (sometimes called Base or PC SAS) with the Ctrl-/ key will put /* */ comment characters at the start and end of each line of a block of highlighted text. So the padding with spaces at the end is sometimes not too much headache.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @xyxu,
Good question. Maybe they use a large "Tab size" in the Enhanced Editor Options (Tools → Options → Enhanced Editor...). For example, with a setting of 83 (spaces) I can place the cursor exactly where the closing "*/" is located in your example with a single keystroke after a shorter line of text (where "shorter" can be anything between 0 and 82 characters). If the "Insert spaces for tabs" checkbox is not selected, those closing "*/" characters do not move even if the comment text is edited and its length changes (within the range of 0 to 82 characters).
The horizontal border lines and separators ("/* ----...") could be created easily with a user-defined keyboard macro. Also an entire blank program header can be created that way or loaded from disk (with the checkbox "Replace tabs with spaces on file open" not selected).
Personally, I don't like tabs in my code files so I don't use the above settings. But for those alignment purposes they might come handy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I did that extensively when I was employed at SAS. I used emacs as my editor along with some customized commands that made it easy. As a primitive alternative, create an otherwise blank line with just the leading /* and */, then copy it multiple times and type over the blanks using overwrite. That said, if you don't have specialized commands for it, it is much easier not to do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In my EG Enhanced Editor, I had a keyboard macro which would write the complete program header, including the nicely formatted comment block. I would then fill it in replace mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
My advice is don't bother. It does not really make the comments any easier to read. And it definitely makes them much harder to keep up to date. I have seen too many programs that failed because one of those * or */ characters at the end of the line got pushed off the screen and so the programmer never noticed it was there.
If you insist on creating such things then use the normal old program editor in SAS Display Manager it will let you type */ in column 75 without typing anything before it. That feature does not exist in the "Enhanced" program editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm with @Tom on this one. This is how I do it: it is still as tidy but you don't waste time having comment blocks on each line: