Re: Including SAS output in latex

2011-02-16 Thread Sid Sahgal
Thanks so much for your detailed response Paul. I am actually trying to
include the tables that are output by SAS procedures into my Lyx document
rather than SAS source code itself. Do you have any workarounds for that?

Cheers,
Sid



On Sun, Feb 13, 2011 at 7:47 AM, Paul Johnson pauljoh...@gmail.com wrote:

 On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal sahga...@gmail.com wrote:
  Hello,
  I am a new Lyx user. I want to include a latex file created by SAS (
 a
  statistical software program). I follow the instructions on this website
  http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.

 Greetings

 I've been doing a lot of stats work lately and I think I can suggest
 an alternative that will be a bit better.

 The Lyx insert- listings menu creates a little box, where you can
 paste output if you want. Turn on the view latex option  in lyx.
 Insert a program listing object, note this is very customizable.  A
 listings box has right click config, set the language to SAS. It may
 be exactly what you need.  In the latex code box, you see what lyx is
 doing,

 \begin{lstlisting}[language=SAS]

 The output format for listing boxes is easily customizable, of course,
 and there are many pre-defined styles for various languages.  I don't
 happen to find a pre-defined one that matches my needs, but I have
 learned that the preamble can define your own style to look the way
 you want.   You experiment with that, and then your next step can be
 to save your sas in separate text files and then use LaTeX input
 commands to bring the file into your document.  As you note this is
 nicer than re-running and then cutting and pasting again from Excel.

 Here's a document i made in that way

 http://pj.freefaculty.org/ps909/terminal-2.pdf

 I'm pasting in the whole preamble below.  I needed to have listings
 appear as-if they were from Sweave, but in fact they are not.  This
 just takes the Rstyle that Frank Harrell created at Vanderbilt and
 then extracts the customized listings commands.
 It creates 2 styles for listings, Rstyle and Routstyle and then in
 the document, when a listing, you can just use the LyX
 insert-listings, and if you have the view latex source turned on,
 you see the code it uses is:


 \begin{lstlisting}
 vi newthing.txt # The old school editor, probably strictly black and white
 \end{lstlisting}

 Because my preamble uses lstset to put Rstyle as the default, this
 gives output with the right listings. But you can easily change. You
 can either type this in ERT or in the listings optional settings,
 there is a last menu tab where you can type on the right side
 style=Routstyle, and the LaTeX markup ends up like this:

 \begin{lstlisting}[style=Routstyle]
 vi newthing.txt # The old school editor, probably strictly black and white
 \end{lstlisting}

 I DO NOT know the difference in meaning of language and style as
 listings options, I've been doing this with styles, but as I inspect
 what lyx does with the pull down menus (monitor the latex view,
 again), I see it does language.

 Now, how to input a separate file into a listing environment? The
 manual for listings says you can do:

 \lstinputlisting[language=SAS]{example.sas}

 I just tested and found it accepts both options at the same time as well:

 \lstinputlisting[language=SAS,style=Routstyle]{example.sas}

 Oh, well.  I see this is difficult to describe.

 I just decided to make you a working example:

 http://pj.freefaculty.org/latex/smallExample.lyx

 My example is a Beamer slide presentation, and there is a complication
 that listings is not compatible with the default slide frame, so I
 have to put those in in ERT. But if you download my example, I think
 you can make it work.  Please note: Supply your own example.sas in
 the working directory.

 I hope this is my good deed for the day. Or I've not done too much damage.

 pj

 %%%That preamble, then %%

 \usepackage{dcolumn}
 \usepackage{booktabs}

 % use 'handout' to produce handouts
 %\documentclass[handout]{beamer}
 \usepackage{wasysym}
 \usepackage{pgfpages}
 \newcommand{\vn}[1]{\mbox{{\it

 #1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}


 \usepackage{graphicx}
 \usepackage{listings}

 \modepresentation
 {
  \usetheme{KU}
  \usecolortheme{dolphin} %dark blues
 }

 \usepackage{fancyvrb}
 % In document Latex options:
 \fvset{listparameters={\setlength{\topsep}{0em}}}
 \def\Sweavesize{\normalsize}
 \def\Rcolor{\color{black}}
 \def\Rbackground{\color[gray]{0.95}}

 \providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
 \providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
 \providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}

 \providecommand{\Rbackground}{\color[gray]{0.91}}
 \providecommand{\Routbackground}{\color[gray]{0.935}}
 % Can specify \color[gray]{1} for white background or just \color{white}


 

Re: Including SAS output in latex

2011-02-16 Thread Sid Sahgal
Thanks so much for your detailed response Paul. I am actually trying to
include the tables that are output by SAS procedures into my Lyx document
rather than SAS source code itself. Do you have any workarounds for that?

Cheers,
Sid



On Sun, Feb 13, 2011 at 7:47 AM, Paul Johnson pauljoh...@gmail.com wrote:

 On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal sahga...@gmail.com wrote:
  Hello,
  I am a new Lyx user. I want to include a latex file created by SAS (
 a
  statistical software program). I follow the instructions on this website
  http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.

 Greetings

 I've been doing a lot of stats work lately and I think I can suggest
 an alternative that will be a bit better.

 The Lyx insert- listings menu creates a little box, where you can
 paste output if you want. Turn on the view latex option  in lyx.
 Insert a program listing object, note this is very customizable.  A
 listings box has right click config, set the language to SAS. It may
 be exactly what you need.  In the latex code box, you see what lyx is
 doing,

 \begin{lstlisting}[language=SAS]

 The output format for listing boxes is easily customizable, of course,
 and there are many pre-defined styles for various languages.  I don't
 happen to find a pre-defined one that matches my needs, but I have
 learned that the preamble can define your own style to look the way
 you want.   You experiment with that, and then your next step can be
 to save your sas in separate text files and then use LaTeX input
 commands to bring the file into your document.  As you note this is
 nicer than re-running and then cutting and pasting again from Excel.

 Here's a document i made in that way

 http://pj.freefaculty.org/ps909/terminal-2.pdf

 I'm pasting in the whole preamble below.  I needed to have listings
 appear as-if they were from Sweave, but in fact they are not.  This
 just takes the Rstyle that Frank Harrell created at Vanderbilt and
 then extracts the customized listings commands.
 It creates 2 styles for listings, Rstyle and Routstyle and then in
 the document, when a listing, you can just use the LyX
 insert-listings, and if you have the view latex source turned on,
 you see the code it uses is:


 \begin{lstlisting}
 vi newthing.txt # The old school editor, probably strictly black and white
 \end{lstlisting}

 Because my preamble uses lstset to put Rstyle as the default, this
 gives output with the right listings. But you can easily change. You
 can either type this in ERT or in the listings optional settings,
 there is a last menu tab where you can type on the right side
 style=Routstyle, and the LaTeX markup ends up like this:

 \begin{lstlisting}[style=Routstyle]
 vi newthing.txt # The old school editor, probably strictly black and white
 \end{lstlisting}

 I DO NOT know the difference in meaning of language and style as
 listings options, I've been doing this with styles, but as I inspect
 what lyx does with the pull down menus (monitor the latex view,
 again), I see it does language.

 Now, how to input a separate file into a listing environment? The
 manual for listings says you can do:

 \lstinputlisting[language=SAS]{example.sas}

 I just tested and found it accepts both options at the same time as well:

 \lstinputlisting[language=SAS,style=Routstyle]{example.sas}

 Oh, well.  I see this is difficult to describe.

 I just decided to make you a working example:

 http://pj.freefaculty.org/latex/smallExample.lyx

 My example is a Beamer slide presentation, and there is a complication
 that listings is not compatible with the default slide frame, so I
 have to put those in in ERT. But if you download my example, I think
 you can make it work.  Please note: Supply your own example.sas in
 the working directory.

 I hope this is my good deed for the day. Or I've not done too much damage.

 pj

 %%%That preamble, then %%

 \usepackage{dcolumn}
 \usepackage{booktabs}

 % use 'handout' to produce handouts
 %\documentclass[handout]{beamer}
 \usepackage{wasysym}
 \usepackage{pgfpages}
 \newcommand{\vn}[1]{\mbox{{\it

 #1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}


 \usepackage{graphicx}
 \usepackage{listings}

 \modepresentation
 {
  \usetheme{KU}
  \usecolortheme{dolphin} %dark blues
 }

 \usepackage{fancyvrb}
 % In document Latex options:
 \fvset{listparameters={\setlength{\topsep}{0em}}}
 \def\Sweavesize{\normalsize}
 \def\Rcolor{\color{black}}
 \def\Rbackground{\color[gray]{0.95}}

 \providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
 \providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
 \providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}

 \providecommand{\Rbackground}{\color[gray]{0.91}}
 \providecommand{\Routbackground}{\color[gray]{0.935}}
 % Can specify \color[gray]{1} for white background or just \color{white}


 

Re: Including SAS output in latex

2011-02-16 Thread Sid Sahgal
Thanks so much for your detailed response Paul. I am actually trying to
include the tables that are output by SAS procedures into my Lyx document
rather than SAS source code itself. Do you have any workarounds for that?

Cheers,
Sid



On Sun, Feb 13, 2011 at 7:47 AM, Paul Johnson  wrote:

> On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal  wrote:
> > Hello,
> > I am a new Lyx user. I want to include a latex file created by SAS (
> a
> > statistical software program). I follow the instructions on this website
> > http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.
>
> Greetings
>
> I've been doing a lot of stats work lately and I think I can suggest
> an alternative that will be a bit better.
>
> The Lyx insert-> listings menu creates a little box, where you can
> paste output if you want. Turn on the view latex option  in lyx.
> Insert a program listing object, note this is very customizable.  A
> listings box has right click config, set the language to SAS. It may
> be exactly what you need.  In the latex code box, you see what lyx is
> doing,
>
> \begin{lstlisting}[language=SAS]
>
> The output format for listing boxes is easily customizable, of course,
> and there are many pre-defined styles for various languages.  I don't
> happen to find a pre-defined one that matches my needs, but I have
> learned that the preamble can define your own style to look the way
> you want.   You experiment with that, and then your next step can be
> to save your sas in separate text files and then use LaTeX input
> commands to bring the file into your document.  As you note this is
> nicer than re-running and then cutting and pasting again from Excel.
>
> Here's a document i made in that way
>
> http://pj.freefaculty.org/ps909/terminal-2.pdf
>
> I'm pasting in the whole preamble below.  I needed to have listings
> appear as-if they were from Sweave, but in fact they are not.  This
> just takes the Rstyle that Frank Harrell created at Vanderbilt and
> then extracts the customized listings commands.
> It creates 2 styles for listings, "Rstyle" and "Routstyle" and then in
> the document, when a listing, you can just use the LyX
> insert->listings, and if you have the "view latex source" turned on,
> you see the code it uses is:
>
>
> \begin{lstlisting}
> vi newthing.txt # The old school editor, probably strictly black and white
> \end{lstlisting}
>
> Because my preamble uses "lstset" to put "Rstyle" as the default, this
> gives output with the right listings. But you can easily change. You
> can either type this in ERT or in the listings optional settings,
> there is a last menu tab where you can type on the right side
> "style=Routstyle", and the LaTeX markup ends up like this:
>
> \begin{lstlisting}[style=Routstyle]
> vi newthing.txt # The old school editor, probably strictly black and white
> \end{lstlisting}
>
> I DO NOT know the difference in meaning of "language" and "style" as
> listings options, I've been doing this with styles, but as I inspect
> what lyx does with the pull down menus (monitor the latex view,
> again), I see it does language.
>
> Now, how to input a separate file into a listing environment? The
> manual for listings says you can do:
>
> \lstinputlisting[language=SAS]{example.sas}
>
> I just tested and found it accepts both options at the same time as well:
>
> \lstinputlisting[language=SAS,style=Routstyle]{example.sas}
>
> Oh, well.  I see this is difficult to describe.
>
> I just decided to make you a working example:
>
> http://pj.freefaculty.org/latex/smallExample.lyx
>
> My example is a Beamer slide presentation, and there is a complication
> that listings is not compatible with the default slide frame, so I
> have to put those in in ERT. But if you download my example, I think
> you can make it work.  Please note: Supply your own "example.sas" in
> the working directory.
>
> I hope this is my good deed for the day. Or I've not done too much damage.
>
> pj
>
> %%%That preamble, then %%
>
> \usepackage{dcolumn}
> \usepackage{booktabs}
>
> % use 'handout' to produce handouts
> %\documentclass[handout]{beamer}
> \usepackage{wasysym}
> \usepackage{pgfpages}
> \newcommand{\vn}[1]{\mbox{{\it
>
> #1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}
>
>
> \usepackage{graphicx}
> \usepackage{listings}
>
> \mode
> {
>  \usetheme{KU}
>  \usecolortheme{dolphin} %dark blues
> }
>
> \usepackage{fancyvrb}
> % In document Latex options:
> \fvset{listparameters={\setlength{\topsep}{0em}}}
> \def\Sweavesize{\normalsize}
> \def\Rcolor{\color{black}}
> \def\Rbackground{\color[gray]{0.95}}
>
> \providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
> \providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
> \providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}
>
> \providecommand{\Rbackground}{\color[gray]{0.91}}

Re: Including SAS output in latex

2011-02-12 Thread Paul Johnson
On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal sahga...@gmail.com wrote:
 Hello,
     I am a new Lyx user. I want to include a latex file created by SAS ( a
 statistical software program). I follow the instructions on this website
 http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.

Greetings

I've been doing a lot of stats work lately and I think I can suggest
an alternative that will be a bit better.

The Lyx insert- listings menu creates a little box, where you can
paste output if you want. Turn on the view latex option  in lyx.
Insert a program listing object, note this is very customizable.  A
listings box has right click config, set the language to SAS. It may
be exactly what you need.  In the latex code box, you see what lyx is
doing,

\begin{lstlisting}[language=SAS]

The output format for listing boxes is easily customizable, of course,
and there are many pre-defined styles for various languages.  I don't
happen to find a pre-defined one that matches my needs, but I have
learned that the preamble can define your own style to look the way
you want.   You experiment with that, and then your next step can be
to save your sas in separate text files and then use LaTeX input
commands to bring the file into your document.  As you note this is
nicer than re-running and then cutting and pasting again from Excel.

Here's a document i made in that way

http://pj.freefaculty.org/ps909/terminal-2.pdf

I'm pasting in the whole preamble below.  I needed to have listings
appear as-if they were from Sweave, but in fact they are not.  This
just takes the Rstyle that Frank Harrell created at Vanderbilt and
then extracts the customized listings commands.
It creates 2 styles for listings, Rstyle and Routstyle and then in
the document, when a listing, you can just use the LyX
insert-listings, and if you have the view latex source turned on,
you see the code it uses is:


\begin{lstlisting}
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

Because my preamble uses lstset to put Rstyle as the default, this
gives output with the right listings. But you can easily change. You
can either type this in ERT or in the listings optional settings,
there is a last menu tab where you can type on the right side
style=Routstyle, and the LaTeX markup ends up like this:

\begin{lstlisting}[style=Routstyle]
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

I DO NOT know the difference in meaning of language and style as
listings options, I've been doing this with styles, but as I inspect
what lyx does with the pull down menus (monitor the latex view,
again), I see it does language.

Now, how to input a separate file into a listing environment? The
manual for listings says you can do:

\lstinputlisting[language=SAS]{example.sas}

I just tested and found it accepts both options at the same time as well:

\lstinputlisting[language=SAS,style=Routstyle]{example.sas}

Oh, well.  I see this is difficult to describe.

I just decided to make you a working example:

http://pj.freefaculty.org/latex/smallExample.lyx

My example is a Beamer slide presentation, and there is a complication
that listings is not compatible with the default slide frame, so I
have to put those in in ERT. But if you download my example, I think
you can make it work.  Please note: Supply your own example.sas in
the working directory.

I hope this is my good deed for the day. Or I've not done too much damage.

pj

%%%That preamble, then %%

\usepackage{dcolumn}
\usepackage{booktabs}

% use 'handout' to produce handouts
%\documentclass[handout]{beamer}
\usepackage{wasysym}
\usepackage{pgfpages}
\newcommand{\vn}[1]{\mbox{{\it
#1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}


\usepackage{graphicx}
\usepackage{listings}

\modepresentation
{
  \usetheme{KU}
  \usecolortheme{dolphin} %dark blues
}

\usepackage{fancyvrb}
% In document Latex options:
\fvset{listparameters={\setlength{\topsep}{0em}}}
\def\Sweavesize{\normalsize}
\def\Rcolor{\color{black}}
\def\Rbackground{\color[gray]{0.95}}

\providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
\providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
\providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}

\providecommand{\Rbackground}{\color[gray]{0.91}}
\providecommand{\Routbackground}{\color[gray]{0.935}}
% Can specify \color[gray]{1} for white background or just \color{white}


\lstdefinestyle{Rstyle}{fancyvrb=false,escapechar=`,language=R,%
basicstyle={\Rcolor\Sweavesize},%
backgroundcolor=\Rbackground,%
showstringspaces=false,%
keywordstyle=\Rcolor,%
commentstyle={\Rcommentcolor\ttfamily\itshape},%


Re: Including SAS output in latex

2011-02-12 Thread Paul Johnson
On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal sahga...@gmail.com wrote:
 Hello,
     I am a new Lyx user. I want to include a latex file created by SAS ( a
 statistical software program). I follow the instructions on this website
 http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.

Greetings

I've been doing a lot of stats work lately and I think I can suggest
an alternative that will be a bit better.

The Lyx insert- listings menu creates a little box, where you can
paste output if you want. Turn on the view latex option  in lyx.
Insert a program listing object, note this is very customizable.  A
listings box has right click config, set the language to SAS. It may
be exactly what you need.  In the latex code box, you see what lyx is
doing,

\begin{lstlisting}[language=SAS]

The output format for listing boxes is easily customizable, of course,
and there are many pre-defined styles for various languages.  I don't
happen to find a pre-defined one that matches my needs, but I have
learned that the preamble can define your own style to look the way
you want.   You experiment with that, and then your next step can be
to save your sas in separate text files and then use LaTeX input
commands to bring the file into your document.  As you note this is
nicer than re-running and then cutting and pasting again from Excel.

Here's a document i made in that way

http://pj.freefaculty.org/ps909/terminal-2.pdf

I'm pasting in the whole preamble below.  I needed to have listings
appear as-if they were from Sweave, but in fact they are not.  This
just takes the Rstyle that Frank Harrell created at Vanderbilt and
then extracts the customized listings commands.
It creates 2 styles for listings, Rstyle and Routstyle and then in
the document, when a listing, you can just use the LyX
insert-listings, and if you have the view latex source turned on,
you see the code it uses is:


\begin{lstlisting}
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

Because my preamble uses lstset to put Rstyle as the default, this
gives output with the right listings. But you can easily change. You
can either type this in ERT or in the listings optional settings,
there is a last menu tab where you can type on the right side
style=Routstyle, and the LaTeX markup ends up like this:

\begin{lstlisting}[style=Routstyle]
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

I DO NOT know the difference in meaning of language and style as
listings options, I've been doing this with styles, but as I inspect
what lyx does with the pull down menus (monitor the latex view,
again), I see it does language.

Now, how to input a separate file into a listing environment? The
manual for listings says you can do:

\lstinputlisting[language=SAS]{example.sas}

I just tested and found it accepts both options at the same time as well:

\lstinputlisting[language=SAS,style=Routstyle]{example.sas}

Oh, well.  I see this is difficult to describe.

I just decided to make you a working example:

http://pj.freefaculty.org/latex/smallExample.lyx

My example is a Beamer slide presentation, and there is a complication
that listings is not compatible with the default slide frame, so I
have to put those in in ERT. But if you download my example, I think
you can make it work.  Please note: Supply your own example.sas in
the working directory.

I hope this is my good deed for the day. Or I've not done too much damage.

pj

%%%That preamble, then %%

\usepackage{dcolumn}
\usepackage{booktabs}

% use 'handout' to produce handouts
%\documentclass[handout]{beamer}
\usepackage{wasysym}
\usepackage{pgfpages}
\newcommand{\vn}[1]{\mbox{{\it
#1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}


\usepackage{graphicx}
\usepackage{listings}

\modepresentation
{
  \usetheme{KU}
  \usecolortheme{dolphin} %dark blues
}

\usepackage{fancyvrb}
% In document Latex options:
\fvset{listparameters={\setlength{\topsep}{0em}}}
\def\Sweavesize{\normalsize}
\def\Rcolor{\color{black}}
\def\Rbackground{\color[gray]{0.95}}

\providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
\providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
\providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}

\providecommand{\Rbackground}{\color[gray]{0.91}}
\providecommand{\Routbackground}{\color[gray]{0.935}}
% Can specify \color[gray]{1} for white background or just \color{white}


\lstdefinestyle{Rstyle}{fancyvrb=false,escapechar=`,language=R,%
basicstyle={\Rcolor\Sweavesize},%
backgroundcolor=\Rbackground,%
showstringspaces=false,%
keywordstyle=\Rcolor,%
commentstyle={\Rcommentcolor\ttfamily\itshape},%


Re: Including SAS output in latex

2011-02-12 Thread Paul Johnson
On Mon, Feb 7, 2011 at 12:51 AM, Sid Sahgal  wrote:
> Hello,
>     I am a new Lyx user. I want to include a latex file created by SAS ( a
> statistical software program). I follow the instructions on this website
> http://support.sas.com/rnd/base/ods/odsmarkup/latex.html.

Greetings

I've been doing a lot of stats work lately and I think I can suggest
an alternative that will be a bit better.

The Lyx insert-> listings menu creates a little box, where you can
paste output if you want. Turn on the view latex option  in lyx.
Insert a program listing object, note this is very customizable.  A
listings box has right click config, set the language to SAS. It may
be exactly what you need.  In the latex code box, you see what lyx is
doing,

\begin{lstlisting}[language=SAS]

The output format for listing boxes is easily customizable, of course,
and there are many pre-defined styles for various languages.  I don't
happen to find a pre-defined one that matches my needs, but I have
learned that the preamble can define your own style to look the way
you want.   You experiment with that, and then your next step can be
to save your sas in separate text files and then use LaTeX input
commands to bring the file into your document.  As you note this is
nicer than re-running and then cutting and pasting again from Excel.

Here's a document i made in that way

http://pj.freefaculty.org/ps909/terminal-2.pdf

I'm pasting in the whole preamble below.  I needed to have listings
appear as-if they were from Sweave, but in fact they are not.  This
just takes the Rstyle that Frank Harrell created at Vanderbilt and
then extracts the customized listings commands.
It creates 2 styles for listings, "Rstyle" and "Routstyle" and then in
the document, when a listing, you can just use the LyX
insert->listings, and if you have the "view latex source" turned on,
you see the code it uses is:


\begin{lstlisting}
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

Because my preamble uses "lstset" to put "Rstyle" as the default, this
gives output with the right listings. But you can easily change. You
can either type this in ERT or in the listings optional settings,
there is a last menu tab where you can type on the right side
"style=Routstyle", and the LaTeX markup ends up like this:

\begin{lstlisting}[style=Routstyle]
vi newthing.txt # The old school editor, probably strictly black and white
\end{lstlisting}

I DO NOT know the difference in meaning of "language" and "style" as
listings options, I've been doing this with styles, but as I inspect
what lyx does with the pull down menus (monitor the latex view,
again), I see it does language.

Now, how to input a separate file into a listing environment? The
manual for listings says you can do:

\lstinputlisting[language=SAS]{example.sas}

I just tested and found it accepts both options at the same time as well:

\lstinputlisting[language=SAS,style=Routstyle]{example.sas}

Oh, well.  I see this is difficult to describe.

I just decided to make you a working example:

http://pj.freefaculty.org/latex/smallExample.lyx

My example is a Beamer slide presentation, and there is a complication
that listings is not compatible with the default slide frame, so I
have to put those in in ERT. But if you download my example, I think
you can make it work.  Please note: Supply your own "example.sas" in
the working directory.

I hope this is my good deed for the day. Or I've not done too much damage.

pj

%%%That preamble, then %%

\usepackage{dcolumn}
\usepackage{booktabs}

% use 'handout' to produce handouts
%\documentclass[handout]{beamer}
\usepackage{wasysym}
\usepackage{pgfpages}
\newcommand{\vn}[1]{\mbox{{\it
#1}}}\newcommand{\vb}{\vspace{\baselineskip}}\newcommand{\vh}{\vspace{.5\baselineskip}}\newcommand{\vf}{\vspace{\fill}}\newcommand{\splus}{\textsf{S-PLUS}}\newcommand{\R}{\textsf{R}}


\usepackage{graphicx}
\usepackage{listings}

\mode
{
  \usetheme{KU}
  \usecolortheme{dolphin} %dark blues
}

\usepackage{fancyvrb}
% In document Latex options:
\fvset{listparameters={\setlength{\topsep}{0em}}}
\def\Sweavesize{\normalsize}
\def\Rcolor{\color{black}}
\def\Rbackground{\color[gray]{0.95}}

\providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}}
\providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}}
\providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}}

\providecommand{\Rbackground}{\color[gray]{0.91}}
\providecommand{\Routbackground}{\color[gray]{0.935}}
% Can specify \color[gray]{1} for white background or just \color{white}


\lstdefinestyle{Rstyle}{fancyvrb=false,escapechar=`,language=R,%
basicstyle={\Rcolor\Sweavesize},%
backgroundcolor=\Rbackground,%
showstringspaces=false,%
keywordstyle=\Rcolor,%
commentstyle={\Rcommentcolor\ttfamily\itshape},%


SV: Including SAS output in latex

2011-02-08 Thread Ingar Pareliussen
Hi

. If I use sas.sty generated by SAS, where do I put it so Lyx will recognize 
it? I put in a folder and Refreshed FCNB on MikTex as per the help manual, but 
Lyx still couldn't find it.

This file needs to be recognised by LaTeX and should go somewhere MikTeX could 
find it. I guess this works?

The next you have top tell lyx that it needs to use it. This is done in the 
LaTeX preamble in Document-settings. just add on these two lines::
\usepackage{sas}
\usepackage{longtable}

This will give you the sas specific commands that are used by sas.( And the 
longtableenvironment, may not be necessary if you import the file).

Even if Lyx did find it, I think there would still be some issues because of 
the code in the latex file.
 get a million compilation errors like  misplaced \noalign with any of the 
 four latex files that can be
generated by SAS. I have attached tablesonly.tex
because I think this is the simplest file and also simple.tex.

Most of the errors should go away if you add the \usepackage{longtable}.

However the latex you send was also wrong. it should look something like this:

\begin{longtable}{|c|c|c|c|}
\hline
  1  1 1 \\
\hline
  1 1  1 \\
\hline
   1 1 \\
\hline
\end{longtable}

You must move the \begin{longtable} to the start of the file.

So I guess you have to make sas produce correct latex to make it work, or 
massage it in an editor. Then it should be easy to import it as a latex file in 
lyx. Or you could copy it into a ERT-box.

I hope this helps.

Ingar


SV: Including SAS output in latex

2011-02-08 Thread Ingar Pareliussen
Hi

. If I use sas.sty generated by SAS, where do I put it so Lyx will recognize 
it? I put in a folder and Refreshed FCNB on MikTex as per the help manual, but 
Lyx still couldn't find it.

This file needs to be recognised by LaTeX and should go somewhere MikTeX could 
find it. I guess this works?

The next you have top tell lyx that it needs to use it. This is done in the 
LaTeX preamble in Document-settings. just add on these two lines::
\usepackage{sas}
\usepackage{longtable}

This will give you the sas specific commands that are used by sas.( And the 
longtableenvironment, may not be necessary if you import the file).

Even if Lyx did find it, I think there would still be some issues because of 
the code in the latex file.
 get a million compilation errors like  misplaced \noalign with any of the 
 four latex files that can be
generated by SAS. I have attached tablesonly.tex
because I think this is the simplest file and also simple.tex.

Most of the errors should go away if you add the \usepackage{longtable}.

However the latex you send was also wrong. it should look something like this:

\begin{longtable}{|c|c|c|c|}
\hline
  1  1 1 \\
\hline
  1 1  1 \\
\hline
   1 1 \\
\hline
\end{longtable}

You must move the \begin{longtable} to the start of the file.

So I guess you have to make sas produce correct latex to make it work, or 
massage it in an editor. Then it should be easy to import it as a latex file in 
lyx. Or you could copy it into a ERT-box.

I hope this helps.

Ingar


SV: Including SAS output in latex

2011-02-08 Thread Ingar Pareliussen
Hi

>. If I use sas.sty generated by SAS, where do I put it so Lyx will recognize 
>it? I put in a folder and Refreshed FCNB on MikTex as per the help manual, but 
>Lyx still couldn't find it.

This file needs to be recognised by LaTeX and should go somewhere MikTeX could 
find it. I guess this works?

The next you have top tell lyx that it needs to use it. This is done in the 
LaTeX preamble in Document->settings. just add on these two lines::
\usepackage{sas}
\usepackage{longtable}

This will give you the sas specific commands that are used by sas.( And the 
longtableenvironment, may not be necessary if you import the file).

>Even if Lyx did find it, I think there would still be some issues because of 
>the code in the latex file.
> get a million compilation errors like  misplaced "\noalign" with any of the 
> four latex files that can be
>generated by SAS. I have attached tablesonly.tex
>because I think this is the simplest file and also simple.tex.

Most of the errors should go away if you add the \usepackage{longtable}.

However the latex you send was also wrong. it should look something like this:

\begin{longtable}{|c|c|c|c|}
\hline
 & 1 & 1 &1 \\
\hline
 & 1 &1  &1 \\
\hline
 &  1& 1 &\\
\hline
\end{longtable}

You must move the \begin{longtable} to the start of the file.

So I guess you have to make sas produce correct latex to make it work, or 
massage it in an editor. Then it should be easy to import it as a latex file in 
lyx. Or you could copy it into a ERT-box.

I hope this helps.

Ingar