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]

Re: st: Compound double quote


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Compound double quote
Date   Mon, 20 Aug 2012 17:12:25 +0100

I should add to that.

A major point here is that what -display- shows is always stripped of
quotation marks when those marks are used as delimiters, or more
precisely when it looks to Stata as if they are.

Forgetting about local macros, consider

. di "frog"
frog

. di `"toad"'
toad

The delimiters aren't shown. Their job was to be delimiters: to show
where literal strings begin and end, and their fate is to be ignored
on display (more precisely -display-).

As a related example, consider

. local 1 `""frog""'

. di `"`1'"'
"frog"

. di `1'
frog

Here the c.d.q. were used to insist that the " " were part of the
macro. You still have to be extra-careful to get them displayed.

Nick

On Mon, Aug 20, 2012 at 4:56 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> The first token of
>
> "AMC Concord", 2, 4
>
> even when parsing on commas is reported as
>
> AMC Concord
>
> as Stata's tendency is to strip " " as delimiters at each level of
> parsing. To insist that " " are included as part of the token, I think
> you need to start with
>
> local line `" `""AMC Concord""', 2, 4 "'
> tokenize `"`line'"', parse(",")
> di `"`1'"'
>
> Appropriate thanks would to be stop misspelling "Thanks" !
>
> Nick
>
> On Mon, Aug 20, 2012 at 4:34 PM, tashi lama <ltashi32@hotmail.com> wrote:
>>
>>    Could someone help me with the following
>>
>> local line "AMC Concord", 2, 4
>> tokenize `"`line'"', parse(",")
>> di `"`1'"'
>> AMC Concord  (I was hoping to get "AMC Concord" with double quotation). Any idea?
*
*   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