Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Data management for drug study


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Data management for drug study
Date   Mon, 29 Apr 2013 17:54:31 +0100

ICheck out -panelthin- from SSC.

Nick
njcoxstata@gmail.com

On 29 April 2013 17:47, Pooja Desai <desai.pooja87@gmail.com> wrote:

> I have a dataset which is as follows:
> ID      psy_vst rx      drug    days    disp_date
> 123          .          1       12      90      15141
> 123           1          .      12      30      15153
> 123           1          .      12      30      15195
> 123           1          .      12      30      15225
> 123           1          .      3       2       15227
> 123           1          .      12      30      15266
> 123          .          1       1       60      15271
> 123           1          .      7       30      15278
> 123           1          .      7       30      15311
> 123           1          .      7       30      15341
>
> ID is the patient ID number, psy_vst =1 indicates that the event was a
> physician visit, rx=1 indicates that the event was a pharmacy visit, each
> drug is represented by a particular number so the same number under the drug
> column indicates the same drug,, a different number indicates a different
> drug, the days variable indicates the days supply for the particular drug
> and the disp_date indicates the day the drug was given. I want to delete
> (and create a new dataset of these deleted values) when there is a physician
> visit associated with the same drug days supply +30 days after the dispense
> date of the drug from the pharmacy. So in the above example for patient 123,
> rows 2,3,4 should be deleted from this dataset (and put into a new one) and
> rows 1, 5, 6, 7, 8, 9, 10 will remain in the dataset as the visits in rows
> 8, 9, 10 are not for the same drug that was dispensed in the pharmacy on
> date 15271.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index