Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <n.j.cox@durham.ac.uk> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Followup: inverting a stored table of regression results - then exporting to a cvs/excel file |
Date | Fri, 5 Nov 2010 17:29:48 +0000 |
You just get Stata to count the levels. . sysuse auto (1978 Automobile Data) . levelsof rep78, local(levels) 1 2 3 4 5 . local nlevels : word count `levels' . di `nlevels' 5 Nick n.j.cox@durham.ac.uk Ben Hoen Let's say I do not know how many groups I have delineated in -levelsof-, but needed to create code to break the table if necessary. I figure, I want to create a local macro of the number of groups and then I can create an if/then step as is needed. I am sure one can do this, but I was not able to figure it out. Do you know how? * * 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/