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

st: single spaces in outfile

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: single spaces in outfile
Date   Wed, 14 Aug 2002 13:56:19 +0100

Laura Miller <[email protected]> wrote

I am using the outfile command to output a file with nine variables.
They are
all of fixed width but some are string and some are numeric. My
problem is when
it outputs the file it leaves several spaces between the variables. I
need it to
leave just one space between them (for inputting to another program).
I know the
runtogether option allows for no spaces. Is there a command that
creates just
one space between the variables?

>>> You could whip up a program using -file-, but
even quicker is to use a good text editor with
the facility to select and remove rectangular blocks of
text, or to do this in some other way, e.g. by
a global search and replace for multiple spaces.

Alternatively, if there are no commas in your string variables,
-outsheet- as comma-separated variables and do a global
search and replace of commas by spaces.

Alternatively, a script in Awk or Perl or Python
or some other scripting language would do the job.

The internet is awash with downloadable text editors,
many freeware or shareware. Much advice for Stata users
on some of the good (and also on a couple of the bad and
the ugly) is gathered from some seventeen of us at

This gives me an opportunity to flag the latest
update of that FAQ, a section on EmEditor by
Friedrich Huebler, added on 12 August.

[email protected]

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index