Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: while looping


From   xiaotang li <xiaotang_sue_li@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: while looping
Date   Wed, 20 Aug 2003 02:16:15 -0700 (PDT)

Dear all,
 
Sorry if you received duplicated copy of this email, I
apologize, this is my first time to post here.
 
i am just starting to use Stata and glad to join this
statalist.
 
I am now learning to use while looping, but it doesn't
work for me. I myself can't find any problems with the
programe and can anyone here point out what mistake I
made?
 
For example, I am doing a simple matrix calculation
like A=2*A and construct the following program
 
prog define test
set trace on  
matrix A=J(3,3,1)
matrix list A
version 7.0
local i=1
while 'i'<5 {
matrix A=2*A
local i='i'+1
}
end
 
The Stata just returns as the following and when I
type 'matrix list A' in the command box, it returns as
'matrix A not found', seems nothing is done by Stata.
 
prog define test
  1. set trace on
  2. matrix A=J(3,3,1)
  3. matrix list A
  4. version 7.0
  5. local i=1
  6. while 'i'<5 {
  7. matrix A=2*A
  8. local i='i'+1
  9. }
 10. end
. 
end of do-file

 
What is the problem I've got? Many thanks for your
kind help.
 
Xiaotang


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
*
*   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