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.
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!
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.