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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: problem converting a string variable to a numeric variable


From   Gwinyai Masukume <parturitions@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: problem converting a string variable to a numeric variable
Date   Thu, 25 Apr 2013 19:17:46 +0200

Dear Stata listers,

I have a variable weight. The original dataset has weight as a string
variable. Type - str13
Format - %13s.

encode weight, generate(weightgrams)

The above code apparently creates a numeric variable weightgrams.
Type - long
Format - %13.0g

However when dealing with this new variable e.g summ weightgrams, I get
completely abnormal results which bear no resemblance to the expected
results for the variable weight.

I suspect there is some kind of error in conversion from a string to
numeric variable.

I am using version 12.1

Kind regards,
Gwinyai
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index