|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: AW: creating and calling local macros in do-files
To reinforce Martin's points:
1. The word -local- means what it says. Local macros are not visible
outside their locale, meaning the program, do file, do-file editor or
interactive session in which they are defined. There are ways of
circumventing this, which are only occasionally needed, but it is very
much the rule.
2. We need to see code to give precise advice. Your word descriptions
plus your guesses on what and why don't give enough information to pin
down the precise problems you are creating.
Nick
Martin Weiss wrote:
<>
First of all, from your description it is not necessarily the case that you
need -local-s at all. If you do, a do-file counts as one session, and all
-local-s are lost upon its termination.
I would suggest you post example data and what you want to achieve, and the
-local- thing will be rendered redundant...
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von S Aneeqa Aqeel
I am using STATA10 on a Windows 64-bit system.
I have looked up past FAQs on macros as well as the STATA user guide,
etc. I have also tried my code on a different computer, but get the
same result. So I'm posting my question to the Statalist and would be
grateful for any light you can shed on this matter.
I am using panel data and creating quarterly dummies for each year
(2000-2009).
I then create local macros, one for each year, collecting the
quarterly dummies by year.
I am finding that STATA does not create more than one local macro if I
try to create several inside a do-file. Consequently, when the
do-file then tries to execute a regression, based on the local macros
created, the regression output shows no results at all for the
variables inside the macros which I am calling in the regression.
If I create each macro in the command window, one by one, and then run
the regression by typing it out in the command window, I get results
for each of the variables included.
Similarly, if I try to see what variables are included in the macro
(by using "summarize"), it doesn't work if the macro was one of
several created in the do-file, but will work if I created it directly
from the command window.
Can you tell me why a macro might not run from inside the do-file? Is
there an upper limit to the number of local macros one can create and
call at any time?
I can provide log files and my code if it would help.
*
* 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/