As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

TeX and LaTeX

From sasCommunity
Jump to: navigation, search

Known LaTeX users in the SAS community

What is it about LaTeX?

  • MyPaper.tex is a text file
  • contains mark-up language, similar to html or xml
  • edit with any text editor
  • output file is MyPaper.pdf, with live links
  • can copy all or part of one or more files
  • references or bibliography are easy

Where do I get the software?

Which DocumentClass?

RefArt Kludge for SUGconf

This style file redefines the LaTeX maketitle command to produce a paper-number + title + author which conforms to SAS User Group conference paper guidelines.

%% name: C:\SASpapers\00refart\refart-sugconf.sty
%% RJF2 11/23/2007 9:00AM
      \fontsize{14}{18}\selectfont{\bf\@title      \\}\smallskip
      \fontsize{12}{14}\selectfont{   \@author       }
}%end maketitle
\renewcommand{\rmdefault}{phv}%Adobe Helvetica san-serif
%\renewcommand{\rmdefault}{pnc}%Adobe Ncntrsbk       serif
%\renewcommand{\rmdefault}{ppl}%Adobe Palatino      serif
%\renewcommand{\rmdefault}{put}%Adobe Utopia        serif
%\renewcommand{\rmdefault}{ptm}%Adobe Times         serif
\renewcommand{\ttdefault}{pcr}%Courier          monospace

RefArt and RefArt-SUGconf example

%% name: D:\SASpapers-archive\00refart\refart-test.tex
%% RJF2 3/22/2007 8:10AM
%\documentclass[10pt,smallborder]{refart}%*-margins=0.25 in, for screen viewing only
\sugconfpapernumber{draft \today}%
%\sugconfpapernumber{\relax}%SUG conference: no page numbers

\title {Demonstration of LaTeX for SAS User Group Conference Authors
       }%end title
\author{Ronald J. Fehd,
        Centers for Disease Control and Prevention, Atlanta, GA, USA
       }%end author
\usepackage[bookmarks   =false%SUG conf style guide
           ,pdfkeywords ={list of SUG conf Keywords goes here}%
           ,pdfsubject  ={SUG conf Subject different from title}%
           ,pdfstartview=FitBH%fit width of page to the window
           ,pdfusetitle%author and title
\pdfcompresslevel=9%best compression level for text and image

This is the abstract.

This is the pdfsubject: \makeatletter\@pdfsubject\makeatother

These are the pdfkeywords: \makeatletter\@pdfkeywords\makeatother


This is a demonstration of VerbatimInput.



\hfill This is the last page of \jobname\ as of \today. %\time

Fehd posted a message to the texhax listserv with information about implementing the Information Mapping Block Label when using the RefArt class with a macro named marginparX.

How do I submit a document for processing?

See also: Batch_processing_under_Windows

rem      MyPaper.bat
pdfLaTeX MyPaper
rem 01-LaTeX-this.bat
call 03-set-filename
pdfLaTeX  %filename%
rem 02-TeXprocs-this.bat
call 03-set-filename
call   bibTeX  %filename%
call makeindex %filename%
call pdfLaTeX  %filename%
call pdfLaTeX  %filename%
call pdfLaTeX  %filename%
rem 03-set-filename.bat
set filename=Fehd-list-proc-routine-CallXinc
rem set filename=Fehd-list-proc-routine-CallXinc-slides

How do I add References?

Make a file: MyPaper.bib

The file MyPaper.bib is a lookup table for your citations.

%name: MyPaper.bib for MyPaper.tex see \bibliography{\jobname}
    booktitle={Proceedings of the SAS Global Forum},
    year     = 2007,
    author   ={Ronald J. Fehd and Art Carpenter},
    title    ={List Processing Basics: Creating and Using Lists of Macro Variables},
    note     ={Hands On Workshop, 20 pp.; comparison of methods:
              making and iterating macro arrays, scanning macro variable,
              writing calls to macro variable, write to file then include,
              call execute and nrstr;
              11 examples, bibliography},
    url      ={}}
    booktitle={SAS Community Wiki},
    year     = 2008,
    author   ={Zeno, et alia},
    title    ={Utilities},
    note     ={category; miscellaneous parameterized include routines and subroutines},
    url      ={}}

Citations of Wikipedia

Make a file: MyPaper.tex

Use these commands to setup and reference your bibliography entries.

