[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: RE: text to columns

From   "Martin Weiss" <>
To   <>
Subject   st: AW: RE: text to columns
Date   Tue, 17 Nov 2009 21:47:30 +0100


-subinstr- does need a fourth argument, though. It could be a missing ".",
but without it, the code won`t work...


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Levy, Douglas
E., Ph.D.
Gesendet: Dienstag, 17. November 2009 21:35
Betreff: st: RE: text to columns

Here is one idea:

gen newvar=subinstr(varold,"_"," ")
replace newvar=subinstr(newvar,"-"," ")
foreach i of numlist 1/4 {
	gen var`i'=word(newvar,`i')

-----Original Message-----
[] On Behalf Of Keith Dear (home)
Sent: Tuesday, November 17, 2009 3:27 PM
Subject: st: text to columns

Is there a utility to turn a string variable with values like 
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.)

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

CRICOS provider #00120C

*   For searches and help try:

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the
contains patient information, please contact the Partners Compliance
HelpLine at . If the e-mail was sent to you in
but does not contain patient information, please contact the sender and
dispose of the e-mail.

*   For searches and help try:

*   For searches and help try:

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