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: replacing zero length strings with missing values


From   [email protected]
To   [email protected]
Subject   st: replacing zero length strings with missing values
Date   Tue, 4 Sep 2012 12:54:19 +0100

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.



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