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: Working with complex strings

From   "Dudekula, Anwar" <>
To   "''" <>
Subject   st: Working with complex strings
Date   Wed, 30 Nov 2011 05:35:43 +0000

Dear Stata List Reader, 

I am reposting the message as my previous one got listed somehow under a different thread instead of being a new question.I apologise for the inconvenience

I am working with deidentified hospitaldatabase with patient names(as string variable) and medications (as string variable)as follows 

Patients_name           medication
Patient-1               metoprolol 100 mg qday
Patient-1               metoprolol tatrate 150mg bid
Patient-1               atenelol 150 mg qday 
Patient-2               hctz 25 mg qday 
Patient-2               PEG interferon 
Patient-3               cimzia 50 mg qday 

Question: I am interested in name of medication only , not their dosages.Is it possible to split  the medication string  after the name  i.e., 

1) split  metoprolol tatrate 150mg bid into  metoprolol tatrate  &  150mg bid
2) split  metoprolol 100 mg qday into   metoprolol   &   100 mg qday

Thank you, 
Yours Sincerely,

*   For searches and help try:

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