Statalist


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

Re: st: RE: Changing property of a variable into number


From   "Ziad El-Khatib" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Changing property of a variable into number
Date   Thu, 4 Sep 2008 05:36:14 -0700

Dear Nick,
Thank you. I managed to do it by copy/paste from/to excel.
Best regards
ziad


On Thu, Sep 4, 2008 at 5:33 AM, Nick Cox <[email protected]> wrote:
> You really need to do some reading on Stata basics! For example, as a
> person working with medical data working through Svend Juul's book would
> be excellent for you.
>
> The format %9s is a string format. It implies that the variable is a
> string variable. Thus Stata won't let you change the format to a numeric
> format.
>
> Even if Stata let you do that, changing how a variable is displayed does
> not change how a variable is stored.
>
> You need to convert this variable to a numeric variable using
> -destring-.
>
> See for a tutorial on numeric and string
>
> SJ-2-3  pr0006  . . . . . . . . . . . . Speaking Stata: On numbers and
> strings
>        Q3/02   SJ 2(3):314--329                                 (no
> commands)
>        explains the use of numeric and string data types in Stata
>        and how to convert from one kind to another
>
> You can find that on-line as a .pdf regardless of whether you or your
> institution subscribe to the Stata Journal.
>
> Nick
> [email protected]
>
> Ziad El-Khatib
>
> For strange reasons one of the variables (diarr) (coded 1/2) has
> format %9s so I can not use it when putting it in a sum formula in
> STATA.
> I tried to change its format using edit command, I looked at another
> variable format it has property %8.0g so I tried using it for diarr
> variable but it gives window with message "%8.0g is not a valid
> display format".
>
> *
> *   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/
>



-- 
Ziad El-Khatib
AIDS Unit
National Institute for Communicable Diseases (NICD)
1 Modderfontein Road
Private Bag X4, Sandringham, 2131
Johannesburg, South Africa
Mobile: +27 (0) 72-52 39 716
Phone: +27 (0) 11-386 6433
Fax (NICD): +27 (0) 11 386 6453
Fax (connected to my email): +27 (0) 86 18 2871
http://www.nhls.ac.za/div_nicd.html

Division of International Health (IHCAR)
Department of Public Health Sciences
Karolinska Institute
Nobels v�g 9
SE-171 77
Stockholm, Sweden
Landline (connected to Skype):+46 (0) 8-559 21 659
Fax: +46 (0) 8-311590
http://ki.se/ki/jsp/polopoly.jsp?d=18835&l=en

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index