<>
Re strings, you may also like NJC`s
http://www.stata-journal.com/sjpdf.html?articlenum=pr0006
In the -macro- world, you may want to look at -tokenize- for splitting
strings:
***
ma drop _all
local mymacro "rs1805005_chr16_88513145-88513"
tokenize `mymacro', parse(_-)
ma di
***
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Keith Dear
(home)
Gesendet: Dienstag, 17. November 2009 22:10
An: [email protected]
Betreff: Re: st: RE: text to columns
Thanks Martin and Nick, -split- rocks. And yes I did enjoy passing it on.
Keith
Nick Cox wrote:
> Use -split- with punctuation _ and -.
>
> -split- was added in Stata 8.
>
> I am sure that you will enjoy telling your colleague.
>
> Nick
> [email protected]
>
> Keith Dear
>
> Is there a utility to turn a string variable with values like
> "rs1805005_chr16_88513145-88513"
> into four variables (or whatever it takes) rs1805005, chr16, 88513145,
> 88513 ?
> A colleague tells me "Excel is easy using Text to columns and following
> the prompts, but it irritates me not to be able to do it in Stata!"
> (btw I consider it a minor personal victory that the people I work with,
>
> some of them, sometimes, no longer write STATA.)
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
>
--
Dr Keith Dear
Senior Fellow
National Centre for Epidemiology and Population Health
ANU College of Medicine, Biology and Environment
Building 62, cnr Mills and Eggleston Roads
Australian National University
Canberra ACT 0200 Australia
T: 02 6125 4865
F: 02 6125 0740
M: 0424 450 396
W: nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C
http://canberragliding.org/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/