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

st: string function

From   "Rio, Martin" <[email protected]>
To   [email protected]
Subject   st: string function
Date   Mon, 13 Oct 2003 12:41:17 -0400


I would like to specify a command to tell me the position in a string of the
first character that is not a space. Example:

" one" would yield 1
"  two" would yield 2
"   three" would yield 3
and so on...

Just so you know why in the world I'd want to do this, the number of spaces
determines hierarchy in my dataset. I was thinking of using the index
function, but I'm not sure how to specify 'not a space' for the second

thanks in advance.

Mart´┐Żn Rio
Charles River Associates
Washington, DC 
phone:	(202) 662-3957
fax:	(202) 662-3910

> ************************************************************************
> This electronic message contains information from the consulting firm of
> Charles River Associates Inc., which may be confidential or privileged.
> The
> information is intended for the use of the individual or entity named
> above.
> If you are not the intended recipient, be aware that any disclosure,
> copying,
> distribution or use of the contents of this information is prohibited.  If
> you
> have received this electronic transmission in error, please notify us  by
> telephone (617 425-3582) or by e-mail ([email protected]) immediately.
> ************************************************************************

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index