Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Splitting long string variable


From   Max Bulsara <[email protected]>
To   [email protected]
Subject   st: Splitting long string variable
Date   Tue, 07 Jun 2005 15:59:01 +0800

Dear All
I have a long string variable that contains a two digit code. I need to split it into separate variables. I don't have a separator so cannot use 'split'. I could use a substr command but the length of the string can be 50 characters long and hence requires 25 substr commands. Is there another way of splitting this variable? I am using stata v9. Would appreciate any comments.

eg:
Var1 Var11 Var12 Var13 Var14 Var15......
==========================================
aabbccddeeffgg aa bb cc dd ee
aa bbccgg wwzz rr aa bb cc gg
bbddyy bb dd yy


Regards
Max


<<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>>
Max Bulsara
University of WA, School of Population Health,
Faculty of Medicine and Dentistry, M435
35 Stirling Highway, CRAWLEY
Western Australia, WA 6009
phone: (+61 8) 6488-1267 fax: (+61 8) 6488-8145

Visit our Web Site: http://www.populationhealth.uwa.edu.au/welcome/consulting/bcs
Summer School information 2004: http://summerschool.sph.uwa.edu.au/

<<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>><<*>>


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