BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GBL__
Quartz | Level 8

Hello,

 

I am curious what the best way is to print the source code to the log for an auto call macro program during that programs execution.

 

Can I include a data null step to read in the .sas program while that macro is being ran?  Or would this cause an issue?  Such as:

 

%MACRO client_name ;

DATA _NULL_ ;
    INFILE "\\shared_drive\user_group\projects\client_programs\client_name\client_name.sas" ;
    INPUT ;
    PUT _INFILE_ ;
RUN ;


DATA work.import_data ;
    INFILE "&file_path.\&client_name.\raw_data_file.txt" TRUNCOVER ;
    INPUT
        @1    account    $10.
        @11   name       $30. ;
RUN ;


PROC PRINT DATA=work.import_data ;
RUN ;

%MEND client_name ;

I have not been able to find a way to print autocall macro code to the log, like you can with stored compiled macros using %copy.

 

Any help would be appreciated.  Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
LeonidBatkhan
Lapis Lazuli | Level 10

Hi GBL__,

 

SOURCE2 System Option specifies whether SAS writes secondary source statements from included files to the SAS log.

SOURCE2 writes source statements from files that have been included by %INCLUDE statements or autocall macros to the SAS log.

So your solution is to place the following statement before your macro call:

options source2;

No need to read and write.

 

View solution in original post

2 REPLIES 2
LeonidBatkhan
Lapis Lazuli | Level 10

Hi GBL__,

 

SOURCE2 System Option specifies whether SAS writes secondary source statements from included files to the SAS log.

SOURCE2 writes source statements from files that have been included by %INCLUDE statements or autocall macros to the SAS log.

So your solution is to place the following statement before your macro call:

options source2;

No need to read and write.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 367 views
  • 0 likes
  • 2 in conversation