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

RE: st: RE: file write vs. display; trimming; string()


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: file write vs. display; trimming; string()
Date   Thu, 29 Apr 2004 19:16:39 +0100

Thanks; although in this case I fiddled 
around until I found something that works. 

The most evident issues are 

1. The use of the 
g format e.g. %5.0g. I think of "5" (in 
this example) as being a recommendation. 
g tries to be really smart on your behalf, 
but it can't always read your mind. 

In %5.0f "5" is a stronger recommendation. 

2. Taking control by mapping something 
to a string. Once Stata thinks it has 
a string, it takes it literally. (What 
else?) 

StataCorp, especially Bill Gould, who 
put a lot of work relatively recently into the 
-format- code, may want to say more. 

Nick 
[email protected] 

David Kantor
> 
> At 04:23 PM 4/29/2004 +0100, Nick Cox wrote:
> >Try something like
> >
> >         tempfile foo
> >         tempname bar
> >         file open `bar' using `foo', write
> >         forval i = 1/10 {
> >                 local val : di %5.0f `i'
> >                 file write `bar' _n "`val'"
> >         }
> >         file close `bar'
> >
> >Nick
> >[email protected]
> >[...]
> 
> Thanks very much, Nick.  I suspected there would be a better 
> solution, and 
> that you would be the one who knew it..
> -- David
> 
> David Kantor
> Institute for Policy Studies
> Johns Hopkins University
> [email protected]
> 410-516-5404
> 
> *
> *   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/
> 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index