LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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 is: 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 columns. 4) Save the table. 5) Bring the file into WordPerfect. Let WordPerfect bring the table in as a full WordPerfect table. ------------- Original Text 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>

Hello everybody,

I want to raise once again the issue of PROC TABULATE and WordPerfect. This time I present some basic ideas to tackle that problem, and would like to have some fee dback. Those interested, please read on.

Frank

PROC TABULATE and WordPerfect

The question how to incorporate output from SAS procedures like proc tabulate in to documents made with WordPerfect or other software has been raised several times. I myself use WordPerfect, but the story is probably the same for other software. I am not looking for a solution where you define the tables yourself in a _null_ datastep, inserting codes for your favourite word processing or typesetting soft ware (I already have SAS macros that produce LaTeX-code). I am now looking for utilit ies that help any user to get his or her PROC TABULATE output into WordPerfect, pref erably as a *real* WordPerfect-table. I have never seen any better suggestions than either insert the tables unchanged , using a fixed-pitch font like Courier in a small enough point size, or change th e horizontal bars into tabs (either using the formchar option of SAS or the replac e function of WordPerfect) and then change the text into a WordPerfect-table. The latter suggestion still requires a lot of manipulating to get all the columns aligned, and to 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 possibilit ies to automate the manipulation process. I here give some first thoughts on that, based also on suggestions from some colleagues. I have not worked this out in detail, because I still have the feeli ng that somewhere in the world people have been struggling with the same problem, a nd perhaps have solved already some parts of it. So I am curious whether people hav e suggestions to improve the basic ideas, or perhaps there are some that are alrea dy one or several steps further.

The basic idea is to interpret the output from PROC TABULATE, to arrive at a log ical description, and to use that for output that WordPerfect could understand comple tely. Ideally (but that is a long way) this would be a WordPerfect file, complete with the table description.

((SIGH I also want to point out here that in my view the SAS system should have an opti on for output in such a logical form. Either a generic system option, or a proc option for those procs that try to deliver *nice looking* output, which can take values lik e WORDPERFECT, LATEX, RTF, SGML, HTML, etcetera. The SAS system *knows* the logica l build up of PROC TABULATE output before it translates it into ASCII output. It s hould be able to make that information available for the user. I think that the recurr ent request for an OUTPUT option for PROC TABULATE essentially comes from the need f or this kind of information. ))

Now the preliminary ideas.

1. Make sure that you can discriminate between the markup of the table (the *marker s* that make up the lines), and the content of the table. So use the FORMCHAR-optio n, and give all the (11) different marker characters different codes (a sensible choic e would be codes that will give nice results when one would send the output direct ly to the printer).

2. Make a first scan of the table, line for line, and remember all the positions of the vertical bar. That will be used as a list of all the possible <tab> positions (ignoring the first and last bars). One should be able to use this information t o inform WordPerfect of the basic number of columns, but I do not yet see how.

3. Now start a second pass of the table, again line for line, using the following s teps.

4. Read in a new line. If you are at the end of the file everything should be finis hed (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 file, go to step 4. * A bottom-left marker signals the end of a table: close the output file, go to step 4. * 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.

5. If the line only consists of spaces and markers, ignore the line and go to step 4.

6. Look for the next vertical bar. If there is more than just spaces before this bar, trim that text from leading a nd trailing spaces and write it to the output file (the absence or presence of lead ing and trailing blanks indicates whether this cell should be centred, left, or righ t aligned, but -again- I do not yet see how to convey that information to WordPerf ect).

7. Compare the position of the last found vertical bar with the list of positions f rom the first pass. If this is the last vertical bar, write a <cr> and go to step 4, otherwise write a <tab>. Write additional <tab>*s for each position that appears to have been skipped sin ce the 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 ASCII- file which could serve as a WordPerfect macro file. That file would contain informati on and instructions on how to incorporate the text file as a WordPerfect table.

Thanks for your patience...

+--------------------------------------------------+ | Frank Poppe poppe@swov.nl | Institute for Road Safety Research SWOV | PO Box 170 | 2260 AD Leidschendam | the Netherlands | telephone +31 70 320 9323 | fax +31 70 320 1261 +------------------------------------------


Back to: Top of message | Previous page | Main SAS-L page