Quickly Comment and Uncomment SAS Code

By | June 24, 2009

SAS Institute Inc.

I attended SAS Programming 3: Advanced Techniques and Efficiencies training recently at the SAS’ Austin Training Center.  Programming 3 demonstrates many ways to make your SAS code and programs more efficient, but I also picked up one tidbit that makes coding and testing even easier.  When using the enhanced editor, to create comments in your code or comment out code you do not want to run, merely highlight or select the block or statements to comment with your mouse.  Now type the CTRL-/ key combination and your SAS code will include the required /* and the beginning and */ at the end of each selected line.  To uncomment a block or code or statement, highlight or select it and type the CTRL-Shift-/ key combination.  I did notice that if I select only one word on a line or merely have my cursor positioned anywhere within my code that the key combination will operate on the entire line which contains the highlighted word or cursor.  The quick commenting technique only works in the Windows version of the enhanced editor.  It will not work in the standard SAS program editor or on non-windows systems.

Leave a Reply

Your email address will not be published. Required fields are marked *