I have checked and rechecked --no typos.
macro dir shows that the macro was not recorded at all when I run it from the .do file.
But now I know there is a problem with my machine, or installation of Stata.
I found a way around it though:
global demog "female black hisp other age80"
probit hsgrad $demog
Thanks,
Elda
-----Original Message-----
From: [email protected] on behalf of Richard. Williams
Sent: Fri 7/1/2005 1:16 PM
To: [email protected]
Cc:
Subject: Re: st: macros in do files don't run
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/
<<winmail.dat>>