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

st: RE: text to columns

From   "Levy, Douglas E., Ph.D." <DLEVY3@PARTNERS.ORG>
To   <>
Subject   st: RE: text to columns
Date   Tue, 17 Nov 2009 15:34:49 -0500

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 e-mail
contains patient information, please contact the Partners Compliance HelpLine at . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

*   For searches and help try:

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