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!
Hi GBL__,
SOURCE2 System Option specifies whether SAS writes secondary source statements from included files 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.
Hi GBL__,
SOURCE2 System Option specifies whether SAS writes secondary source statements from included files 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.
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.