[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: how to destring variables containing char " ' "
At 12:49 14/04/04 -0400, Shourun Guo wrote:
I have a hard time to destring some variables with both characters and
numbers. The numbers are what I want. The characters may contain " ' ". If
I include this character in the option of ignore, I will get error message
of mismatch type. If I don't, I will be reminded that the conversion
won't be done because some non-numeric character (I am sure it is the " '
")exists. It seems that the STATA confuses the double quotation and the
single quotation. Any suggestions.
Yes. If your string variable is called -netty-, and you want your numeric
variable to be called -nutty-, then you can convert in 2 stages by
substituting another character for the "'" in -netty-. For instance, if
destring natty, ignore("@") gene(nutty)
then -natty- will be like -netty-, except that all the "'" characters will
be replaced by "@" characters, and -nutty- will be the numeric variable
that you wanted to create.
I hope this helps.
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Opinions expressed are those of the author, not the institution.
* For searches and help try: