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

st: Trouble with quotes in defining macro

From   Miranda Kim <>
Subject   st: Trouble with quotes in defining macro
Date   Wed, 11 Nov 2009 16:37:29 +0000

I have the following problem:

Within a loop I want to define a macro as follows:

Foreach var of varlist var1 var2 var3 {
local varlabs `varlabs' "`:var l `var''"

I want the macro varlabs to contain the following string ““lab1” “lab2” “lab3””, where lab1 is the label for var1 etc.
But I’m having problems with the quotes.
I then want to use this local as an argument in another command and that is why I wish it in this format with quotes around each label.
I am using stata 10.
Many thanks for your help.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index