Kaz's SAS, HLM, and Rasch Model
Create a report with Table of Contents
Large National Data Sets
Kaz Library
SAS manuals
What is "error"?
Rasch Model
Factor Analysis
Reading output via SAS
Excel functions for Statistical Analysis
Essays on learning statistics
Statistics in Japanese
My profile
My SAS questions and SAS's responses
My work tool box

SAS generated WORD document with TOC (Table of Contents)

I wrote this below, but since that time I wrote a better program.  This new program opens MS-WORD automatically and then save it with a nice format (at least on my PC).  I don't have time to explain how it works just right now, but let me show you the code here.  The problem is that the MS-WORD macro has to be recorded in your own machine.  I pasted my own MS-WORD macro code at the bottom of this program, but it doesn't work well in other people's machines.

Kaz's Report System

BELOW WAS MY OLD DESCRIPTION.  What I wrote isn't wrong, though, and maybe useful for you to know how to program a macro in MS-OFFICE.  With this old program you have to open the result text yourself to create a MS-word document.  A new program (above) uses SAS-DDE to open the text automatically.


Run statistics and produce the results in text format using PROC PRINTTO.  Your goal is to create a Word-based report like this:

Result with Tables of Contents (MS-WORD doc)

    • See a sample syntax here.
    • See a result (text file that gets produced)
      • Note that there is no paging in this doc
      • Note that XXX occurs at the first title for each page
    • Open it with MS-WORD to make it look like this:
      • Result with Tables of Contents (MS-WORD doc)
      • Procedures to make it look like a doc above.
        • Open the created text file with MS-WORD.
        • Replacing XXX with STYLE heading 1:
          • Hit control-H.  Type XXX in the first small window.  Then hit FORMAT and STYLE.  First, just choose (no style) and say Okay.  Next, move your cursor to the second window.  Then hit FORMAT and STYLE.  This time, choose Heading 1.  Say Okay.   Finally click REPLACE ALL to affect the changes.
          • Make the WORD to paginate before each occurance of HEADING 1.  (I will describe this later when I have time.)
        • 3. Create a TOC (table of content) by going to Insert -->  Reference --> Index and Tables --> Choose Table of Contents tab.  hit Okay.  You will get a table of contents.
        • 4. For cosmetics, adjust the margin and font size.  Choose font size 8 using SAS Monospace.  If your PC does not have SAS then choose Corrier.


Enter supporting content here

Copyright 2005 KU
For information inquiry (AT) estat.us