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: Re: Use of subinword in Stata 13 vs. Stata 12


From   Dirk Enzmann <[email protected]>
To   [email protected]
Subject   st: Re: Use of subinword in Stata 13 vs. Stata 12
Date   Fri, 19 Jul 2013 18:13:23 +0200

Thanks Chamara,

the issue of using = is a good observation. However, not to use it is not really an option because the local macros are created by -syntax- (I came across this problem because -subinword()- did not work as expected when using local macros created by the -syntax- command).

Dirk

Fri, 19 Jul 2013 21:05:44 +0530, Chamara Anuranga <[email protected]> wrote:
> Hi,
>
> I don't know what happen with Stata 13 as still I don't have the
> version. I also notice the problem and tried to figure it out.
> I think for the second local generate, you should not use = sign.
> Even you don't need to use it for the first local also as these are
> string. I think when you mention the = that local tried to evaluate
> and replace missing instead of space.
> following command worked for me
>
> local vlist="trunk"
> local generate " "
> dis subinstr("`vlist'","`generate'"," ",.)
>
> Thanks,
> Chamara
>
> Am 19.07.2013 17:20, schrieb Dirk Enzmann:
Most likely I am suffering from temporary blindness, but I can't see my
mistake:

When trying to use -subinword()-, I get different results in Stata 13 as
compared to Stata 12 (or 11, or 10). Example:

* --- Start Stata commands: ---------------

local vlist = "trunk"
local generate = ""
di subinword("`vlist'","`generate'"," ",.)

* --- End Stata commands. -----------------

Using version 13 the -display- command in the third line shows

trunk

(which I expect), whereas version 12 (or 11 or 10) shows



nothing. Why does the replacement of the occurance of "" in "trunk"
yields ""? And why does version 13 yield "trunk"?

Dirk

========================================
Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg
Germany

phone: +49-(0)40-42838.7498 (office)
       +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
email: [email protected]
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
========================================
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index