[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: RE: st: RE: re: while looping
On Wed, 20 Aug 2003 03:51:49 -0700 (PDT) xiaotang li
> Thanks a lot for your reply and sorry for bothering
> you again. Still I can't work it out. I just don't
> know how to run a programe. I write such things like:
> prog define Nick
> display 'Hi there'
> in a do-file and save the do-file, then I type
> 'do.....' in the command box to do the do-file, is it
It might be useful for you to distinguish between
do files, and
and to spend some time reading the fine manuals, especially chapters 19
and 20 of the User Guide which discuss each of these in detail.
Your examples suggest to me that you may simply want to learn about do
files (an ascii file containing a set of Stata commands). For what you
wanted to do, it seems to me that you don't need a "program" in the
specialist Stata sense (nor thence an ado file, which typically
contains specification of program(s) )
On a slightly different tack, I am also not sure from your example why
you wanted to use a loop. If you want to multiply all elements of an
existing matrix by a common scalar, then you can do it in one line
using the -matrix- command.
Note too, Nick Cox's remark about using -forvalues- rather than -while-.
Professor Stephen P. Jenkins <firstname.lastname@example.org>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
* For searches and help try: