It'd be useful that the null device existed to access the null device of the OS, so we don't have to test whether nul (DOS) or /dev/null (Unix) are to be used.
1 filename f DUMMY;
2
3 data _null_;
4 file f;
5 put "null void empty";
6 run;
NOTE: The file F is:
Filename=<Dummy File>,
RECFM=V,LRECL=32767
NOTE: 1 record was written to the file F.
The minimum record length was 15.
The maximum record length was 15.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
It's a bit of a cheat to call this idea Implemented since it was a feature that already exists, just under a different name -- but we'll take the win anyway we can. As @yabwon points out, one can use the FILENAME DUMMY method to direct output the to proverbial bit bucket -- that is, to specify the output is to be discarded.
@ChrisHemedinger NUL resp. /dev/null pre-exists while with DUMMY there is a need to first create a filename. See below a bit exotic example for Windows where this makes a difference.
%macro test() /secure;
proc printto log=nul;
run;
data _null_;
put 'some logic';
run;
proc printto log=log;
run;
%mend;
data _null_;
call execute('%test()');
run;
%macro test() /secure;
filename NULL dummy;
proc printto log=NULL;
run;
data _null_;
put 'some logic';
run;
proc printto log=log;
run;
%mend;
data _null_;
call execute('%test()');
run;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.