Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: extracting portions of a string variable using observations from another variable

From   Daniel Henriksen <[email protected]>
To   [email protected]
Subject   st: extracting portions of a string variable using observations from another variable
Date   Mon, 24 Jan 2011 22:21:13 +0100

Hello statalist

Hope you can help me. Is it possible for stata to extract specific
words within a string using observations from another variable?
I have a dataset with a list different ways of dispensing the drug
(which form it is). here's an example:

filmovertrukne tabl.
oral opløsning
inf.væske, opløsning
(I have 270 rows of these (different forms and different ways of spelling it))

the I have another dataset (only one variable but many observations)
containing information on what drug, way of dispensing, dose and time
the drug is to be administered to the patient:

Cefuroxim Stragen pulv.t.inj.væske,opl 7,5 mg/ml intravenøst 100 ml kl
00:00 +  100 ml kl 08:00 +  100 ml kl 16:00 ;(xxx yyy (Overl‘ge) aaa12
09-09-2010 00:35)
Metronidazol Actavis filmovertrukne tabl. 500  mg peroralt 1 tablet 3
gang(e) Daglig ;(xxx yyy-zzz (Stud. med.) aaa1bb 19-08-2010 01:20)
Metronidazol B. Braun inf.væske, opløsning 5  mg/ml intraveøst 100 ml
3 gang(e) Daglig ;(xxx yyy (Reservel‘ge) aaa2bb 29-09-2010 01:21)
Nexium pul.t.inj.+inf.,opl. 0,4 mg/ml intravenøst 100 ml 1 gang(e)
Daglig ;(xxx yyy (Overl‘ge) aaa12 27-10-2010 01:37)

So I would like to extract  pulv.t.inj.væske,opl,  filmovertrukne
tabl.  inf.væske, opløsning and  pul.t.inj.+inf.,opl. from these four
observations and place them in a new variable without having to go
through all of the information manually.
I hope my question is clear.

Thank you for your time

Daniel Henriksen
Ph.d. studerende, læge
Infektionsmedicinsk afd Q / Akut Modtage Afdelingen
Odense Universitetshospital

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index