Help using Base SAS procedures

filename pipe with PC SAS

Reply
N/A
Posts: 0

filename pipe with PC SAS

I have using pipe to redirect sas output and generate ps files. however, the same codes got different result in Unix and Windows platform. below is an example:

********************************;
filename hts pipe 'enscript -c -q -p test.ps';
proc printto print=hts new;
run;
proc print data=sashelp.class;
run;
proc printto;
run;
********************************;
In Unix, it generate the correct ps file. but in Windows, the first page of the generated ps file is blank and the real output is shown on the second page. It seems related to pipe device because the same code got different result
between Unix and Windows. Under Windows, PC SAS first write a new page to pipe? Does anyone know how to correct it? Thanks!
Esteemed Advisor
Posts: 5,155

Re: filename pipe with PC SAS

I'm not so sure that it is SAS that behaves differently on different platform. It could be the encript application as well that behaves differently between platforms. Have you tested it with other applications than SAS?

/Linus
Data never sleeps
N/A
Posts: 0

Re: filename pipe with PC SAS

The enscript works the same under both unix and windows. I also test other programs with SAS, for example, using

filename hts pipe 'cat > test.lst';

then redirect output to hts. With PC SAS it output a page break '0C'x at the beginning while with unix SAS it does not. So I guess it may be a problem related to SAS pipe device?
SAS Super FREQ
Posts: 8,679

Re: filename pipe with PC SAS

Hi:
Indeed, if you read this Tech Support Note, you will see the '0C'x is the "old" Carriage Return character:
http://support.sas.com/kb/3/396.html

PROC PRINTTO is an older proc. If it still follows that old convention of a leading page break ... I don't know whether there's a way around that. That's a question for Tech Support.

However, there is ANOTHER way to create a PS file:
[pre]
ods ps file='testclass.ps';

proc print data=sashelp.class;
run;

ods ps close;
[/pre]

Alternately, you could specify:
[pre]
ods printer ps file='testclass2.ps';

proc print data=sashelp.class;
run;

ods printer ps close;
[/pre]

Unless you really want the look of old LISTING window output, you might like the look of this type of Postscript output better.

cynthia
N/A
Posts: 0

Re: filename pipe with PC SAS

Thanks Cynthia,

I knew the ods way to produce ps file. But, I have my old codes worked well under AIX, and I need using put statement with line pointer, column pointer to create an customized report. It also use enscript to filter / highlight some pattern text in the final report. I have tried using the new ods features with my SAS version 9.1.3, but I found it is hard to create the same kind of report.

I am not sure if it is problem of proc printto; I tried using the data step as follows;

filename hts pipe 'enscript -c -q -p test.ps';
data _null_;
file hts;
set sashelp.class;
put name sex age weight height;
run;

The output is correct and not leading blank page.

As for the proc printto, it did not output a leading page break under Unix platform. If the output is a destination other than a pipe device, for example, an disk file:

filename hts 'c:\test.lst';
proc printto print=hts new;
run;

it did not output a leading page break, either.

So the problem is when using proc printto with a pipe device in PC SAS, it produce a leading blank page. Strange.
SAS Super FREQ
Posts: 8,679

Re: filename pipe with PC SAS

Hi:
You might consider opening a track with Tech Support about it. I don't understand enough about operating system differences to know what SAS is doing differently working with the PIPE command. If anyone can figure out the "internals" or see what's happening, it would be Tech Support.

cynthia
N/A
Posts: 0

Re: filename pipe with PC SAS

Thanks. I will fill a report to the SAS Tech Support after hoilday.
Ask a Question
Discussion stats
  • 6 replies
  • 102 views
  • 0 likes
  • 3 in conversation