Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: adding a variable to a macro


From   "B. Timothy Walsh" <[email protected]>
To   [email protected]
Subject   Re: st: adding a variable to a macro
Date   Sat, 19 Jul 2008 09:13:33 -0400

You are clearly correct! I must have made a typo.
I apologize for the bother, but am very grateful for the quick answer!
Tim

--On Friday, July 18, 2008 9:33 PM -0500 Richard Williams <[email protected]> wrote:


At 08:19 PM 7/18/2008, B. Timothy Walsh wrote:
I am very new to Stata, but, having searched FAQ and Statalist, have
not been able to find a solution...

I would like to add another variable to a local macro containing
variables. So, if myvars contains varone vartwo varthree:
local myvars varone vartwo varthree

How do I add newvar?
I would have thought something like the following would work:
local myvars `myvars' newwar

But, it does not.
I'd appreciate any suggestions or guidance.
Thanks!
Tim Walsh
Yes it does. Try this:

local myvars var1 var2
local myvars `myvars' var3
display "`myvars'"

The result of the last command is

. display "`myvars'"
var1 var2 var3

You probably have a typo somewhere or there is something you are not
telling us.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index