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: generate many variables at once


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: generate many variables at once
Date   Sun, 18 Sep 2011 07:51:32 -0400

donsaane dontsi <donsaane@yahoo.fr> :
http://www.stata.com/help.cgi?foreach
unab a: *
loc noti "i year"
loc todo: list a - noti
foreach v of loc todo {
bys i (year): g d`v'=`v'-`v'[_n-1] if year==year[_n-1]+3
}

On Fri, Sep 16, 2011 at 4:34 PM, donsaane dontsi <donsaane@yahoo.fr> wrote:
> Hi ,
>
> I want to difference all my variables in my dataset. Is there any command to generate many variables at once? instead of doing them one by one
>
> thanks
>
> dsd
>
> *
> *   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