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]

Re: st: Data conversion


From   Chelsea Garneau <[email protected]>
To   [email protected]
Subject   Re: st: Data conversion
Date   Wed, 23 May 2012 10:23:40 -0400

Hi Hugo,

How did you convert strings to dates?  Were you using the destring
command? This command should work for any string variable.  It will
create it's own coding system, I believe alphabetically, but you can
recode once it's in numerical format.

Best,
Chelsea



On Wed, May 23, 2012 at 9:49 AM, Hugo Fontan Köhler <[email protected]> wrote:
> Dear Statalisters,
>
> I have a database with (originally in bDase format, convertd to xls in
> Excel and imported in Stata) with a string variable in the format Ia,
> Ib, and so on. I want to convert this variable in a numeric one. I
> tried to generate a new variable with missing values (generate pZ=.)
> and use replace (replace pZ = 1 if Z="1"), but I always get a type
> mismatch error (r109). I managed to convert strings to dates but I
> can't convert to numbers.
> I would appreciate any suggestions.
>
> Thanks,
>
> Hugo
> [email protected]
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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