Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Inserting Stata output in Beamer presentation


From   Roger Newson <r.newson@imperial.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Inserting Stata output in Beamer presentation
Date   Wed, 27 Apr 2011 18:18:49 +0100

I personally use the \verbatim or \semiverbatim environments in my Beamer presentations, which frequently contain Stata text output cut and pasted from .log files. A recent example of such a presentation, in .pdf format, given at last year's Stata User Meeting, can be downloaded from my website at
http://www.imperial.ac.uk/nhli/r.newson/usergp.htm#uk2010

An example, from this presentation, of a Beamer frame containing a \verbatim environment \verbatim environment is as follows:

%%%% BEGINNING OF FRAME - CUT HERE
\begin{frame}[fragile]
\frametitle{Step~2 (continued): Regression results}

The Stata Version~11 \texttt{regress} produces its usual output:

\tiny
\begin{verbatim}
Source | SS df MS Number of obs = 69 -------------+------------------------------ F( 8, 61) = 163.18 Model | 32114.3472 8 4014.2934 Prob > F = 0.0000 Residual | 1500.65278 61 24.6008652 R-squared = 0.9554 -------------+------------------------------ Adj R-squared = 0.9495 Total | 33615 69 487.173913 Root MSE = 4.9599

------------------------------------------------------------------------------
mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
     foreign |
0 | 32 3.507197 9.12 0.000 24.98693 39.01307 1 | 26.33333 1.653309 15.93 0.000 23.02734 29.63933
             |
     foreign#|
       rep78 |
0 1 | -11 4.959926 -2.22 0.030 -20.91798 -1.082015 0 2 | -12.875 3.921166 -3.28 0.002 -20.71586 -5.034145 0 3 | -13 3.634773 -3.58 0.001 -20.26818 -5.731822 0 4 | -13.55556 3.877352 -3.50 0.001 -21.3088 -5.80231
        1 1  |  (empty)
        1 2  |  (empty)
1 3 | -3 3.306617 -0.91 0.368 -9.61199 3.61199 1 4 | -1.444444 2.338132 -0.62 0.539 -6.119827 3.230938
------------------------------------------------------------------------------
\end{verbatim}
\normalsize

There are 2 intercepts for US and non--US models,
and effects on mileage for repair records other than 5 (the reference level).

\end{frame}
%%%% END OF FRAME - CUT HERE

An example of a frame containing a \semiverbatim environment is as follows:

%%%% BEGINNING OF FRAME - CUT HERE
\begin{frame}[fragile]
\frametitle{Step~1: Save a description of the factors in a do--file}

\onslide<2->{
We start by inputting the \texttt{auto} data.
We then run \texttt{descsave}, a ``super'' version of \texttt{describe},
on the factor variables:
}
\scriptsize
\begin{semiverbatim}
\uncover<3->{
. sysuse auto, clear;
(1978 Automobile Data)
}\uncover<4->{
. tempfile df0;
}\uncover<5->{
. descsave foreign rep78,
>   list(name type format vallab varlab, clean noobs)
>   do(`"`df0'"', replace);
}\uncover<6->{
    name      type   format   vallab   varlab
    foreign   byte   %8.0g    origin   Car type
    rep78     int    %8.0g             Repair Record 1978
}
\end{semiverbatim}
\normalsize
\onslide<7->{
\texttt{descsave} can list attributes of the variables being described,
and/or save a temporary do--file,
which can be used later to reconstruct these attributes
for variables with the same names in another dataset.
}

\end{frame}
%%%% END OF FRAME - CUT HERE

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

On 27/04/2011 17:12, Martial Foucault wrote:
Dear all,

I face some serious troubles to insert estimations tables into a Beamer
presentation. Stata tables have been saved using tabout with .tex extension.

Now I try to display such results into a Beamer presentation. But it
doesn’t work ! In fact, the table doesn’t fit at all with the scale of
the document.

Is there a relevant procedure to save Stata results before inserting
them into a Beamer presentation ? (Using tabout is fine for a Latex
(standard) document).

Thanks a lot.

Best,

*Martial Foucault*/
Professeur Agrégé / Associate Prof./
Département de science politique / Political Science Dept
Université de Montréal
CP 6128, Succ. centre-ville
Montréal H3C3J7 - CANADA


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index