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 : st: RE : st: RE : st: Do-file no result, command line OK


From   <[email protected]>
To   <[email protected]>
Subject   st: RE : st: RE : st: RE : st: Do-file no result, command line OK
Date   Tue, 29 Mar 2011 14:35:52 +0100

I reproduce below two do-files which are similar to mine. The first one works fine, we get rid of the dot. However, the second one, which differs from the 1st one just because a command line has been added, doesn't work any more. This the thing I do not understand.

*** Option 1 
sysuse auto
global variables make			// I have two variables in the original do-file
foreach var in $variables {
gen `var'_2 = subinstr(`var', " ", "", .)
replace `var'_2= subinstr(`var', ".", "", .)
}


**** Option 2
global variables make			// I have two variables in the original do-file
foreach var in $variables {
gen `var'_3 = subinstr(`var', " ", "", .)
replace `var'_3= subinstr(`var', ".", "", .)
replace `var'_3= subinword(`var', "Chev", "", .)
}
browse
************

Best,

Xavier

-------- Message d'origine--------
De: [email protected] de la part de Nick Cox
Date: mar. 29/03/2011 14:20
À: [email protected]
Objet : Re: st: RE : st: RE : st: Do-file no result, command line OK
 
That does not make sense.

... if variable == "."

can't be satisfied by values such as "BP P.L.C." as they are not equal to ".".

Either you mean something else, or your copy of Stata is hopelessly corrupted.

Nick

On Tue, Mar 29, 2011 at 2:11 PM,  <[email protected]> wrote:

> Unfortunately not. - browse if variable=="." - gives observations such as:
> BP P.L.C.
> However, once I copy and past the line in the command line instead of running the dofile, I get:
> BP PLC
*
*   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/


Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer

<<winmail.dat>>



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