Output format definition in EpiData Analysis

Approach to formatting

EpiData Analysis output to the screen or printer is based on the html (hyper text meta language) format. HTML is a structured formatting principle used on all internet pages. EpiData Analysis will comply with the W3C standards. W3C is an international organisation informing about developments and standards on http://www.w3c.org.

EpiData provides two levels of control over the appearance of output on the basis of an overall setting of font and size of text. The user may choose from a number of output designs or styles for tabular output using the SET command, or may directly provide HTML formatting using the TYPE command. More powerful control is available through the use of style sheets, but most users will not need to do this. All EpiData output is created through a combination of HTML structures with the style and contents of those structures. For example, a table cell is a structure which has a style such as left-align and then the actual number or text. EpiData uses a specific style for each structure and these styles are defined in a cascading style sheet (CSS) named epiout.css. By changing the styles in this file, users can easily adapt the output format, e.g. to publish reports on a web site. The style sheet contains definitions for size, colour, margins, alignment, borders, etc. For a short introduction to HTML and CSS see http://www.w3.org/Style/Examples/011/firstcss or Wikipedia Encyclopedia.

Since the html and css are open standards, it is easy for the user to customise output format and design. For example, it is possible to produce a report with figures, text or tables placed side by side like this:

Although there is no “graph side by side” command in EpiData Analysis, this combination of graphs, table and text explanation, can be produced directly from the program. This is explained at the end of this document. But before getting to that a general description is given in the next sections

Controlling Output from EpiData Analysis

EpiData Analysis commands add information, such as tables or graphs, to the output window, along with a variety of other messages. Each type of information is structured according to an html code definition, including the defined style names or “classes”. Most users do not need to worry about this, because EpiData Analysis comes a standard set of definitions and styles. However, the style sheet (EPIOUT.CSS) provides a very powerful means of customizing the appearance of the output.

SET Command - Controlling font, character set and size

According to the W3c standards it is good practice to separate choice of font, size and character set from other aspects. Therefore these aspects of output are controlled by separate SET commands.

Aspect Contents SET command Examples
Type of font name
Must be installed
set viewer font name= set viewer font name =“Arial,Courier”
set viewer font name=“Arial Unicode,Thinfix”

Always include at least one proportional and one fixed font.
Size of font size in pixels set viewer font size= set viewer font size=12
set viewer font size=8
set viewer font size=25

For courses where you project the screen it is wise to set font size large such as 25
The same size is used for the help window.
Size of font in auxiliary windows size in pixels set window font size= set window font size=12
set window font size=25

For courses where you project the screen it is wise to set font size large such as 25
Character set or alphabet Name set viewer font charset SET viewer font charset = “ISO-8859-1”
SET viewer font charset = “gb2312”

With the separation of font, size and character set from other elements of the output it is very easy to adapt a page to other systems. The user must therefore be careful when customising definitions. With improper mixture of colour and font etc. the output could be invisible, e.g. by chosing black text on black bacground.

SET Command - Controlling what gets displayed

The SET command provides the user with control over the output in a number of ways. The following table shows the SET commands that may be used to turn on or off the display of various information, along with the defined styles names that determine the format of the information.

Information Contents style sheet element name SET command to show or hide this information
Results which are not in tables text .result set show results = on[off]
Information to user text .info set show info = on[off]
Executed command text .command set show command = on[off]
set echo=on[off]
turns all three of the above on or off
Error messages text .error set show error=on[off]
System information text .systeminfo set show systeminfo = off[on]
shows time to execute procedures, memory and other special information
results in tables tables See table styles below
Additional formats
for whole page etc.
General page description body Defines background and overall page for results
Other Other elements standard naming Other elements have standard names, e.g. indent will specify indentation of text in the main window. Help and command files use some special classes.

Inclusion of table percents

This is controlled with set table parameters:

Include or not: set table percents=rct\\set table percents=off rct indicates column, row, total
e.g. to include only row percents use “=r”
Format of percent set table percents column=“p1()“
set table percents row=“p1”
set table percents total=“p0[]”
Where p is required 1 is number of decimals, the third character will be shown before the percent and from 3 unwards after the percent, e.g.
p0():(56)
p1( %):(56.1 %)
for the number 56.14321
Percents set table header percents=% Just put the text or sign you wish to have at column headings of percents columns
Total “word” set table header total=“Total” The word to place at column and row total

