Bookmark and Share

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: Problem putting enclosed brackets.


From   Amadou DIALLO <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index