Statalist


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

Re: st: need help destringing a variable


From   "scott hankins" <[email protected]>
To   [email protected]
Subject   Re: st: need help destringing a variable
Date   Fri, 14 Sep 2007 14:11:23 -0400

I don't know about doing this in one command but, this will give you
the first character of your string variable

grade_number=substr(grade_school,1,1)

Then you can destring to have a numeric variable.

see http://www.stata.com/help.cgi?substr()

hope that helps

scott

On 9/14/07, Daniel Macneil <[email protected]> wrote:
> hi,
>
> this should be easy. I just want to convert all the strings in one variable into integers.
>
> e.g., the variable is grade_school (current grade in school)and the variable column has "2nd"
> "5th" etc., and I want to make it "2", "5" by issuing just one command.
>
> thanks
> James
>
>
>
>
>
>
> D. James MacNeil
> Doctoral Candidate
> Harvard Graduate School of Education
> [email protected]
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index