| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Outsheet file to "txt" file
Another possibility is to use -listtex-, downloadable from SSC. You
might type
listtex x y z using mytextfile.txt, delim(" ") replace
and the file -mytextfile.txt- will contain the variables x, y and z,
delimited by 11 spaces.
I hope this helps.
Roger
Roger Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
www.imperial.ac.uk/nhli/r.newson/
Opinions expressed are those of the author, not of the institution.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ulrich Kohler
Sent: 24 August 2006 08:23
To: [email protected]
Subject: Re: st: Outsheet file to "txt" file
Ms. Marilyn Ibarra wrote:
> I am trying to outsheet data from STATA to a "txt" file. I do not
want
> comma's or tab's between columns. I would like the data to have
spacing
> (11 spaces) between each column. Is there a way to set the spaces
between
> columns so that it looks like this:
>
>
>
> 1122 222 65445
>
> 1122 222 65445
>
> 1122 222 65445
>
>
>
>
>
> I would like to have:
>
>
>
> In column 1, a 4 digit number and 7 spaces after the number. In
column 2,
> a 3 digit number and 8 spaces after the number. Etc....
Outsheet uses tabs to separate columns, and talking about a tab as being
"11 spaces" wide is somewhat problematic. The wideness of the tab depend
on
the program that you use to view the file. It is not a feature of the
tab
itself.
However, if you want to save your data into a text file with spaces in
between
the columns you can build one string variable from you data and save
this
string into a text file. Imagine that your variables are v1 v2 v4:
. gen out = string(v1) + " " + ///
string(v2) + " " + ///
string(v3)
. outsheet out using myfile, noquotes
The aproach has its enemies in the number of characters that can be
stored in
a string variable---244---, naturally.
hope this helps
Uli
--
[email protected]
+49 (030) 25491-361
*
* 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/