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, is already up and running.

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

st: using macros in label define

From   Barry Quinn <>
To   "" <>
Subject   st: using macros in label define
Date   Wed, 25 Apr 2012 18:25:12 +0100


I am getting an invalid syntax message when using a local in -label define-. 
Here is my code:

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 ?


Barry Quinn
*   For searches and help try:

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