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 on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: replacing zero length strings with missing values


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: replacing zero length strings with missing values
Date   Tue, 4 Sep 2012 17:17:22 -0400

Please send only plain text messages to Statalist (FAQ 0.3)

Steve

On Sep 4, 2012, at 7:54 AM, Robert.Shaw@dh.gsi.gov.uk wrote:

Hi

I have a large dataset in stata and one of the variables has a lot a observations that should be missing values but are instead zero length strings (ie. =="")

I've tried 

foreach x of varlist myvariable {
replace `x' = . if(`x' =="")
}

but this gives a type mismatch.

Can anyone help please?

Thanks
Rob Shaw
The original of this email was scanned for viruses by the Government Secure Intranet virus scanning service supplied by Cable&Wireless Worldwide in partnership with MessageLabs. (CCTM Certificate Number 2009/09/0052.) On leaving the GSi this email was certified virus free.
Communications via the GSi may be automatically logged, monitored and/or recorded for legal purposes.


*
*   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