Marilyn Ibarra wrote:
I am trying to outsheet data from STATA to a �?otxt�?� file. I do not want
comma�?Ts or tab�?Ts between columns. I would like the data to have spacing
(11 spaces) between each column.
[snip]
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�?�.
--------------------------------------------------------------------------------
Nicolas Couderc, Ulrich Kohler and Roger Newson mentioned approaches. In
addition to those, you can use -outfile-.
The code below will put the first digit of the first variable in column 1,
the first digit of the second variable in column 12 and the first digit of
the third variable in column 23, which is what I think that you're after.
The actual code starts after "Begin here". The first half-dozen lines, or
so, are just to reproduce your dataset.
Joseph Coveney
clear
set more off
input int variable1 int variable2 long variable3
1122 222 65445
1122 222 65445
1122 222 65445
end
*
* Begin here
*
foreach var of varlist _all {
tostring `var', replace
format `var' %-8s
}
outfile using Eleven-wide.prn, wide noquote
exit
*
* 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/