BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
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

http://support.sas.com/onlinedoc/913/getDoc/en/odsug.hlp/a002217095.htm#a002536270

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.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
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:
[pre]
Use the FILENAME statement with the PIPE command to associate a fileref
with your lpr print command.

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

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

[/pre]
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.

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 723 views
  • 0 likes
  • 2 in conversation