DATA Step, Macro, Functions and more

treatment lines

Reply
Contributor
Posts: 20

treatment lines

 Hi,

 

I am trying to make treatment lines according to a rule for my dataset.

If a patient is being treated with "a" treatment and that is his first treatment , then the Start Date for that  ("a")treatment is considered as the first episode treatment. Now the second treatment is defined as the treatment occurring 6 months after the StartDate of the first treatment. if the second treatment starts in the middle of the 6 moth duration then its StartDate is considered as StartDate of the first treatment +180 (i,e 6 months after the start of the first treatment). We need to find the episode start dates for 10 different kinds of treatments.

  

Any kind of help will be appreciated.

 

How do write this ?

 

I think we might have to use retain function for this. 

Super User
Posts: 9,560

Re: treatment lines

Please post example data (in a data step, see my footnotes) and the expected result.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 20

Re: treatment lines

Posted in reply to KurtBremser

Obs Pat_id              Diag_date    LineName                                                StartDate EndDate  episode datebirrth year episode year age

1 FDD586EC54DFF 05/05/2016 Gemcitabine,Paclitaxel Protein-Bound 05/16/2016 05/26/2016 05/16/2016 1956 2016 60
2 FCF06DFFE96D3 06/09/2016 Gemcitabine,Paclitaxel Protein-Bound 07/22/2016 08/22/2016 07/22/2016 1942 2016 74
3 F468936773849 10/15/2015 FOLFIRI 01/13/2017 06/05/2017 10/19/2015 1955 2015 60
4 F468936773849 10/15/2015 Gemcitabine,Paclitaxel Protein-Bound 10/19/2015 01/12/2017 10/19/2015 1955 2015 60
5 F91E7F27902F2 07/23/2015 FOLFOX 04/11/2017 07/22/2017 08/17/2015 1958 2015 57
6 F91E7F27902F2 07/23/2015 Fluorouracil,Irinotecan Liposomal,Leucovorin 09/27/2016 04/10/2017 08/17/2015 1958 2015 57
7 F91E7F27902F2 07/23/2015 Gemcitabine,Paclitaxel Protein-Bound 08/17/2015 09/26/2016 08/17/2015 1958 2015 57
8 FC72D24D879B2 09/09/2016 FOLFOX 01/11/2017 05/30/2017 09/27/2016 1933 2016 83
9 FC72D24D879B2 09/09/2016 Fluorouracil,Irinotecan Liposomal,Leucovorin 05/31/2017 01/02/2018 09/27/2016 1933 2016 83
10 FC72D24D879B2 09/09/2016 Gemcitabine,Paclitaxel Protein-Bound 09/27/2016 01/10/2017 09/27/2016 1933 2016 83
11 FA6DB21197963 01/04/2016 FOLFIRINOX 01/29/2016 03/24/2018 01/29/2016 1951 2016 65
12 F985921E439A3 05/08/2014 FOLFOX 05/28/2014 08/31/2014 05/28/2014 1935 2014 79
13 FC2B6C5BFDA37 08/06/2015 FOLFIRINOX 09/10/2015 02/02/2016 09/10/2015 1943 2015 72
14 FAE07E0051C78 11/17/2015 FOLFIRINOX 12/08/2015 04/20/2017 12/08/2015 1945 2015 70

 

This is what my resullt looks like but i want to see that for id F468936773849  the start date for FOLFIRI is 01/13/2017 and for Gemcitabine,Paclitaxel Protein-Bound it is 10/19/2015.

 it shouold be differnt for differnet treatments and also follow the episode rule of 6 months, so for example for id:- F91E7F27902F2 the patinet is undergoing 3  differnet treatments , I want to see theStartdate for each treatment it, for FOLFOX the epideosde start date should be  04/11/2017 adn not  08/17/2015. SAS is taking the earliest startdate for the patient accoridng to his first treatment.

 

Ask a Question
Discussion stats
  • 2 replies
  • 92 views
  • 0 likes
  • 2 in conversation