Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: macros in do files don't run


From   "Richard. Williams" <[email protected]>
To   [email protected]
Subject   Re: st: macros in do files don't run
Date   Fri, 01 Jul 2005 15:16:19 -0500

At 01:05 PM 7/1/2005, Pema, Elda ALB wrote:
There must be a very easy solution to this but I have been unable to find it:

When I define macros and run regressions interactively everything works fine.
E.g.:
local demog "age female black hisp other"
reg hsgrad `demog'

When I put the same commands in a .do file, nothing works. It's as if the macros didn't exist at all and regressions are run with only a constant term. I tried defining a global macro too, but that didn't help either. Finally, I tried defining the macros interactively, and running the regressions from the .do file, and that didn't help either. Any ideas?
Works for me. Sure you don't have a typo somewhere? When I'm having trouble, I like to add a

macro dir

command to my do or ado file so I can make sure that the local macros are what I think they are. Also, either interactively or in your do file you can give the command

set trace on

This will let you see exactly what Stata is doing. Remember to -set trace off- afterwards.


-------------------------------------------
Richard Williams, Associate Professor
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index