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


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

st: RE: Re: Problem putting enclosed double quotes (was: Problem putting enclosed brackets).


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: Problem putting enclosed double quotes (was: Problem putting enclosed brackets).
Date   Thu, 1 Apr 2010 12:45:05 +0100

I see. 

-xml_tab- is from SJ and SSC. 

I can't help there, as I've never used the program and it's far too substantial a program to hack at. 

Nick 
n.j.cox@durham.ac.uk 

Amadou DIALLO

Dear Nick,
Thanx for your answer. I have several purposes in doing that. But the
most urgent is that what I am currently doing is to pass a series of
matrices to Zurab's xml_tab (it is the code that suits most my needs
actually) and I want to preserve the labels of the modalities of my
hundreds of variables. For short labels, there is no problem. But for
long, spaced, labels, it's more complicated.

See the example below:

sysuse auto
tab  foreign rep78 , matcell(A)
loc vall : val la for
xml_tab A, rn("`: lab `vall' 0'" "`: lab `vall' 1'") // for my code rn
will be rn(`names')

Thx.

2010/4/1, Nick Cox <n.j.cox@durham.ac.uk>:
> 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
> n.j.cox@durham.ac.uk
>
> 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/
>


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