Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Outputing variables values in to a file
From
Aaron Kirkman <[email protected]>
To
[email protected]
Subject
Re: st: Outputing variables values in to a file
Date
Thu, 27 Sep 2012 18:56:46 -0500
Going along with what Nick said, two nested loops should do the trick.
To write to a file, the -file- command should do what you want.
http://www.ats.ucla.edu/stat/stata/faq/filewrite.htm
On Thu, Sep 27, 2012 at 6:34 PM, Nick Cox <[email protected]> wrote:
> Looks like two nested loops with a -display- statement in the middle.
>
> Nick
>
> On Fri, Sep 28, 2012 at 12:11 AM, Pradipto Banerjee
> <[email protected]> wrote:
>
>> Suppose I have N columns & M rows of data in a Stata dta file like this:
>>
>>
>> c1 c2 ... cN
>>
>> r1 3 4 ... 6
>> r2 1 2 ... 7
>> . . . ....
>> . . . ....
>> rM 3 9 ... 1
>>
>>
>> I want to output a text file with as follows:
>>
>> line 1 is "3 w1 + 1 w2 + .... + 3 Wm >= 1"
>> line 2 is "4 w1 + 2 w2 + .... + 9 Wm >= 1"
>> .
>> Line N is "6 w1 + 7 w2 + ... + 1 Wm >= 1"
>>
>> Can someone help me about how to write/output such a text file?
>>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/