Kira
Kira

Reputation: 85

SAS: Why does %include not print comments from the included program in the log?

I'm running a lot of smaller SAS programs for a main.sas using %include. I would like for the comments in all the smaller programs to be printed to the log exactly as they would be had I run each program individually. I can't seem to find an option to help me (something like mprint just for included programs). I'm new to SAS, and this might be a very simple problem, but I'm really going nuts over it. And now we are talking about it, can anyone help me with a little insight about the differences between input and source? I find it very difficult to get help from the SAS help-pages.

Thank you so much! Kira

Upvotes: 0

Views: 1856

Answers (2)

Tom
Tom

Reputation: 51601

The SOURCE and SOURCE2 options control whether the SAS code is included in the log. These normally default to SOURCE and NOSOURCE2. You can change the SOURCE2 system option, or add the /source2 option to the %INCLUDE statement. Use this little program to generate a couple of sample files with SAS code.

filename file1 temp ;
filename file2 temp ;
data _null_;
  file file1 ;
  put '* This line is from FILE1;';
  file file2 ;
  put '* This line is from FILE2;';
run;

Now use %INCLUDE with and without the SOURCE2 option.

%include file1 file2 ;
%include file1 file2 / source2 ;

Here is how the log will look.

 71         %include file1 file2 ;
 74         %include file1 file2 / source2 ;
 NOTE: %INCLUDE (level 1) file FILE1 is file /tmp/SAS_workAEE90000185C_localhost.localdomain/#LN00050.
 75        +* This line is from FILE1;
 NOTE: %INCLUDE (level 1) ending.
 NOTE: %INCLUDE (level 1) file FILE2 is file /tmp/SAS_workAEE90000185C_localhost.localdomain/#LN00051.
 76        +* This line is from FILE2;
 NOTE: %INCLUDE (level 1) ending.
 77

Upvotes: 0

Longfish
Longfish

Reputation: 7602

Simple. Just add option source2; at the start of your main program. This tells SAS to print the code and comments to the log of all programs run with %include.

Upvotes: 2

Related Questions