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

st: Re incremental counter


From   Peter Parzer <[email protected]>
To   [email protected]
Subject   st: Re incremental counter
Date   Fri, 2 Dec 2005 08:25:35 +0100

Am Donnerstag, 1. Juli 2004 03:16 schrieb Yang Li:
> Could anyone advice how to generate variable name with a incremental
> counter in it.
> What I intend to do is:
> local i=0
> gen var'i'=a-b (suggestion required)
> i=i+1
>
> Best Regards,
> Yang

if for example i shuld go from 1 to 1o the following will work:
forvalues i=1/10 {
  gen var`i'=a-b
}

-- 
Peter Parzer
Zentrum f�r Psychosoziale Medizin
Klinik f�r Kinder- und Jugendpsychiatrie
Blumenstra�e 8, D-69115 Heidelberg
Tel.: +49/6221/56-6940, Fax: +49/6221/56-6941

*
*   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