Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: Re: destringing


From   Nick Cox <njc@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: Re: destringing
Date   Mon, 30 Aug 2004 08:21:35 -0500

Suzy <scott_788@wowway.com> started a thread on string and numeric
variables and the use of -destring-. In addition to good advice given by
various people, note that there was a broad discussion of this area in

"On numbers and strings" Stata Journal 2(3): 314--329 (2002)

This article gives an overview of numeric and string data types in Stata
and how to convert from one kind to another. It is a little out-of-date
insofar as the -tostring- command has subsequently become part
of official Stata.

Christian Holz posted a program to remove everything but digits
0 to 9 from a string variable. Note that among the characters excluded
are "." (and any other character that might represent a decimal point).

An -egen- function -sieve()- in the -egenmore- package from SSC
is rather more general than Christian's program, but generates
new string variables. I've not used it much.

Nick
(visiting StataCorp)
njc@stata.com

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