Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

Re: st: Data entry into TeX files (other than tables and graphs)

 From Richard Herron To statalist@hsphsun2.harvard.edu Subject Re: st: Data entry into TeX files (other than tables and graphs) Date Mon, 31 Oct 2011 09:57:02 -0400

```Thanks for the lessons, Roger and Nick!

-parmest- is great and will come in handy for generating tables. But I
think for outputting scalars to TeX -file- will work best for me (code
below).

* begin code
file open temp using E:\temp.txt, write text replace
file write temp (e(N))
file close temp
* end code

Mon, Oct 31, 2011 at 07:46, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> Roger's advice gives good positive suggestions.
>
> A secondary detail remains: Why didn't -outfile- work for Richard? In essence -outfile- requires a varlist, except that without one the entire dataset would be output. Richard's argument e(N) is clearly not a variable name, so is not a varlist. The rather cryptic message does show that -outfile- is trying hard to interpret what Richard writes as a variable name, but it can't turn e(N) into a varlist. Of course, anything you put into a variable first is fair game.
>
> In other contexts, -file- is closer to what Richard is seeking.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Roger B. Newson
>
> This can be done using the -parmest- and -listtab- packages, both
> package, which you can also download from SSC. I would check the on-line
> help for these packages to see which does what you want.
>
> On 30/10/2011 01:56, Richard Herron wrote:
>
>> Can I save estimate parameters to a text file so that I can enter them
>> into a TeX file using \input{}? That is, I want to add the number of
>> observations or regression coefficients -- e(N) or e(b) -- in the text
>> of a paper without having to cut and paste. (I already know how to add
>> tables and graphs.)
>>
>> I can save a specific value to file with -outfile-.
>>
>> *begin code
>> sysuse auto, clear
>> outfile mpg using temp in 1/1, replace noquote
>> *end code
>>
>> But I can't save estimate results.
>>
>> *more code
>> regress mpg rep78
>> display e(N)
>> outfile e(N) using temp2, replace noquote
>> *end more code
>>
>> The last line gives the following error.
>>
>> factor variables and time-series operators not allowed
>> r(101);
>>
>> Is there a away to script all data entry into TeX files? Or do I have
>> to cut and paste? Thanks!
>
> *
> *   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/
>

*
*   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/
```