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: replace part of observations in a string variable


From   Kamarul Imran <kim4597@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: replace part of observations in a string variable
Date   Wed, 17 Oct 2012 12:00:27 +0100

Dear Daniel,

I will take note of your suggestion.

Best wishes

Kamarul



On Wed, Oct 17, 2012 at 11:28 AM, daniel klein
<klein.daniel.81@googlemail.com> wrote:
> I suggest to also take a look into this:
> http://www.stata.com/statalist/archive/2012-10/msg00454.html
> (Nick Cox once again)
>
> The problem might be characters in <new2> that appear to be spaces
> (-char(32)-), but are something else (e.g. -char(160)-).
>
> Also note that you probably do not want to -replace- the strings with
> a space, i.e. " ", but with an empty string, i.e. "" (which is Stata's
> missing value for strings).
>
> Best
> Daniel
>
> --
> Hi all,
>
> I want to replace part of observations in the string variable to
> missing values. For example, I want to replace "Pasir Mas" to either
> "." or " " from a string variable named as "new2"
>
> [...]
>
> Observation "Pasir Mas" was not replaced by " " . What have I done
> wrong? What is the better way of working with string variable?
> Appreciate everyone's' time in responding to this.
>
> Regards
>
> Kamarul
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index