BookmarkSubscribeRSS Feed
SXING
Calcite | Level 5

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!

4 REPLIES 4
user24feb
Barite | Level 11

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;

Ksharp
Super User

Why it is " prior to INDEXDT. " ? your INDEXDT is before fill_dt1  .

SXING
Calcite | Level 5

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!

Ksharp
Super User

But your original data don't look like these . Post more sample data and the output you need .

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

New Learning Events in April

 

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.

LEARN MORE

Discussion stats
  • 4 replies
  • 2426 views
  • 0 likes
  • 3 in conversation