Date: Fri, 22 Aug 2003 11:55:07 -0400
Reply-To: Michael Raithel <RAITHEM@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Michael Raithel <RAITHEM@WESTAT.COM>
Subject: Re: Renaming a .lst file in batch
Content-Type: text/plain
Dear SAS-L-ers,
Eric posted the following:
> I'm sure somebody should be able to figure this out quickly,
> but I've been stuck on this for a while and am finally
> searching out some help.
>
> I've got a program which creates several listings of various
> types (data null output, procedural output and several proc
> sql queries at the end). After the end of the SAS statements
> I have a Unix command that renames the file to .doc from .lst
> and then emails the file to me (for now while I'm testing).
> The .lst file appears to be incomplete when it is renamed as
> the .doc file does not contain everything in the .lst file.
> Specifically, the .doc file ends mid-sql query. I've tried
> the Unix command "Sleep" with varying lengths of time to try
> and delay things enough for the listing to be completed, but
> so far it's not working. In the meantime I've changed the
> program so that the output is generated using ods html, but
> I'd like to send it as something the recipient can see as an
> attachment and click on it to automatically open it in Word.
> I can't easily use the rtf destination as the program uses
> lots of legacy code using line pointers and such to format
> the output such that when the .rtf file is opened in Word it
> wraps bady even when using landscape orientation and I'd
> rather not play around with all of the spacing.
>
> Any suggestions?
Eric, it sounds like you are really only having problems with the .lst file.
If that is the case, and if the newly returned Jim Groeneveld's great advice
on cross-platform file compatibility doesn't pan out, I do have a
suggestion. Why not redirect your .lst output to a flat file with suffix of
.doc via the PRINTTO Procedure? Here is how I would tackle this:
filename ericfile '/home/ericsdirs/erics_flatfile.doc';
proc printto print=ericfile;
run;
... Eric's SAS code that normally produces .lst files...
proc printto;
run;
filename ericfile close;
... Eric's SAS code that normally E-Mails the .doc files...
The first PROC PRINTTO specifies that SAS is to print the output of all
succeeding PROC "reports" to the ERICS_FLATFILE.DOC file. Then, your SAS
program does its thing and produces ".lst" output, which goes to the
ERICS_FLATFILE.DOC file. The second PROC PRINTTO resets the .lst output to
go to the default SAS .lst flat file destination. The FILENAME statement at
the end is designed to ensure that your ERICS_FLATFILE.DOC file is
deallocated and ready for its trip via the inter-computer postal service.
Eric, my solution will not address cross-platform, cross suffix issues, but
it will get you the .doc file ready for the mailing.
Best of luck to you in getting the mail through; on time and in one piece!
I hope that this suggestion proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflect
those of my organization or my associates. All SAS code and/or methodologies
specified in this posting are for illustrative purposes only and no warranty
is stated or implied as to their accuracy or applicability. People deciding
to use information in this posting do so at their own risk.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance"
E-mail: MichaelRaithel@westat.com
Author: Tuning SAS Applications in the MVS Environment
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=55231
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...neither rain, nor sleet, nor dead of night... - Anonymous
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++