Date: Fri, 21 Feb 1997 09:10:51 PST
Reply-To: John Doyal <jdoyal@PACCAR.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: John Doyal <jdoyal@PACCAR.COM>
Subject: fwd: PROC TABULATE and WordPerfect, some ideas to improve th...
I do this process monthly for both output to the web (a more elaborate
endeavor not described here) and WordPerfect. What I have found most usable
1) Use formchar to eliminate all SAS generated lines.
2) cut and paste into a spreadsheet (either 123 or Excel)
3) Depending on the spreadsheet use either "Text to Columns" under
data or Parse under data to reformat the table into the appropriate
4) Save the table.
5) Bring the file into WordPerfect. Let WordPerfect bring the table in
as a full WordPerfect table.
From: Frank Poppe <poppe@SWOV.NL>, on 2/21/97 11:28 AM:
To: "Multiple recipients of list SAS-L" <SAS-L@UGA.CC.UGA.EDU>
I want to raise once again the issue of PROC TABULATE and WordPerfect. This
present some basic ideas to tackle that problem, and would like to have
Those interested, please read on.
PROC TABULATE and WordPerfect
The question how to incorporate output from SAS procedures like proc
documents made with WordPerfect or other software has been raised several
myself use WordPerfect, but the story is probably the same for other
I am not looking for a solution where you define the tables yourself in a
datastep, inserting codes for your favourite word processing or typesetting
(I already have SAS macros that produce LaTeX-code). I am now looking for
that help any user to get his or her PROC TABULATE output into WordPerfect,
as a *real* WordPerfect-table.
I have never seen any better suggestions than either insert the tables
using a fixed-pitch font like Courier in a small enough point size, or
horizontal bars into tabs (either using the formchar option of SAS or the
function of WordPerfect) and then change the text into a WordPerfect-table.
suggestion still requires a lot of manipulating to get all the columns
get the headings above the right columns.
If I have missed better options, I'd love to hear about it...
Since the goal is to arrive at a WordPerfect-table, I have focused on
automate the manipulation process.
I here give some first thoughts on that, based also on suggestions from
colleagues. I have not worked this out in detail, because I still have the
that somewhere in the world people have been struggling with the same
perhaps have solved already some parts of it. So I am curious whether
suggestions to improve the basic ideas, or perhaps there are some that are
or several steps further.
The basic idea is to interpret the output from PROC TABULATE, to arrive at
description, and to use that for output that WordPerfect could understand
Ideally (but that is a long way) this would be a WordPerfect file, complete
I also want to point out here that in my view the SAS system should have an
output in such a logical form. Either a generic system option, or a proc
those procs that try to deliver *nice looking* output, which can take
WORDPERFECT, LATEX, RTF, SGML, HTML, etcetera. The SAS system *knows* the
build up of PROC TABULATE output before it translates it into ASCII output.
be able to make that information available for the user. I think that the
request for an OUTPUT option for PROC TABULATE essentially comes from the
this kind of information.
Now the preliminary ideas.
Make sure that you can discriminate between the markup of the table (the
that make up the lines), and the content of the table. So use the
give all the (11) different marker characters different codes (a sensible
would be codes that will give nice results when one would send the output
Make a first scan of the table, line for line, and remember all the
vertical bar. That will be used as a list of all the possible <tab>
(ignoring the first and last bars). One should be able to use this
inform WordPerfect of the basic number of columns, but I do not yet see
Now start a second pass of the table, again line for line, using the
Read in a new line. If you are at the end of the file everything should be
(normally), and nothing is left to be done.
Examine the first non-blank character of the line:
* A top-left marker signals the start of a table: open a new output
* A bottom-left marker signals the end of a table: close the output
* A vertical bar should mean we are busy with a table: go to step 5.
* Anything else means we are not working on a table, go to step 4.
If the line only consists of spaces and markers, ignore the line and go to
Look for the next vertical bar.
If there is more than just spaces before this bar, trim that text from
trailing spaces and write it to the output file (the absence or presence of
and trailing blanks indicates whether this cell should be centred, left, or
aligned, but -again- I do not yet see how to convey that information to
Compare the position of the last found vertical bar with the list of
the first pass.
If this is the last vertical bar, write a <cr> and go to step 4, otherwise
Write additional <tab>*s for each position that appears to have been
last <tab> for this line was written. Go to step*6.
End of program.
Any ideas would be welcome.
I have already done some experimenting with SAS writing information to an
which could serve as a WordPerfect macro file. That file would contain
instructions on how to incorporate the text file as a WordPerfect table.
Thanks for your patience...
| Frank Poppe email@example.com
| Institute for Road Safety Research SWOV
| PO Box 170
| 2260 AD Leidschendam
| the Netherlands
| telephone +31 70 320 9323
| fax +31 70 320 1261