BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Why do you care what colors the editor is using?  SAS does not see the colors.  Just the text.

hashman
Ammonite | Level 13

@braam:

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.

SASKiwi
PROC Star

@hashman - Gee, this is bringing back memories!

hashman
Ammonite | Level 13

@SASKiwi - Sure does! But am not sure at all how many folks here percentage-wise can still claim it. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 18 replies
  • 3555 views
  • 1 like
  • 7 in conversation