Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: macro issue


From   Alison Connor <alison.connor@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: macro issue
Date   Wed, 6 Mar 2013 09:26:07 -0500

Hi Mukesh,

If you run the lines separately from the do file (i.e. select line 1,
and hit ctrl+d or the do button then select line 2, and hit ctrl+d or
the do button), then the macro from line 1 will not be stored. If you
are typing in each line separately, or cutting and pasting each line
separately from the do file, then it should work. Could this be the
issue?

~Alison


On Wed, Mar 6, 2013 at 9:18 AM, Dherani, Mukesh
<M.K.Dherani@liverpool.ac.uk> wrote:
> Thank you Nick.
> No I am using it in the same do file for same analysis.
>
> local x var1 var2 varn  // first I ran this command
> logistic y `x'   //  then I ran this command in the same file and result
> is blank
>
> for -if-
>
> local x var1 var2 varn  // first I ran this command
> logistic y `x' if intervention==1  //  then I ran this command, I get
> results for intervention only, unless I select both lines and run.
>
>
> BW,m
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: 06 March 2013 12:58
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: macro issue
>
> At a guess you are defining a -local- macro in one place and trying to use
> it in another.
>
> A local macro is only visible in the same place -- one might say locale --
> in which it is defined, meaning
>
> the _same_ interactive session
>
> the _same_ do-file
>
> the _same_  block of commands in the do-file editor
>
> the _same_ program.
>
> The way to remember it is that that is what -local- means!
>
> Note that -if- is not an option. You don't mention how you are using -if-,
> but it is either a qualifier or a command.
>
> Nick
>
> On Wed, Mar 6, 2013 at 12:49 PM, Dherani, Mukesh
> <M.K.Dherani@liverpool.ac.uk> wrote:
>
>> I am new to macro.  I am trying to carryout logistic regression with a
>> number of options using if option, however, I am not getting my
>> command being carried out. Below is what I am trying to do
>>
>> If I use
>> local x var1 var2 varn
>> logistic y `x'   // when both of the rows are selected and run
>> simultaneously in do file then command proceeds,
>>
>> otherwise it returns without any results as below:
>>
>> local x var1 var2 varn  // first ran this command
>>
>> logistic y `x'   // then this. Result is blank..
>>
>> I am using stata 10.
>> what is my mistake? I tried looking at FAQ but cannot simplify my query
>> and=  got a number of answers not related to my issue.  thank you in
>> advance.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index