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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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