Richard Stoll
> Could I make a general observation?
>
> I realize that some Stata users may feel that solving this problem
by the
> following is a bit too much brute force:
>
> gen dem1 = demand1 if index == 1
> gen dem2 = demand2 if index == 2
> .etc.
>
> But let me suggest a couple of reasons why this type of solution may
be
> preferable:
> 1. It is straightforward and quick to implement using the basic
> facilities of most editors.
> 2. It can be much more time consuming to devise and debug a more
> elegant solution.
> 3. When you look back at these statements, it is easy to see what is
> happening. The code for a more elegant solution may be much more
> difficult to decipher when you look back at your .do file in six
months.
>
> I greatly appreciate the inventiveness of solutions to problems that
are
> routinely offered on statalist. I have seen elegant solutions to
problems
> that cannot be solved in any simple straightforward fashion. I have
even
> used some of these solutions myself. But my point is that sometimes
there
> is a strong case for a quick, inelegant brute force solution.
The code above does not solve the original problem -- but
on your major point, no disagreement here. But recall that the
original question asked for a quicker way, and there are several
possibilities.
Once you have learnt them, you never want to go back.
Nick
[email protected]
*
* 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/