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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.