Bookmark and Share

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


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

st: Data management for drug study


From   "Pooja Desai" <[email protected]>
To   <[email protected]>
Subject   st: Data management for drug study
Date   Mon, 29 Apr 2013 11:47:36 -0500

Hello All,
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.

Please could somebody help me write such a code?
Thanks a lot!
Pooja Desai


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index