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: referencing a list of variables in multiple commands


From   Justin Wheeler <jwheeler@kippphiladelphia.org>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: referencing a list of variables in multiple commands
Date   Sat, 3 Apr 2010 09:14:07 -0700

See the help for -local-. You can create a local variable storing your  
variable list.

Justin

On Apr 3, 2010, at 12:09 PM, "Vineet Bhagwat"  
<vineet.bhagwat@gmail.com> wrote:

> Sorry if this is a basic question.
>
> I want to create a varlist that I can continually reference in future
> commands in my .do file without having to type all the variables in
> the list.  For example I want to create a list of variables to include
> as independent variables in a regression without having to type them
> or copy/paste them into each reg command.
>
> Something like this:
> ------------------
> varlist v "assets roa roe ret"
>
> reg y v
> reg y v if x==0
> reg y v if x==1
> ---------------
>
> I couldn't figure out how to do this from the stata files, thanks in  
> advance!
>
> Vineet
> *
> *   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