The SAS Output Delivery System and reporting techniques

How to use ODS Printer in Unix

Frequent Contributor
Posts: 97

How to use ODS Printer in Unix

We are using the following command to print the output directly to a printer in Unix.

FILENAME outfile "/myfolder/myfile.txt";
FILENAME outfile pipe 'lp -d pr908104';

The link

also mentions about using unix command to print

filename your-fileref pipe 'lpr -P printer-name';
ods printer file=your-fileref;

The example and the code we use shows that we have to use the Unix

How can i avoid using Unix commands to send the output to print as we are not permitted to use Unix commands for security reasons.

Can I use ODS Printer

Please help me with the syntax.
Posts: 9,371

Re: How to use ODS Printer in Unix

The URL that you cite, also says (note in bold):

(begin quote)
Note: To print directly to a printer in the UNIX , VMS, or z/OS operating environment,
you can use the FILENAME statement. Specific information about your
operating environment is required when using the FILENAME statement.

See the SAS documentation for your operating environment before using this statement.

Commands are also available in some operating environments that
associate a fileref with a file and that break that association.
(end quote)

The web site that you reference, also has this example:
Use the FILENAME statement with the PIPE command to associate a fileref
with your lpr print command.

filename your-fileref pipe 'lpr -P printer-name';
ods printer file=your-fileref;

filename local pipe 'lpr -p chpljj21';
ods printer file=local;

I do not have a Unix system (with a printer) to test on. But if I did have a system to test on, I don't know of any other way, except to use the LPR command. The only other thing I'd possibly try to do is create a PostScript (.PS) file but then you'd just have a PS file that would need to be printed with Unix commands. Your best bet for help might be to find the SAS Companion for your particular "flavor" of Unix, as referenced, or to contact Tech Support.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation