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]

Re: st: Use of subinword in Stata 13 vs. Stata 12


From   Robert Picard <picard@netbox.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Use of subinword in Stata 13 vs. Stata 12
Date   Fri, 19 Jul 2013 12:05:08 -0400

Looks like the behavior of subinword() has indeed changed in version
13. Since the local macro generate is an empty string, you are asking
to look for a non-existent token and replace it with a space. In other
words:

local vlist = "var1 var2 var3"
di subinword("`vlist'",""," ",.)

In version 12 and before, Stata displays an empty string. In version
13, Stata displays "var1 var2 var3". It does not make sense that a
missing token matches every word in vlist so I think that the new
behavior in version 13 makes more sense.

Robert


On Fri, Jul 19, 2013 at 11:20 AM, Dirk Enzmann
<dirk.enzmann@uni-hamburg.de> wrote:
> 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: dirk.enzmann@uni-hamburg.de
> 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/
*
*   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