BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can someone please advise how to print SAS code in color? Thanks!
5 REPLIES 5
Cynthia_sas
Diamond | Level 26
Hi,
According to this Tech Support note, SAS code does not print in color from the Enhanced Editor window:
http://support.sas.com/techsup/unotes/SN/003/003804.html

The note suggests that you cut and paste your code into a word processor (or text editing application that does support color printing) and print from there.

cynthia
wensui
Calcite | Level 5
try vim (www.vim.org). I always use it to print SAS or other program in color.
deleted_user
Not applicable
Printing code in color is a great help for a code-review session. Microsoft Word provides a lot of what we want for this.
It involves more than 5 minutes preparation, but that would be consistent with preparation for code-review.
Expect to use file-path/name (bold) on the header and version-date-time on the footer.
Rather than just paste the code to a new document, open the saved code, and then replace it all with that color-formatted code from the SAS code window. (It might be wise to ensure tabs are replaced by spaces using the SAS code editor options.) In this way the Word "autotext" carries filename with path.
Page numbers are not needed, because you can print line numbers (thanks to word pageSetup-layout). To keep all under control, alter the linenumber style to something like 8 point Arial. Beware that Word linenumbers increment where long-lines wrap, so either avoid that, or alter the formatting to a smaller font. Wide trailing comments take much less space in Arial or Arial-narrow or small point sizes, while remaining readable. If the code must remain wide in general, you may need/want to go to landscape orientation. For just a few wide lines that wrap, remove nearby blank lines. The convenience of direct addressing using line numbers within a large program is worth preserving.

All this effort seems well rewarded when the code review session quickly passes through long and complex processes with relative ease.
Ususal rules apply ~ respect the audience !

If you need this approach often, it may be worth preparing a special SAS Appearance-scheme.


It works for me, but your experience may be different.
deleted_user
Not applicable
I use MELS (Multi-Edit Lite for SAS). It is a programmer's editor that will print the code in color and much more. You can try it for free:
http://www.multiedit.com/MeLS-info.php
David_SAS
SAS Employee
The corrected URL is

http://www.multiedit.com/MeLS-info.php .

-- David Kelley, SAS

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 6509 views
  • 0 likes
  • 4 in conversation