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

st: RE: Re: Extended missing values from -destring-

From   "Nick Cox" <>
To   <>
Subject   st: RE: Re: Extended missing values from -destring-
Date   Mon, 22 Jun 2009 17:17:04 +0100

In addition to Joseph's positive suggestion, note that the help for
-destring- is quite explicit: 

"destring treats both empty strings "" and "." as indicating sysmiss (.)
and interprets the strings ".a", ".b", ..., ".z" as the extended missing
values .a, .b, ..., .z" 


1. Using -destring- is quite consistent with a user's desire to have
extended missing values. 

2. But as Joseph exemplifies you need to arrange any conversions outside
of -destring-. Any alternative accommodation of extended missing values
within -destring- would just complicate the syntax of -destring- to no
obvious net gain. 


Joseph Coveney

I'm not sure about a single line of code (unless someone has already
written a
convenience module to do it), but you could do something like

replace var = "." + lower(substr(var, 1, 1)) ///
    if inrange(lower(substr(var, 1, 1,)), "a", "z")

and then -destring- the result.

Bert Jung wrote:

I have a string variable that contains mostly numbers but also
informative missing values like "dk" and "na".  I would like to
-destring- but retain the
cause for the missing values, i.e. produce extended missing values
such as .d and .n where appropriate.  -destring- apparently only
accommodates the system missing value ".".

I could write a few lines (e.g. copy into a second variable and then
replace) but wondered if there is a one-line way to coax -destring-
into producing these extended missing values?

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index