BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9
data _null_;
   file print;
   put 'This will go to the default output destination';
   
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

6 REPLIES 6
ballardw
Super User

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.

Tom
Super User Tom
Super User

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;
tianerhu
Pyrite | Level 9
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

Tom
Super User Tom
Super User

Because in this data step you did NOT tell it to route the output to the PRINT file instead of the LOG file.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 932 views
  • 0 likes
  • 3 in conversation