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]
st: RE: referencing a list of variables in multiple commands
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: RE: referencing a list of variables in multiple commands
Date
Sun, 4 Apr 2010 01:54:04 +0200
<>
Just use a -local- macro, as explained in manual [U], 18.3.1.:
*************
sysuse auto, clear
local covariates weight length turn trunk
reg price `covariates'
reg price `covariates' if rep78==3
*************
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Vineet Bhagwat
Sent: Samstag, 3. April 2010 18:08
To: [email protected]
Subject: st: referencing a list of variables in multiple commands
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/