BookmarkSubscribeRSS Feed

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.

 

7 Comments
Kurt_Bremser
Super User

One always needs a bit bucket.

yabwon
Onyx | Level 15

Do you mean: 

filename f DUMMY;

?

Like:

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

 

See Dummy in https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/p05r9vhhqbhfzun1qo9mw64s4700.ht...

 

 

Bart

 

Kurt_Bremser
Super User

OMG, I violated Maxim 1.

yabwon
Onyx | Level 15

😄

ChrisHemedinger
Community Manager
Status changed to: Suggestion Implemented

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.

 

Example:

 filename nul DUMMY;
 proc printto log=nul new;run;

 

ChrisNZ
Tourmaline | Level 20

And the worst is I did use the dummy device in the past 🤕

Patrick
Opal | Level 21

@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.

Patrick_0-1634168093739.png

%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;