Date: Fri, 21 Nov 1997 23:29:38 -0800
Reply-To: "firstname.lastname@example.org" <email@example.com>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Karsten M. Self" <kmself@IX.NETCOM.COM>
Organization: Self Analysis
Subject: SASTips: 'null' print devices and other cliffhangers
Content-Type: text/plain; charset="us-ascii"
I'd posted a question about any sort of 'null' printer device definitions
which would work under Unix. Found a solution and a couple of additional
tricks which may be useful.
First, the null printer device.
It's not really a device, but a combination of GSF and GOPTIONS which
allow SAS to output graphics data without costing too much in tree karma
-- the paper wasted in trialling reports is staggering. 'cat'ing output
to /dev/null will eliminate output, setting handshake to none keeps SAS
from complaining about lack of printer device feedback:
filename gsasfile pipe "cat > /dev/null";
handshake = none
gsfname = gsasfile
...will do the trick. You can specify any device you want, which may be
helpful in tuning sizing and color options for error-free operation. I've
found this to be a reliable method for testing and/or disabling printed
output -- particularly when SAS did not seem to obey instructions to NOT
direct output to a previously named, but currently deassigned, GSF
(Graphics Stream File).
Some Unix print commands allow spooling of print jobs without actually
putting copy to paper. This can be useful for testing output routines, or
finding out whether your 'direct output to catalog only' routine is
actually working. Under Sun Solaris (guess what I'm currently using), the
'lp' command offers a job-handling option:
lp -H hold # holds job in print queue until released or deleted.
...check your local man pages for details on your own system.
To delete a slew of jobs, you can apply the results of your queue
interrogation command to remove all your print jobs. Something like
(under korn/bourne shells):
lprm `lpq -P$printer | grep $USER | sed -e'/ */s// /' | cut
-f$fieldnumber -d' '`
...where '$printer' is your printer (if not default) and '$fieldnumber' is
the containing the job ID of your print job -- adjust to suite your
system. This will pass the 'lprm' command a list of all your current
print jobs, to be deleted (beats hunting them down by hand).
Finally, to simplify the definition of options associated with any of a
number of printers in macros/reports, I usually set up a "printer
database", consisting of a delimited list of printers and associated
settings. The user specifies an output option as a number, this selects
the appropriate options from the database. This makes redirecting output
or adding additional printers or print options trivial.
/* options */
printer= , /* value 0 to 3:
* -1= no output,
* 0= catalog/screen,
* 1= color,
* 2= laserjet
/* more options */
/* code */
# 1 Screen : : XColor : noprompt
# 2 Color down the hall : lp -dColor : phasr340 : rotate=
# 3 HP LJ4P : lp : hplj4m :
/* results are read with scan function */
%let mnonic = %scan(%scan(&printerdb,&printer),1,:);
%let command= %scan(%scan(&printerdb,&printer),1,:);
%let device = %scan(%scan(&printerdb,&printer),1,:);
%let options= %scan(%scan(&printerdb,&printer),1,:);
/* Include &GDefault in all GOPTIONS statements */
%let gdefault= &device &options /* additional options */;
filename gsasfile pipe "&command";
/* more macro code */
Karsten M. Self (firstname.lastname@example.org)
What part of "gestalt" don't you understand?
(Welchen Teil von "Gestalt" verstehen Sie nicht?)