SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to create a drug course using dates.

Reply
Highlighted
Contributor
Posts: 48

How to create a drug course using dates.

[ Edited ]

Hello SAS community,

 

I need your help with the following. Any help is appreciated.

 

Raw data:-

IDStartDateDrug
19-May-12A
110-May-12A
110-May-12B
130-May-12B
131-May-12A
11-Jun-12A
12-Jun-12B
130-Jun-12C
13-Jul-12A
127-Jul-12A
128-Jul-12D
217-May-12A
222-May-12B
225-May-12B
21-Jun-12C
22-Jun-12D
23-Jun-12B
326-Jun-12A
329-Jun-12A
327-Jul-12B
325-Aug-12B
426-Jun-12A
427-Jun-12B
428-Jun-12C
425-Aug-12A
426-Aug-12B
427-Aug-12B

 


I want to get the results based on line of drug therapy.

 

Output should look like
 

ID1st line2nd line3rd line
1A + B A + CA+D
2A+BB+C+D.
3AB .
4A+B+C . .

 

 

1st line:

  • Start date: First drug
  • Course: Any drug in the period start date + 10 days

2nd line:

  • Start date: First drug NOT in 1st line
  • Course: Any drug in the period 3 days prior to start date of First drug NOT in 1st line  to 10 days after start date

3rd line:

  • Start date: First drug NOT in 2nd line
  • Course: Any drug in the period 3 days prior to start date of First drug NOT in 2nd line to 10 days after start date.

In other words,

 

1st line  =  First drug + all drugs given within 10 days of 1st drug start date for ex.  suppose that A+B+C are with in 1st 10 days.

 

2nd line = if person gets any other drugs than the one given in 1st line For ex. C drug is added to drug course then 2nd line is all the drugs given 3 days prior to C drug start date and 10 days after C drug start date.

 

3rd Line = if person gets any other drugs than the one given in 2nd or 1st line For ex. D drug is added to drug course then 3rd line is all the drugs given 3 days prior to C drug start date and 10 days after D drug start date.

 

and so on.

 

I hope I am clear about my question.

 

Please Help.

Super User
Posts: 11,810

Re: How to create a drug course using dates.

You should provide an example of what the outcome would look like for that example data.

 

"Course: Any drug in the period 3 days prior to start date to 10 days after start date" isn't really clearly defined as you have a "start date" on every record.

Contributor
Posts: 48

Re: How to create a drug course using dates.

Thank you for the suggestion .I will edit post with the reply.
Contributor
Posts: 48

Re: How to create a drug course using dates.

I took your suggestions and make necessary changes to the question. i hope this helps.
PROC Star
Posts: 643

Re: How to create a drug course using dates.

@shasank It's an interesting problem, but I find your explanation of the logic little inadequate. Hmm part of the reason is perhaps I am not smart. Either way, Please clarify the following

 

q1. does every obs for each id have a line starting from line1......lineN?

q2. So the number of lines for each id varies? for example, 9 for ID 1 and 4 for ID 3?

q3 So when processing the last few obs(perhaps) for a particular id, the look up can only be prior dates for the reason there won't dates to look ahead

 

 

Contributor
Posts: 48

Re: How to create a drug course using dates.

Posted in reply to novinosrin
Hello @novinosrin,
Thank you for your reply. You sound very smart based on your questions.
1) Yes every, Id will start from line 1 and will proceed to line 2 only if there is a change in the drug given. The change in the drug should trigger use to identify the course and mark it as a 2nd line and same goes for 3rd line
2) Yes, Each ID can have different number of lines.
3) Correct. The only flag we need is a change for the 1st line to flag as 2nd line and a change from 2nd line to flag as 3rd line and so on. Once we know what line it is we should identify what drugs are given during that line period.

1st line are drugs given during 1st drug startdate +10 days is 1st line drug course.
2nd line are the drugs given when we flat a new drugs not in 1st line and all the drugs given 3 days prior to it and 10 days after it is 2nd line course.
3rd line is the same as 2nd line but should be compared to 2nd line course to flag a change.

PROC Star
Posts: 643

Re: How to create a drug course using dates.

Hmm still not clear. Anyway, can you explain the look up for the just the one row

 

ID1st line2nd line3rd line
1A + B A + CA+D

 

 

How you got the above and from where referring to your HAVE dataset?

For ID one there has to be 1st line----9th line?

Contributor
Posts: 48

Re: How to create a drug course using dates.

Posted in reply to novinosrin
Hello @novinosrin,

AS per my logic. When I find a drug that is not in 2nd line therapy I will flag it as 3rd line therapy. So here D is newly added drug to the patient. Now to identify the course of therapy - I have to check 3 days before and 10 days after D was started. Drug D was started on 28th July 2012 and 1 days prior to Drug D the patient received drug A and no drugs after Drug D. Now the 3rd Cycle course is A+D or D+A.
PROC Star
Posts: 643

Re: How to create a drug course using dates.

Hey, I am writing to apologise that I didn't get head start on your req as my brain isn't thinking well. I am off to classes at my college right now. But don;t worry, I will sincerely take a look later. Either way, You can be 100% percent, KSharp @xia keshan will fire your needed answer the moment he sees this thread even if no else responds, He is my role model. I wish I could be like him. So wait for a while!

Contributor
Posts: 48

Re: How to create a drug course using dates.

Posted in reply to novinosrin
I am still searching for a solution to this question. Do you have time to have a peak at this question.
Thank you.
PROC Star
Posts: 643

Re: How to create a drug course using dates.

@shasank I am afraid I haven't got a clear understanding of your requirement at all to even get a head start to let my brain and fingers do the rest. Unfortunately, This is after looking into your description multiple times. Personally, I am disappointed too for not even being able to give a go. Well, this is where communication matters most. One of us isn't making it easy to help each other. So sorry!

Contributor
Posts: 48

Re: How to create a drug course using dates.

Hi @ballardw, did the description help. I hope oyu got a chance to look at them.
Contributor
Posts: 48

Re: How to create a drug course using dates.

Hello Ballardw,
Did you get a chance to look at the question. If possible I would appreciate the help with solving this problem.
Thanks in advance.
Contributor
Posts: 48

Re: How to create a drug course using dates.

@Astounding Can you help me with this one?

Contributor
Posts: 48

Re: How to create a drug course using dates.

Hi @Astounding,
I would appreciate you help in this problem. Could you please let me know if there is a way to solve this.
Thank you.
Ask a Question
Discussion stats
  • 17 replies
  • 363 views
  • 3 likes
  • 4 in conversation