Hi,
New to SAS. Any help is greatly appreciated!
I have a list of people on drug X with their first date of fill of drug X (fill_dt1) and 180 days after, where I transposed all their fill dates to see what date they were covered with drug from DAY1 to DAY180. Want to see if they filled drug X for at least two 14 days consecutively within the 60 day prior to INDEXDT. How would I do this?
What I have:
INDEXDT = Index date of person
fill_dt1 = Date of First fill of drug X
DAY1= Day of first fill (if 1= person on drug, if 0 then person not on drug)
ID INDEXDT fill_dt1 DAY1 DAY2 DAY3 DAY4 DAY5 DAY6…..DAY180
1 02/13/2012 01/30/2013 1 1 1 1 1 0
2
3
4
Thanks!
I think the devil is in the detail with your problem, but it should look similar to the example below (for a little data set). Note that a row with no missings at all is not recognized - but could be easily fixed (If Min(of DA{*}) eq 1 Then Counter=2 (if it is supposed to be 2)).
Data A;
Input Day1-Day10;
Datalines;
1 1 1 0 1 1 1 1 0 0
1 0 1 0 1 0 1 0 1 0
1 1 0 0 1 1 1 1 1 1
0 1 1 1 1 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 1 1
;
%Let Space=4;
Data B (Drop=i j Flag:);
Set A;
Array DA {*} Day1-Day10;
Do i=1 To Dim (DA) - &Space. + 1;
Flag=1;
Do j=i To i + &Space. - 1;
Flag=Min(Flag,DA{j});
End;
If Flag2 ne 1 Then Counter=Sum(Flag,Counter);
Flag2=Flag;
End;
Run;
Why it is " prior to INDEXDT. " ? your INDEXDT is before fill_dt1 .
INDEXDT is date that I will start followup.
I'm trying to see if within the 60 days before index date, whether the patient is on drug X for at least 14 days consecutively.
For example:
INDEXDT=7/1/10
I have the first fill date for drug X (before index date) - e.g. 4/1/10
So Day1 represents 4/1/10, Day 2 represents 4/2/10....up to Day180. For every Day I have indicated 1 or 0, where 1 is on drug X, and 0 is off drug X.
So for this person, I'm trying to see if there are at least 14 consecutive days where patient is on Drug X within the 60 days prior.
Thanks - any help is much appreciated!
But your original data don't look like these . Post more sample data and the output you need .
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.