\documentclass[a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[SASmode=Server,figname=Illustration]{../statrep}

\begin{document}


This document is named \texttt{testcases.tex}. 
It contains the complete \textit{Getting Started}
example from the \textit{StatRep User's Guide}.
You can generate the final PDF document \texttt{testcases.pdf} as follows:

\begin{description}
	\item[Generate the SAS program]\mbox{}\newline
	Compile this document with \texttt{pdflatex}.
	The \texttt{StatRep} package automatically generates a SAS program from
	the document source. The program is named
	\texttt{example\_SR.sas} and it is created in the current directory.
	
	\item[Capture the SAS outputs]\mbox{}\newline
	Run the SAS program \texttt{example\_SR.sas}. 
	The SAS working directory must be the directory that contains this document.
	
	\item[Create the final PDF]\mbox{}\newline
	Compile this document with \texttt{pdflatex} once more. The outputs that SAS generated
	in the preceding step are now included in the final PDF \texttt{example.pdf}.
\end{description}

The code in the \texttt{Datastep} environment is written
unchanged to the generated SAS program.

\begin{Datastep}
	proc format;
	value $sex 'F' = 'Female' 'M' = 'Male';
	data one;
	set sashelp.class;
	format sex $sex.;
	run;
\end{Datastep}


Example of transfert of SAS parameters or results to \LaTeX :

\begin{Sascode}
	data test;
	mydatea = '01JAN2024'd;
	mydateb = '01JAN2024'd;
	smallnum = 0.00523;
	mediunnum = 1234.56;
	largenum = 456789.12;
	verylarge = 12345678.90;
	%STATREPResults(mydatea, WEEKDATE.);
	output;
	run;
	
	data _null_;
	set test (drop=mydatea); *don''t replace mydatea;
	%STATREPAllResults();
	run;
\end{Sascode}

Mydate (a) is equal \mydatea, (b) is equal to \mydateb{} and large numerical value is equal to \largenum.


The code in the \texttt{Sascode} environment is parsed before it is
written to the generated SAS program. For example, lines that begin with the string
\texttt{\%*;} are written to the SAS program and are not displayed in the 
final document. The other lines in this example are written to the program 
and are displayed in the final document.

The first line of the following code block can be seen only
in the \LaTeX\ source file and in the generated SAS program. 
The line insures that ODS Graphics are enabled.

\begin{Sascode}[store=REGa]
	%*;	OPTIONS MPRINT MLOGIC SYMBOLGEN;
	%*; ods graphics on;
	%startlog(nameoflog)
	proc reg;
	model weight = height age;
	run;
	%endlog(store=0,range=_n_ <= 10)
\end{Sascode}

The \texttt{Listing} and \texttt{Graphic} tags convey information to
\LaTeX\ and to SAS. The tags specify the names of the output files to
insert into the document and the captions for the output.
Additionally, they specify the names of the output files to create
and which ODS objects to capture.

\Listing[store=REG,dest=latex,
caption={Regression Analysis LaTeX}]{REGa}

\Graphic[store=REG, 
caption={Graphs for Regression Analysis}]{REGb}

\Listing[store=REG,dest=listing,
caption={Regression Analysis listing}]{REGc}
In this short example only the defaults are used. That is, all output
objects are selected and displayed.

\Listing[caption={Log de la proc reg}]{nameoflog}


\section{More Cases}
\begin{Datastep}
title 'no options';
data one;
  set sashelp.class;
run;
\end{Datastep}

\begin{Datastep}[program]
title 'program only';
data one;
  set sashelp.class;
run;
\end{Datastep}

\begin{Datastep}[display]
title 'display only';
data one;
  set sashelp.class;
run;
\end{Datastep}

\begin{Datastep}[first=2]
title 'first=2';
data one;
  set sashelp.class;
run;
\end{Datastep}

\begin{Datastep}[first=2, last=2]
title 'first=2 last=2';
data one;
  * another line;
  set sashelp.class;
run;
\end{Datastep}

\begin{Datastep}[first=2, last=2, fontsize=tiny]
title 'first=2 last=2 fontsize=tiny';
data one;
  set sashelp.class;
run;
\end{Datastep}

\begin{Sascode}
title 'no options';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}[program]
title 'program only';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}[display]
title 'display only';
proc print data=one;
run;
\end{Sascode}


\begin{Sascode}[store=mydoc]
title 'store=mydoc';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}[store=mydoc0, fontsize=tiny]
title 'store=mydoc0 fontsize=tiny';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}
%* program 2;
title 'no options, line command(program)';
title2 'next title';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}
%* display 2;
title 'no options, line command(display)';
title2 'next title';
proc print data=one;
run;
\end{Sascode}

