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]

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


From   Sinan Hastorun <SinanH@remi.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Time-Demeaning one's Data
Date   Thu, 16 Sep 2010 15:37:41 -0400

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 


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Steve Samuels
Sent: Thursday, September 16, 2010 3:36 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: RE: Time-Demeaning one's Data

Did you forget to list your variables in   [YOUR VARIABLES HERE] ?  If
not,  please show your commands as the FAQ  request

Steve

On Thu, Sep 16, 2010 at 3:18 PM, Sinan Hastorun <SinanH@remi.com> wrote:
> Thank you for this. When I enter the code into STATA, however, it gives me the following error in the end:
> varlist required
> r(100);
>
> Does one need to add another command in order to finish generating the time-demeaned variables?
>
> Thank you.
>
>
>
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Duha Altindag
> Sent: Thursday, September 16, 2010 12:52 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: Time-Demeaning one's Data
>
> Do you mean subtracting the mean of each individual over time from
> each observation of that individual?
> If id is individual identifier, then
>
> foreach v of varlist  [YOUR VARIABLES HERE] {
> bysort id: egen mean_`v'=mean(`v')
> g demeaned_`v'=`v'-mean_`v'
> drop mean_`v'
> }
>
> should do it.
>
>
> On Thu, Sep 16, 2010 at 9:56 AM, Sinan Hastorun <SinanH@remi.com> wrote:
>>
>> Dear Statalist users,
>>
>> I need to time-demean my data before I can run my analysis. Is there a quick way to do this? Thank you very much for your input.
>>
>> Sinan Hastorun, M.A.
>> Associate Research Economist
>> 433 West Street
>> Amherst, MA 01002
>> Main Phone: (413) 549-1169
>> FAX: (413) 549-1038
>>
>>
>>
>>
>> *
>> *   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/
>
> *
> *   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/
>
> *
> *   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/
>

*
*   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/

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