%preamble == setup
\bibliographystyle{plainnat}%provides full name
%\bibliographystyle{unsrtnat}%provides live url
\usepackage[numbers]{natbib}%usage: \citet{key} returns: NameLast [cite-#]
\usepackage[hyphens]{url}%allow line breaks in url
\newcommand{\CiteT}[2]{\citet[\href{#2}{#1}]{#1}}%end CiteT

Check this paper \citet{sgf2007.113}
or this one:      \cite{sgf2007.113}

List Processing Basics,
demonstrate the timing of the error of using call execute of macros
without the macro function \%nrstr.

%listing of references
\nocite{*}%lists all entries in MyPaper.bib, whether cited or not
\bibliography{\jobname}%generates thebib environment from \jobname.bib

Citations from multiple *.bib files

\bibliography{\jobname,sas-wiki}%multiple *.bib files separated by comma, NO SPACES


LaTeX has many helpful packages, add-ons, developed by its international user community.


Darby and Fehd and Flom and Wilcox are using the beamer class to produce pdf that look and work like ppt.


  • frames can have overlays and (dis)appearing text
  • logo
  • navigation bar
  • page x of y
  • table of contents

Use this file as a template for your presentation:

Page X of Y in each slide, lower right corner.

\title[Short Title%
      \hspace{8em} pg. \alert{\thepage}\ of \pageref{LastPage}%
      ]%short title in square brackets
      {Long, Verbose, Main Title}

You will have to adjust the amount of white space between "Short Title" and "pg. X of Y" by increasing the number of em spaces.

  • "Short Title" ... \hspace{3em} ... pg. X of Y
  • "Short Title" ... \hspace{8em} ... ... ... ... pg. X of Y

The last slide must have a label of LastPage.

\label{LastPage}%used in short title: of %\pageref{LastPage}%

Here is template for a frame with a program listing:

PROC Print data   =  \alert{&Data.}
          (where  =        (&Where.));
PROC Print data   =  &Data.
          (where  =        (&Where.));
           title2   "&Data..&Where. ";
%note in lower right corner
\vfill \hfill is.a subroutine: no calls

You can use these commands within the semiverbatim environment.

  • \pause
  • \alert{text in red},
  • \alt<3-> shown from overlay three onward
  • \uncover<4->{text of overlay 4 to uncover in brackets}

Stacking the description environment with the \relax command.

      \item[Data Struc.] \relax
         \item \texttt{if 0 then set \&CxData.}
         \item \texttt{array Mvar(\alert{*}) character}
      \item[Loop] \relax

         \item \texttt{do I = 1 to dim(Mvar) \alert{-2}}
      \item[Process] \relax
         \item \texttt{Name  = vname(Mvar(I))}
         \item \texttt{Stmnt =  catx(' ' ,'\%let',Name,'=',Mvar(I)}
\label{lastPage}%used in short title: of %\pageref{lastPage}%


BeamerPoster lets you use Beamer methods to create posters of any size. Peter Flom created a NESUG poster using BeamerPoster and TextPos.


%preamble == setup
%\newcommand\PathTo{../sas/}%SAS programs are in sibling directory

\usepackage{upquote}%use vertical quotes (') not left quote (`)
%FancyVerb SETtings changes defaults for MyPaper.tex == MyPaper.pdf
      ,frame=single%none leftline topline bottomline lines single
%     ,frame=leftline%none leftline topline bottomline lines single
%     ,lastline=1%integer
%     ,firstnumber=last%auto:1 last integer
%     ,label=\FileNameExt%label={[top line]bottom line}
%     ,labelposition=%none topline bottomline all
      ,numbers=left%none left right
      }%end fvset
%document usage
This is a demonstration of VerbatimInput.

list MyPaper.tex


list just the first 8 lines


Now the label is \FileNameExt


and that program: \FileNameExt



The HyperRef Package must be loaded last, after all other packages, except minitoc, because it redefines LaTeX internal referencing commands.

\usepackage[bookmarks   =false%SUGI style guide
           ,pdfusetitle%author and title
           ,pdfstartview=FitBH%fit width of page to the window
\pdfcompresslevel=9%best compression level for text and image
This is the abstract.



Listings lets you have code from various languages (including SAS) formatted nicely in LaTeX.


TextPos lets you place text exactly on a page, using either absolute or relative distances. This is especially useful for posters.


TexHax Listserv


Comprehensive TeX Archive Network (CTAN)

Writing Discipline

  • Information Mapping

--macro maven == the radical programmer 11:00, 7 November 2008 (EST)

Related Links

Practical Tex Journal

See also: