Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: RE: RE: Time-Demeaning one's Data


From   Deokrye Baek <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: RE: Time-Demeaning one's Data
Date   Thu, 16 Sep 2010 14:33:34 -0700 (PDT)

Please try this

 foreach v of varlist em lnrwr lnreo lnpa lnna {
 bysort id: egen mean_`v'=mean(`v')
 gen demean_`v'=`v'-mean_`v'
 drop mean_`v'
 }










----- Original Message ----
From: Sinan Hastorun <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Thu, September 16, 2010 4:12:22 PM
Subject: st: RE: RE: RE: Time-Demeaning one's Data

I got another error this time =exp required. Any suggestions? 

. foreach v of varlist em lnrwr lnreo lnpa lnna {
  2. bysort id: egen mean_`v'=mean(`v')
  3. drop mean_`v'
  4. gen wem wlnrwr wlnreo wlnpac
  5. }
=exp required
r(100);




-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Sarah Edgington
Sent: Thursday, September 16, 2010 3:42 PM
To: [email protected]
Subject: st: RE: RE: Time-Demeaning one's Data

Sinan,
You don't want brackets around the list of variables.
-Sarah 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sinan Hastorun
Sent: Thursday, September 16, 2010 12:38 PM
To: [email protected]
Subject: st: RE: RE: Time-Demeaning one's Data

Sure, I inserted the variables and entered the commands as follows:

. foreach v of varlist  [em lnrwr lnreo lnpac] {
  2. bysort id: egen mean_`v'=mean(`v')
  3. drop mean_`v'
  4. gen wem wlnrwr wlnreo wlnpac
  5. }
varlist required
r(100);

Sinan 


*
*  For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/

*
*  For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/



      


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index