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: Creating new variables from a STATA panel dataset
From 
 
Lucio Vinhas de Souza <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: Creating new variables from a STATA panel dataset 
Date 
 
Wed, 3 Aug 2011 10:18:08 -0700 (PDT) 
Thanks, Nick. Now, as I have several hundred variables (as I indicated in my earlier post, which include common country codes), it is not really feasible that I write all of them in a command. I would assume there should be some sort of "wild card" notation that one could use to replace a part of the varname in STATA. If I am correct, which would be this?
Lucio.
--- On Wed, 3/8/11, Nick Cox <[email protected]> wrote:
> From: Nick Cox <[email protected]>
> Subject: Re: st: Creating new variables from a STATA panel dataset
> To: "[email protected]" <[email protected]>
> Date: Wednesday, 3 August, 2011, 19:10
> 
> * cannot be part of a variable name.
> 
> Nick
> 
> On 3 Aug 2011, at 17:14, Lucio Vinhas de Souza <[email protected]>
> wrote:
> 
> > Dear All,
> > 
> > Very basic question, for someone that has not used
> STATA for several years now: I have a panel dataset
> (adequately tis t and iis id) of several hundred variables,
> and I want to:
> > 
> > a)    Generate new variables
> > b)    Run a xtbond from those new variables
> > 
> > I have been trying to generate new variables which are
> change rates form the existing ones. The names of the
> existing variables are all variations from the format
> “countrycode_extension”. I have been trying to
> > 
> > gen
> “*_extension_new”=((“*_extension”-“*_extension_new”[_n-1])/
> “*_extension_new”[_n-1])
> > 
> > and always get the message
> > 
> > *invalid name
> > 
> > 
> 
> *
> *   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/