Statalist The Stata Listserver


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

st: RE : Outsheet file to "txt" file


From   "Nicolas Couderc" <Nicolas.Couderc@univ-paris1.fr>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE : Outsheet file to "txt" file
Date   Wed, 23 Aug 2006 18:17:38 +0200

Hi,

This code should do the trick. Please let me know if not !

Nicolas
---
file open fich using "d:\datas\try.txt" ,write replace text
local nbline=_N
forvalues row=1/`nbline' {
	foreach var of varlist * {  
		local val=`var'[`row']
		file write fich (`val') 
		local vale = string(`val')
		local compt=11-length("`vale'")
		while `compt'>0 {
			file write fich _char(32) 
			local compt=`compt'-1
		}
	}	
	file write fich _n
}
file close fich
---


-------
Nicolas Couderc

Centre d’Economie de la Sorbonne, TEAM & CNRS
Maison des Sciences Economiques,
Université Paris 1 - Panthéon-Sorbonne
106-112, boulevard de l'Hôpital 
F-75647, Paris, Cedex 13
Email : couderc@univ-paris1.fr
Page web : http://team.univ-paris1.fr/teamperso/couderc/index.htm


-----Message d'origine-----
De : owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] De la part de Ms. Marilyn
Ibarra
Envoyé : mercredi 23 août 2006 17:08
À : statalist@hsphsun2.harvard.edu
Objet : st: Outsheet file to "txt" file


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….



Thank you in advance,

Marilyn. 

   

 


*
*   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/

-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.


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