# Base SAS

## LaTeX Tagsets for ODS

In SAS®9, four LaTeX tagsets are available for download. These tagsets are preproduction.

tagsets.latex
Legacy black-and-white LaTeX in an ODS-type style.

This tagset was written to look as much like the HTML output as possible (without color). In order to do this, the code is quite verbose (much like the HTML3 output in ODS).

tagsets.colorlatex
Same as above, but full-color.

tagsets.simplelatex
Uses plain LaTeX markup for tables.

This tagset includes quite a few LaTeX macros for SAS constructs: procedure titles, system titles, notes, and so forth.

tagsets.tablesonlylatex
Same as above, but only prints tables (no titles, notes, etc.)

## Examples

The example code below will get you started.

### Using All Four Tagsets

The code below generates output using all four LaTeX-based tagsets simultaneously. The files legacy.tex and color.tex contain the ODS-type LaTeX output in black-and-white and color, respectively. The file simple.tex contains the same output, but the tables use standard LaTeX code. The files tablesonly*.tex (each table is a separate file) contain output similar to simple.tex but do not contain titles, notes, etc., or enclosing document information.

/* Legacy LaTeX for ODS */
ods tagsets.latex file="legacy.tex";

/* Legacy LaTeX with color for ODS */
ods tagsets.colorlatex file="color.tex" stylesheet="sas.sty"(url="sas");

/* Simplified LaTeX output that uses plain LaTeX tables */
ods tagsets.simplelatex file="simple.tex" stylesheet="sas.sty"(url="sas");

/* Same as above, but only prints out tables (no titles, notes, etc.) */
/* Also, prints each table to a separate file */
ods tagsets.tablesonlylatex file="tablesonly.tex" (notop nobot) newfile=table;

proc reg data=sashelp.class;
model Weight = Height Age;
run;quit;

ods tagsets.latex close;
ods tagsets.colorlatex close;
ods tagsets.tablesonlylatex close;
ods tagsets.simplelatex close;

/* Run each document twice since the longtable package requires it */
x pdflatex legacy.tex;
x pdflatex legacy.tex;
x pdflatex color.tex;
x pdflatex color.tex;
x pdflatex simple.tex;
x pdflatex simple.tex;


### Using SAS Output in a Plain LaTeX Document

Using the default SAS output in an external document isn't very difficult with the STYLESHEET= option. From the example above, the following code shows how to create a stylesheet.

ods tagsets.simplelatex file="simple.tex" stylesheet="sas.sty"(url="sas");


After you generate the stylesheet, you can include it in your own LaTeX document as follows.

\documentclass{article}
\usepackage{sas}
\begin{document}

... SAS output here ...

\end{document}


You might want to take out the times package reference in the sas.sty stylesheet if it conflicts with the fonts in your document.

## Required and Suggested LaTeX Packages

In all cases, some external package support is required to compile LaTeX code that was generated by SAS. The absolute minimum is that you include the longtable package. If you use graphics, you also need the graphicx package. In most cases, you also want to include the times packages and the fontenc package with the T1 option (this makes absolute value operators appear correctly). A basic wrapper for tablesonlylatex output is shown below.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{times}
\begin{document}

... SAS output here ...

\end{document}


### Disclaimer

THIS PRELIMINARY DOCUMENTATION AND CODE ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. The Institute shall not be liable whatsoever for any damages arising out of the use of this documentation or code, including any direct, indirect, or consequential damages. The Institute reserves the right to alter or abandon use of this documentation at any time. In addition, the Institute will provide no support for the materials contained herein.