Fred Wolfe wrote
> At 05:50 PM 9/22/2002 -0700, you wrote:
> >I want to collapse a large number of variables by tract, i.e.
> >
> >. collapse (sum) _all, by(tract)
> >
> >Naturally, stata complains that tract is included in _all:
> >
> >tract may not be both target and by()
> >r(198);
> >
> >Any clever way around that?
>
> Check out -order- to move tract to the front. The collapse var2-varlast,
> by(tract(.
Another way is
.. unab all: _all
.. local allx: subinstr local all "touse" " ", all
.. collapse (sum) `allx', by(tract)
regards
uli
*
* 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/