BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kimdukes77
Obsidian | Level 7

Hello,

 

I have inherited some code that uses a put statement within data _null_ step to write out to csv.  Is there any way to prevent the put statement from writing out values to the log?  Thanks

 

 

Log

83129 data _null_;
83130 set sashelp.class;
83131 put name;
83132 run;

Alfred
Alice
Barbara
Carol
Henry
James
Jane
Janet
Jeffrey
John
Joyce
Judy
Louise
Mary
Philip
Robert
Ronald
Thomas
William
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The usual way to write values to a file instead of the log is to redirect them yourself using the FILE statement:

 

data _null_;
set sashelp.class;

file "path to the file where you want the PUT messages written";
put name;
run;

View solution in original post

5 REPLIES 5
DWilson
Pyrite | Level 9

@kimdukes77 wrote:

Hello,

 

I have inherited some code that uses a put statement within data _null_ step to write out to csv.  Is there any way to prevent the put statement from writing out values to the log?  Thanks

 

 

Log

83129 data _null_;
83130 set sashelp.class;
83131 put name;
83132 run;

Alfred
Alice
Barbara
Carol
Henry
James
Jane
Janet
Jeffrey
John
Joyce
Judy
Louise
Mary
Philip
Robert
Ronald
Thomas
William
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


Assuming you're sure your code runs without errors, you can try adding:

 

options nonotes;

 

to just before your data _null_ step

 

and then add

options notes;

 

to just after your data _null_ step

 

You might be able to just use options nosource / options source instead; I'm not sure which one will suppress the PUT info being copied to the log.

 

 

kimdukes77
Obsidian | Level 7

Thank you for the response.  I probably (definitely) should have mentioned in my original post that I have tried nonotes, nosource and nosource2 and none of those options work.  Values are still written out to the log.  I suspect I will need to write out log to a txt file (not the preferred option) or update the code to use proc report or print instead of _null_ and put.

Astounding
PROC Star

The usual way to write values to a file instead of the log is to redirect them yourself using the FILE statement:

 

data _null_;
set sashelp.class;

file "path to the file where you want the PUT messages written";
put name;
run;

kimdukes77
Obsidian | Level 7

Amazing thank you!  A simple and elegant solution to what I foolishly assumed was a complex problem!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 918 views
  • 1 like
  • 4 in conversation