Statalist The Stata Listserver

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

st: string manipulation

From   "Rajesh Tharyan" <>
To   <>
Subject   st: string manipulation
Date   Mon, 15 May 2006 17:01:22 +0100

Hi all,

I have a list of names in the following format

A K Nath
B G G goldfinger
G gomes
R raja micheal

I need to get them in the following format

Nath A K
Goldfinger B G G 
Gomes G
Micheal R raja

if they were all of the same length I could use the substr function to do
this without any problem. With different lengths and different number of
forenames I am not sure 

But, This is what I have been thinking

1. If there is way to find out the position of the last space then I could
use that info to split the names into forenames and surname
2. then concat them in the way I require
3. Since the number of forenames

Am I right? How do I get the position of the last space. I know Index will
give me the location of the first instance of a character is there something
similar location of the last instance? Or to start looking from the back?

I am using Stata  8.2 


*   For searches and help try:

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