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]
Re: st: -destring- and missing values
From
Laura Gibbons <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: -destring- and missing values
Date
Wed, 2 Oct 2013 09:56:26 -0700 (PDT)
Definitely. In my emailer, the values 1 and 2 have an A circumflex after them.
On Wed, 2 Oct 2013, Nick Cox wrote:
I'd check for non-standard characters that can't be printed, e.g.
using -charlist- (SSC).
I agree with the principle that -destring- should ignore spaces.
Nick
[email protected]
On 2 October 2013 17:07, Jeph Herrin <[email protected]> wrote:
All,
I have hundreds of variables that look like this:
. d q1
storage display value
variable name type format label variable label
-------------------------------------------------------------
q1 str2 %2s
. tab q1, m
q1 | Freq. Percent Cum.
------------+-----------------------------------
| 2 0.89 0.89
1 | 216 96.00 96.89
2 | 7 3.11 100.00
------------+-----------------------------------
Total | 225 100.00
but when I try to use -destring-
. destring q1, replace
q1 contains nonnumeric characters; no replace
According to the documentation,
destring treats both empty strings "" and "." as indicating sysmiss
(.)...
destring also ignores any leading or trailing spaces so that, for
example,
" " is equivalent to "" and " . " is equivalent to ".".
Why is -destring- not converting my variables to numeric? I think I must be
missing something very obvious.
I can get around this by
replace q1 = "." if mi(q1)
but I don't think I should have to.
J
*
* 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/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
phone: 206-744-1842, fax: 206-744-9917,
Office address: 401 Broadway, Suite 5122.6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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/