Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Outsheet file to "txt" file


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Outsheet file to "txt" file
Date   Thu, 24 Aug 2006 09:22:50 +0200

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/



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