Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Poliquin, Christopher" <cpoliquin@hbs.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: _byn1() and _byn2() variables in numlist |
Date | Mon, 27 Sep 2010 17:39:40 -0400 |
Hello, I am attempting to use the _by variables in a byable program, but am running into problems with syntax problems and invalid numlists that I cannot figure out how to resolve: I do... . program testing, byable(recall) 1. marksample touse 2. di _byn2() 3. di _byn1() 4. forvalues x = _byn2()(-1)_byn1() { 5. di `x' 6. } 7. end . bys foo : testing And get ... ---------------------- -> foo = 1 2 1 invalid syntax r(198); And when using a numlist, i.e. foreach x of numlist _byn2()(-1)_byn1(), I get an invalid numlist error. How do I cycle through each observation number in a group within a byable program? Best wishes, Chris * * 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/