Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Help with destring


From   "Donald Spady" <dspady@ualberta.ca>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Help with destring
Date   Tue, 10 Jul 2007 11:42:09 -0600

My last reply got cut off.

You are right.  I should have known that.  I just haven't used Stata this
much recently and forgot some of the basic commands.

My apologies and thanks

Don Spady

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Donald Spady
Sent: July 10, 2007 11:40 AM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: Help with destring

much recently and forgot all about it.

Many thanks.

Don Spady

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joseph Coveney
Sent: July 10, 2007 11:31 AM
To: Statalist
Subject: Re: st: Help with destring

Donald Spady wrote:

I have data that are string data and want to convert them to numeric.  I
would expect destring to do this but it doesn't.  For example, here is a
table
  tab Worker_Type

worker  Freq. Percent Cum.

Administration 12 9.16 9.16
Allied 44 33.59 42.75
Attending 26 19.85 62.60
Clerk 9 6.87 69.47
Med Student 17 12.98 82.44
Resident/Fellow 23 17.56 100.00

Total 131 100.00

The values are all strings.
When I do
Destring worker, generate(nworker)
I get the message
destring worker, gen(nworker)
worker contains nonnumeric characters; no generate r; t=0.02 10:31:13

It seems to me that if I want to convert a string, that implicitly means
there are nonnumeric characters.  What am I doing wrong?  I am using
Stata10.

----------------------------------------------------------------------------
----

Roughly stated, -destring- converts string numerals into numerical data.
It's not clear what you're expecting the numerical data version of worker to
be, but it seems as if you want something like -encode-.

Joseph Coveney

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index