Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65565

Subsetting data

$
0
0
Hello,
I'd appreciate if you could help me with Stata syntax for the following analysis.

I've got the HCV treatment dataset. I need to run analysis on the subset of patients who have received an approval to start treatment. There is a probability that the authorizations were issued more than one time during the time period by the treatment body/committee for the same patient. Thus, there are multiple records for the same patient ID.
For this purpose, a) I need to calculate the number of unique patients who have received at least once an approval to initiate the treatment course.
b) and if an approval was received >1 time, then those records corresponding to the most recent date of approval need to be included in the subset analysis.

NOTE: the database is not time-ordered ( this is a bummer)

Here are the variables:
patient_ID;
Approval_date ( The date when the approval to start treatment was issued);
Approval ( code "0" for YES and code "1" for NO)

For the a) part I'm doing following:
by patient_ID: egen cmt_approved = total(Approval == 0)
replace cmt_approved = 1 if cmt_approved > 0

then to figure out the unique # of patients with at least one approval, I run this commend :
bysort patient_ID Approval : gen ncommittee = _n == 1
tab Approval ncommittee , miss
and I generate the sample where those with " Approval==0 & ncommittee==1 " are included.
But I need to ensure the relevant records with the date of last approval is included in the sample. ( something like if april>march then keep that record within the same ID)
and this is the point where I am bog down

Thank you in advance for you assistance,
Regards,
Lia Gvinjilia


Viewing all articles
Browse latest Browse all 65565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>