Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Problem putting enclosed brackets.
From
"Nick Cox" <[email protected]>
To
<[email protected]>
Subject
st: RE: Problem putting enclosed brackets.
Date
Thu, 1 Apr 2010 11:53:34 +0100
The problem is with double quotation marks "", informally often known as (double) quotes.
(The word brackets even at its most generous doesn't I think extend beyond
round brackets or parentheses ()
[square] brackets []
and curly brackets or braces {}.)
The problem is that Stata uses " " in two ways, as string delimiters and as literal characters. First time round, the " " are being interpreted as delimiters and as such stripped.
Although I tried a few solutions using compound double quotes `" "' I also failed to get precisely what Amadou wants. So, I am tempted to change the question. Why do you want precisely this? I suspect that there are other ways of getting the same ultimate result.
Nick
[email protected]
Amadou B. DIALLO, PhD.
I want to have the following labels of my variables enclosed into
encapsulated brackets but the code fails:
Instead of having the following desired form:
"Augmenté" "Inchangé" "Diminué" "Non concerné"
I have :
Augmenté "Inchangé" "Diminué" "Non concerné"
I.e. stata keeps ignoring the first label value.
My code is as follows:
qui foreach i of local vars {
loc vall : val la `i'
if "`vall'" ~= "" {
levelsof `i', l(l)
foreach k of local l {
loc lab : lab `vall' `k'
loc names `names' "`lab'" // loc names `names' "`: lab `vall' `k''"
}
}
}
di `"`names'"'
*
* 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/