Why do you care what colors the editor is using? SAS does not see the colors. Just the text.
In the SAS days of yore, this kind of functionality was served with so-called old-style macros. Basically, they work similarly to %include, but instead of pointing to an external program file, you call a piece of the program identified by the old-style macro name. Needless to say, these things still work (note that the old-style macro names are limited to 8 characters, plus there're other limitations). For example:
option macrogen ;
macro MAIN ;
data new ;
set &data ;
run ;
%
%let data = sashelp.class ;
MAIN
%let data = sashelp.cars ;
MAIN
Here's what you see in the log:
1820 macro MAIN ; 1821 data new ; 1822 set &data ; 1823 run ; 1824 % 1825 1826 %let data = sashelp.class ; 1827 1828 MAIN NOTE: The old-style macro MAIN is beginning resolution. 1829 + ; 1830 +data new ; 1831 + set &data ; 1832 +run ; NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: The data set WORK.NEW has 19 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: The old-style macro MAIN is ending resolution. 1833 1834 %let data = sashelp.cars ; 1835 1836 MAIN NOTE: The old-style macro MAIN is beginning resolution. 1837 + ; 1838 +data new ; 1839 + set &data ; 1840 +run ; NOTE: There were 428 observations read from the data set SASHELP.CARS. NOTE: The data set WORK.NEW has 428 observations and 15 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: The old-style macro MAIN is ending resolution.
he MACROGEN option causes the appearance of the "+" lines in the log; basically, it's like using SOURCE2 with %include. Its advantage over MPRINT is that if you have a run-time error, the log will point to the actual line where it occurred rather than at the line where the macro was invoked (as with the current-style macros). Another advantage is that DATA steps with CARDS (LINES, DATALINES) are also acceptable. Essentially an old-style macro is nothing but copy-and-paste.
Kind regards
Paul D.
@hashman - Gee, this is bringing back memories!
@SASKiwi - Sure does! But am not sure at all how many folks here percentage-wise can still claim it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.