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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: using macros in label define |

Date |
Wed, 25 Apr 2012 18:39:37 +0100 |

Jonathan's advice is incorrect. I think he is confusing variable label and value label definition. There is no "issue" here. My guess is that you are feeding an unacceptable definition to -label define- because the " " etc. get transferred. Try loc def `def' `z' "`x'" Nick n.j.cox@durham.ac.uk Jonathan Cantor Put the define object in quotes la def type "`def'" On Wed, Apr 25, 2012 at 1:25 PM, Barry Quinn <b.quinn@qub.ac.uk> wrote: > I am getting an invalid syntax message when using a local in -label define-. > Here is my code: > > *DEFINE GROUP VARIABLES > *TYPE > sort B_Type > gen type=lower(trim(subinstr(B_Type," ","",.))) > egen typ=group(type) > la var typ "Type of Institutions" > save tmp1, replace > keep if type!=type[_n+1] > levelsof type, loc(type) clean > loc z=0 > loc def "" > foreach x of loc type{ > loc ++z > loc def `def' `z' " " `""`x'""' " " > } > use tmp1, clear > la def type `def' > la li type > la val typ type > > I may be missing something obvious but i was wondering is there an issue with use macros in label define ? * * 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/

**Follow-Ups**:**RE: st: using macros in label define***From:*Barry Quinn <b.quinn@qub.ac.uk>

**References**:**st: using macros in label define***From:*Barry Quinn <b.quinn@qub.ac.uk>

**Re: st: using macros in label define***From:*Jonathan Cantor <jonathan.h.cantor@gmail.com>

- Prev by Date:
**Re: st: using macros in label define** - Next by Date:
**st: RE: Spooky: Different Results with Repeated FE Estimation** - Previous by thread:
**Re: st: using macros in label define** - Next by thread:
**RE: st: using macros in label define** - Index(es):