Statalist


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

Re: st: change in indexing for stata10


From   David Airey <[email protected]>
To   [email protected]
Subject   Re: st: change in indexing for stata10
Date   Thu, 15 Nov 2007 13:13:29 -0600

.

Works for me in Stata 10... maybe restart Stata and or your computer. Update as necessary.

. sysuse auto
(1978 Automobile Data)

. display mpg[1]
22

. forval i = 1/20 {
2. display mpg[`i']
3. }
22
17
22
20
15
18
26
20
16
19
14
14
21
29
16
22
22
24
19
30

On Nov 15, 2007, at 1:03 PM, Caleb Southworth wrote:


Was there a change in indexing between Stata 9 & 10?

In Stata 9, this generates a list of ids:

forval i = 1/65 {
	di id[`i']
}

In Stata 10, the same loop on the same data generates no output.

. set trace on

. run "C:\DOCUME~1\cjs\LOCALS~1\Temp\STD05000000.tmp"
- forval i = 1/65 {
- di id[`i']
= di id[1]
- }
- di id[`i']
= di id[2]
- }
- di id[`i']
= di id[3]
- }
[snip]

But

. di id[1]
7

Let me know where I've gone wrong.

Caleb
[email protected]
University of Oregon Sociology
*
*   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/
--
David C. Airey, Ph.D.
Pharmacology Research Assistant Professor
Center for Human Genetics Research Member

Department of Pharmacology
School of Medicine
Vanderbilt University
Rm 8158A Bldg MR3
465 21st Avenue South
Nashville, TN 37232-8548

TEL   (615) 936-1510
FAX   (615) 936-3747
EMAIL [email protected]
URL   http://people.vanderbilt.edu/~david.c.airey/dca_cv.pdf
URL   http://www.vanderbilt.edu/pharmacology


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