Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: extending levelsof to more than one variable


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: extending levelsof to more than one variable
Date   Fri, 29 Jun 2012 15:49:58 +0100

Second line needs the -egen- call. 

Nick 
n.j.cox@durham.ac.uk 


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis
Sent: 29 June 2012 15:33
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: extending levelsof to more than one variable

On Fri, Jun 29, 2012 at 4:27 PM, Pradipto Banerjee
<pradipto.banerjee@adainvestments.com> wrote:
> I have a code below that I use as follows: "by group1 : egen var1new = neutralize (var1 var2 var3)" . The problem is that if I extend it to "by group1 group2 : egen var1new = neutralize (var1 var2 var3)" or "by group1 group2, sort : egen var1new = neutralize (var1 var2 var3)"  etc., then the code does not work as it depends upon levelsof to loop.

egen groupgroup = group(group1 group2)
by groupgroup : neutralize(<whatever>)

*
*   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   |   Site index