SET Command - Formatting tables

Distinct types of tabular output are formed by several commands:

  • System tables are used for output from dir and var
  • Tables containing graphs
  • Frequency tables (one way tables)
  • Statistics from describe and means.
  • Data tables with crosstabulation of two or more variables with optional inclusion of percentages, from tables and epitables.

The appearance of tabular output can be controlled using the SET command.

Formatting of tables

The format of the cells are provided with EpiData Analysis as these standard types:

  • .line (lines at top and bottom of table)
  • .box (boxes around all cells)
  • .filled (coloured background)
  • .freq (frequency table)
  • .stat (other statistics tables)
  • .system (simple types for variable lists)
  • .graph (for graphs which are shown in tables)

User specified HTML text

Type command

Simple or complicated HTML code may be specified by the user explicitly using the type command. For example,

type "Preliminary tables from our study /h3"

will format the text as a level 3 heading (<h3>).

type "<table width=50% border align=center><tr><td><center><b>Final results</center></b></td></tr></table>"

will put the text in a box.

The Type command requires ” around the text”, so for more complicated formulations use Echo

Echo and show Commands - Combining tables and other aspects

Since the whole formulation of output is controlled by HTML language structures the user can add other types of output.

Example:

The user wants a report to have two figures placed side by side like this in the output:

To accomplish this:

1. First create the two figures:

read datafile
histogram age /save="his.png" // left figure
scatter dectime age /save="dec.png" //right figure

2. Then add to the output the figures with as little “noise” as possible:

set show command=off

3. Add the tables to the output (Notice the use of <font> to set the color of the font):

echo <table><tr><td colspan=2 border align=center >
<font color=blue> Title for a combination of two graphs in EpiData Analysis</font></td>
<tr><td><img src="his.png"></td><td><img src="dec2.png"></td></table>

4. To include the figures in a routine report, you save the html code in a file and add to output with the command Show

show table9.txt

Where contents of table9.txt is the text shown after the echo in point 3. If you change design of the report you then just change the contents of the table.txt file and run again. In this way contents of the table are separated from running the report, which you would save in a pgm file.

More on style sheets

The design or output format of a table is controlled by a general setting of font type and size as shown above by specfic definition of table elements in the style sheet epiout.css. Two standard setup files are provided named epiout_b.css and epiout_w.css with black and white background. It is very important not to define font names, size and character sets in the style sheet. Use only relative size (e.g. 0.8em instead of 14px) and general font type information (e.g. proportional instead of arial).

Other aspects can also be controlled, e.g. if the user decides that before a certain table there should always be a pagebreak at printing, inclusion of the style element “page-break-before: always” would allow for this. For a full description of style sheets and tables see http://www.w3.org/TR/CSS21/tables.html.

EpiData analysis creates the html code and shows the code according to the definitions in the style sheet. For the table below, indentation from left margin is done by <P style=“Margin-left: 2cm”>, and the space between the title and the table, by “<H3 style=”;Margin-bottom: 0.25cm>“.

To see an example of the HTML code run a table in EpiData Analysis, click on “Viewer” and choose “Edit HTML output”.

The first column has this style: ”{ Text-align: left ; font-weight: bold; color: red}“ The other columns this: ”{ Text-align: right; color: black ; border: solid thin blue}“

Contents of cells differ by type of table. For a general crosstable the contents are like this:

If a row or column variable does not have a variable label the name of the variable is shown instead. Similarly for value labels. As seen in the previous table percents can be added to contents. Percents will appear in columns for that, such that size, alignment etc. can be specified

The design of the cells is controlled by the style sheet contents like this:

A. Stylesheet names used for a table without percents

B. Stylesheet names used for a table with percents

The cell names of a style sheet defines how that element is designed or formed. The user can define general elements or use named specific elements.

Notice that the implementation of footer is not the HTML tag called <tfoot></tfoot>, since this has created problems for correct behaviour of combinations of footer, caption and contents in the output window. The cellfoot class is a property for the last row.

techdocs/analysis/outputformat.txt · Last modified: 2011/12/13 12:04 by torsten.bonde.christiansen
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki