data _null_;
file print;
put 'This will go to the default output destination';
run;
Because you told it not to.
If you want some messages written to the log while also writing some information to a file use the PUTLOG statement instead.
data _null_;
put 'PUT before FILE statement will go to the SAS log.';
file print;
put 'This will go to the open output destination(s).';
putlog 'This will go to the SAS log.';
run;
When you provide a file then then the PUT output is directed to the file, i.e. File Print.
To "force" text to the log only use Putlog instead of Put.
Thank you for your help.
Because you told it not to.
If you want some messages written to the log while also writing some information to a file use the PUTLOG statement instead.
data _null_;
put 'PUT before FILE statement will go to the SAS log.';
file print;
put 'This will go to the open output destination(s).';
putlog 'This will go to the SAS log.';
run;
data Females;
input @14 Gender $1.;
put 'After first input ' _all_;
if Gender ne 'F' then delete;
put 'After delete ' _all_;
input @1 Subj $3.
@4 DOB mmddyy10.
@15 Balance 7.;
put 'After second Input ' _all_;
datalines;
00110/21/1955M 1145
00211/18/2001F 18722
00305/07/1944M 123.45
00407/25/1945F -12345
;
but the text of the 'put statement' in this program can appear in log
Because in this data step you did NOT tell it to route the output to the PRINT file instead of the LOG file.
Thank you very much.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.