Statalist


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

Re: st: modifying a macro containing variable names (problem solved)


From   Jeremy Reynolds <jeremyr@uga.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: modifying a macro containing variable names (problem solved)
Date   Sun, 09 Mar 2008 20:22:23 -0400

Your code worked flawlessly.  Many thanks, Maarten.

Jeremy

Maarten buis wrote:
I started by recreating your error messages and thus created the global
$ivlist, but than in my solution changed it into a local. I did not
change that everywhere, but because the global still hang around, I
did not get an error message. The correct code should be:
*----------------- begin example ------------------
sysuse auto, clear
reg mpg displacement turn gear_ratio
local ivlist "displacement turn gear_ratio"
foreach var of varlist `ivlist' {
local list1 : list ivlist - var
di "`list1'"
local numvars : word count (`list1')
adjust `list1', xb by(foreign)
sum `list1'
}
*-------------- end example -----------------------

Sorry,
Maarten



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


___________________________________________________________ Rise to the challenge for Sport Relief with Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
********************
Dr. Jeremy Reynolds
Associate Professor
Undergraduate Coordinator
Department of Sociology
117 Baldwin Hall
University of Georgia
Athens, GA 30602-1611
Phone: (706) 583-8072
Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
Fax: (706) 542-4320

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index