Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: foreach loop over a column


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: foreach loop over a column
Date   Wed, 14 Oct 2009 00:55:50 +0200

<>

You probably want

**************
levelsof permno

foreach num in `r(levels)' {
       // do something
}
**************


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kushan Thakkar
Sent: Mittwoch, 14. Oktober 2009 00:53
To: statalist@hsphsun2.harvard.edu
Subject: st: foreach loop over a column

I have a column name permno in my dataset. It is a numerical column,
and I want to loop over it. This is what I did:

foreach num in permno {
       // do something
}

but this is not working.. what am i doing wrong?

Thanks
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/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