SAS program formatting question

Surely we have some SAS folks out there, right?

I have inherited a set of programs created by someone else. He has used the occasional horizontal line to visually separate sections of the program. This seems like a very handy tool, but I can’t figure out how to replicate it. Anyone know how it’s done?

Place an asterisk, then a series of underscores or dashes or asterisks to go across the screen and end it with a semi-colon.

Or put a forward slash, then an asterisk, then your series of whatevers, then another asterisk, then another forward slash.

*____________________;

/____________________/

*------------------------------;

/-------------------------------/

/********************/

**********************;

You can use the /* */ or * ; combination to make comments in your programs, not only dividing lines.

With my version of SAS (9.1) and using the Enhanced Editor, SAS automatically denotes sections of code with a horizontal line at the end of the code. There is also an ‘-’ in a box at the beginning of the code that allows that section of code to be collapsed.

Enabling that appears to be in the Tools–>Options–>Enhanced Editor. Then on the General tab, there is a box to enable “Collapsible code sections” and “Show section lines in text.”

Not sure if that is what you were looking for.

I use SAS 9.2 and it does what mcgato said. It must be a default though as I’ve never had to enable it.

Ditto. I think it does this immediately after any run; or options; or %mend; statement.

Just in case, you can turn this on (in 9.2) by going to Tools->Options->Enhanced Editor. Under the General tab make sure “Collapsible code sections” and “Show section lines in text” are both checked.

I don’t know why my code doesn’t do that automatically, but I’m going to look into it tomorrow, because collapsible code is very helpful. Years ago, I used a editor for the obscure language OCCAM which had a “folding” editor - every structure (if, do, etc.) could be “folded” out of the way so that higher levels of organization could be more easily seen, or unfolded to look at the details (Code folding - Wikipedia). I loved it.