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 at the end of May, and its replacement, is already up and running.

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

Re: st: Why won't my -local- work?

From   Brandon Olszewski <>
Subject   Re: st: Why won't my -local- work?
Date   Fri, 22 Feb 2013 15:43:53 -0800

Thanks for the idea, David. But it returned the same result. With quotes, and
>disp "`mymacro'"
I still return nothing but a blank line. I am mystified why Stata
isn't storing my varlist, which I don't think should require (double)
quotes as a string would.
Do I have to, for instance, "turn macro on" the way I can "set more off"?

On Fri, Feb 22, 2013 at 3:37 PM, <> wrote:
> Put quotes around the macro value.
> local mymacro "var1 var2 var3"
> Also check the value by...
> disp "`mymacro'"
> hth
> david
> Sent with Verizon Mobile Email
> ---Original Message---
> From:
> Sent: 2/22/2013 6:31 pm
> To:
> Subject: st: Why won't my -local- work?
> I want to make some tables using -contract- and -collapse- for about
> thirty variables. I figured a local macro to identify that varlist
> would be the best way to do it. I followed examples I've seen
> elsewhere - such as
> - and on Statalist but keep failing. Here is an example of my syntax:
>>local mymacro var1 var2 var3
> When I try and do anything with mymacro, I get no results returned.
> For instance,
>>sum `mymacro'
> gives me sum output of all vars.
>>keep `mymacro'
> gives me the error "varlist or in range required". When I try
>>reg outcome `mymacro'
> all I get is a constant value in my reg output. I want to replace
> contents of that varlist with dummies, such that
>>foreach var of local mymacro {
>>     replace `var'=1 if `var'!=0
>>     }
> But obviously, that doesn't work either, because for some reason,
> nothing seems to be stored in my macro.
> I am running Stata 12. Thanks for any help.
> Brandon Olszewski
> *
> *   For searches and help t!
>  ry:
> *
> *
> *
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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