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

st: Extracting data from mixed string


From   "Paul O'Brien" <[email protected]>
To   [email protected]
Subject   st: Extracting data from mixed string
Date   Sat, 7 Feb 2004 14:40:28 +0000

Database of 41,000 clinic visits with 26 variables for each visit. One variable is a string (stk) of contraceptives prescribed, containing 1 to 4 types, separated by commas.

stk
NONE,OVYS
NONE,NONE,NONE,MATES6,NATURAL
NONE,MICROG
NONE,NONE
NONE,FEMODE,NATURAL
NONE,NONE
LOGED
NONE,NONE,MICROG,MATES6,NATURAL
NONE
NONE,LEVONEL,MICROG
MICROG
NONE,NONE,LOG
NONE,NONE,NONE
NONE,MATES6,NATURAL
NONE,NONE
MICROG,ULTRA
NATURAL
NONE,MICROG,NATURAL

Some are oral contraceptives:OVYS MICROG FEMODE, LOGED

The position of the oral contraceptives in the string varies.

I want all the oral contraceptives in one column:

OVYS
blank
MATES6
MICROG
blank
FEMO
blank
LOGED

How?

Help gratefull received.

Paul

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