- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you don't want data in the log, remove (or comment) the put statement. Right now, the put statement explicitly forces SAS to write to the log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Amazing thank you! A simple and elegant solution to what I foolishly assumed was a complex problem!