\begin{Sascode}
%*;  title 'no options, line command(inline)';
proc print data=one;
run;
\end{Sascode}

\Listing[caption={missing file, no option}]{mymiss}

\Listing[store=mydoc, ]{myouta}

\Listing[store=mydoc, dest=latex, style=brick]{myoutaa}

\Listing[store=mydoc, fontsize=tiny, caption={fontsize=tiny}]{myoutb}

\Listing[store=mydoc, linesize=96, caption={linesize=96}]{myoutc}

\Listing[store=mydoc, caption={Back to vanilla listing}]{myoutd}

\begin{Sascode}[store=mygdoc]
title;
proc reg data=one;
model weight=age;
run;
\end{Sascode}


\Listing[store=mygdoc, dest=latex, caption={vanilla latex dest table}]{mygoutz}

\LFleft=-1in\Listing[dest=latex, caption={Shifted -1in, vanilla latex dest table}]{mygoutz}

\Graphic[store=mygdoc, dest=latex, caption={vanilla latex dest graphic}]{mygouty}

\Graphic[store=mygdoc, caption={vanilla graphic}]{mygouta}

\Graphic[store=mygdoc, scale=0.4, style=journal, caption={style=journal, scale=0.4}]{mygoutb}

\Graphic[store=mygdoc, width=2in, caption={width=2in}]{mygoutc}

\Graphic[store=mygdoc, dpi=100, caption={dpi=100}]{mygoutd}

\Graphic[store=mygdoc, height=2in, caption={height=2in}]{mygoute}

\Graphic[store=mygdoc, style=brick, caption={style=brick}]{mygoutf}

\Graphic[store=mygdoc, caption={Back to vanilla graphic}]{mygoutg}


\begin{Datastep}[first=5, last=3]
data Wine;
   input WineType $ VisitLength @@;
   datalines;
white  80 white  98 white 115 white  89 white 103
white  91 white 119 white  31 white 109 white  95
white  71 white 105 white  66 white 141 white  79
white 113 white  69 white 120 white  87 red    93
red    87 red   106 red    76 red   121 red   143
red    81 red    97 red    74 red   107 red   112
red    67 red   107 red    72 red   116 red    99
red   104 red    91 red   132 red    78 red   107
red   101 red    92
;
\end{Datastep}
%$

\begin{Sascode}[store=wineA]
ods graphics on;
proc anova data=Wine;
   class WineType;
   model VisitLength = WineType;
run;
ods graphics off;
\end{Sascode}

\Listing[store=wineA, dest=latex,
   objects=ClassLevels NObs OverallANOVA,
   caption={Analysis of Variance for Visit Length}]{tsta}

\Listing[store=wineA,
   objects=ClassLevels NObs OverallANOVA,
   caption={Analysis of Variance for Visit Length}]{tstab}


\begin{Datastep}
proc format;
   value $sex 'F' = 'Female' 'M' = 'Male';
data one;
   set sashelp.class;
   format sex $sex.;
run;
\end{Datastep}
%$

\begin{Sascode}[store=class]
%*; ods graphics on;
proc reg;
    model weight = height age;
run;
\end{Sascode}



\Listing[store=class,
         caption={Regression Analysis}]{rega}

\Listing[store=class, dest=latex,
         caption={Regression Analysis}]{regab}

\Graphic[store=class,
         caption={Graphs for Regression Analysis}]{regb}

Some Text
In this tutorial we'll create simple web browser using Python PyQt
framework. As you may know PyQt is a set of Python bindings for Qt
framework, and Qt (pronounced cute) is C++ framework used to create
GUI-s. To be strict you can use Qt to develop programs without GUI
too, but developing user interfaces is probably most common thing
people do with this framework. Main benefit of Qt is that it allows.

\begin{itemize}
  \item text one PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
  \item
  \Graphic[store=class, scale=0.3,
           caption={Graphs for Regression Analysis}]{regc}
  \item text two PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
  \item
  \Listing[store=class, dest=latex,
           caption={Regression Analysis}]{regad}
  \item text three PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
  PyQt is a set of Python bindings for Qt
\end{itemize}

Some more Text.
In this tutorial we'll create simple web browser using Python PyQt
framework. As you may know PyQt is a set of Python bindings for Qt
framework, and Qt (pronounced cute) is C++ framework used to create
GUI-s. To be strict you can use Qt to develop programs without GUI
too, but developing user interfaces is probably most common thing
people do with this framework. Main benefit of Qt is that it allows.

\end{document}
