Statalist The Stata Listserver


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

Re: st: Data management: code to be able to..


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: Data management: code to be able to..
Date   Mon, 4 Jun 2007 09:51:22 -0500

On Jun 4, 2007, at 3:31 AM, Nick Cox wrote:
My solution is

gen numid = word(id, -1)

This is equivalent to Phil's

... = substr(trim(id),-strpos(reverse(trim(id))," ")+1,.)

Very nice -- thanks. I use the extended macro function -word # of- all the time but was completely unaware of -word()-. Reminds me that I should really reread -help functions- from time to time to make sure I'm not reinventing things.


-- Phil

*
* 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