Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: single spaces in outfile - additional comment


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: single spaces in outfile - additional comment
Date   Wed, 14 Aug 2002 15:15:59 -0400

> With the file command, you can roll your own version of this fairly
> easily:
> 
>    version 6
>    file open myfile using <filename>, text write replace
>    local N=_N
>    forval i=1/`N' {
>       local line : di _col(1) varname1[`i'] _col(25) varname2[`i'] ...
>       file write myfile `"`line'"' _n
>    }
>    file close myfile
>    version 7
> 

I should note that the original request was for a single space between
variables -- then the fifth line would look like this:

   local line : di varname1[`i'] " " varname2[`i'] " " varname3[`i'] ...

Nick Winter
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index