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


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

st: Problem putting enclosed brackets.


From   Amadou DIALLO <stata.diallo@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Problem putting enclosed brackets.
Date   Thu, 1 Apr 2010 10:18:02 +0100

Dear all,
I've been struggling for days with the following problem.
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'"'

Thx.

-- 

Amadou B. DIALLO, PhD.

Economist (Anti-Poverty Programs - DR Congo), AFTP3, The World Bank,
Washington DC.

Director, Center for Research and Training on Adult Health and Education.
Mayotte (FRANCE). www.aprosasoma.org

*
*   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/


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