Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Janet Hill <janethill73@yahoo.co.uk> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Re: Writing values to a file |
Date | Wed, 8 Dec 2010 11:15:19 +0000 (GMT) |
I would be grateful for some advice on writing a value to a file. I have a dataset where I need select a particular value, the first value exceeding a threshold value,and the process is repeated over 240 groups. I can list the values but I am unable to write the values to a file for subsequent use. My code - and I know it is awful programming - is: capture : file close myfile file open myfile using "elong.txt", write replace file write myfile ("repeat,e") _n capture : drop marker gen marker=0 forvalues i=1/24{ replace marker=1 if repeat==`i' & ld > 0.001 su id1 if marker==0 & repeat==`i' list group repeat l ls e if repeat==`i' & id1==r(min) file write myfile (e) if repeat==`i' & id1==r(min) file write myfile "," file write myfile (`i') _n } file close myfile Many thanks. Janet * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/