hi i have this dataset
Obs PTID DRUG_DT DRUG1234567891011121314151617181920
PT078375333 | 31DEC2014 | ETOPOSIDE |
PT078375333 | 01JAN2015 | CISPLATIN |
PT078375333 | 01JAN2015 | ETOPOSIDE |
PT078375333 | 02JAN2015 | ETOPOSIDE |
PT078375333 | 21JAN2015 | CISPLATIN |
PT078375333 | 21JAN2015 | ETOPOSIDE |
PT078375333 | 22JAN2015 | ETOPOSIDE |
PT078375333 | 23JAN2015 | ETOPOSIDE |
PT078375333 | 11FEB2015 | CISPLATIN |
PT078375333 | 11FEB2015 | ETOPOSIDE |
PT078375333 | 12FEB2015 | ETOPOSIDE |
PT078375333 | 13FEB2015 | ETOPOSIDE |
PT078375333 | 04MAR2015 | CISPLATIN |
PT078375333 | 05MAR2015 | ETOPOSIDE |
PT078375333 | 06MAR2015 | ETOPOSIDE |
PT078837214 | 13NOV2013 | CARBOPLATIN |
PT078837214 | 13NOV2013 | ETOPOSIDE |
PT078837214 | 11DEC2013 | CARBOPLATIN |
PT078837214 | 11DEC2013 | ETOPOSIDE |
PT078837214 | 12DEC2013 | ETOPOSIDE |
PT078837214 | 11DEC2013 | ETOPOSIDE |
PT078837214 | 12DEC2013 | ETOPOSIDE |
PT082388044 | 18MAR2013 | CARBOPLATIN |
PT082388044 | 18MAR2013 | ETOPOSIDE |
PT082388044 | 19MAR2013 | ETOPOSIDE |
PT082388044 | 20MAR2013 | ETOPOSIDE |
PT082388044 | 08APR2013 | CARBOPLATIN |
PT082388044 | 08APR2013 | ETOPOSIDE |
PT082388044 | 09APR2013 | ETOPOSIDE |
PT082388044 | 10APR2013 | ETOPOSIDE |
PT082388044 | 01MAY2013 | CARBOPLATIN |
PT082388044 | 01MAY2013 | ETOPOSIDE |
PT082388044 | 02MAY2013 | ETOPOSIDE |
PT082388044 | 03MAY2013 | ETOPOSIDE |
PT082388044 | 22MAY2013 | CARBOPLATIN |
PT082388044 | 22MAY2013 | ETOPOSIDE |
PT082388044 | 23MAY2013 | ETOPOSIDE |
PT082388044 | 24MAY2013 | ETOPOSIDE |
PT082388044 | 19JAN2015 | CARBOPLATIN |
PT082388044 | 19JAN2015 | ETOPOSIDE |
PT082388044 | 20JAN2015 | ETOPOSIDE |
PT082388044 | 21JAN2015 | ETOPOSIDE |
PT082388044 | 09FEB2015 | CARBOPLATIN |
PT082388044 | 09FEB2015 | ETOPOSIDE |
PT082388044 | 10FEB2015 | ETOPOSIDE |
PT082388044 | 11FEB2015 | ETOPOSIDE |
PT082388044 | 03MAR2015 | CARBOPLATIN |
PT082388044 | 03MAR2015 | ETOPOSIDE |
PT082388044 | 04MAR2015 | ETOPOSIDE |
PT082388044 | 05MAR2015 | ETOPOSIDE |
PT082388044 | 24MAR2015 | CARBOPLATIN |
PT082388044 | 24MAR2015 | ETOPOSIDE |
PT082388044 | 25MAR2015 | ETOPOSIDE |
PT082388044 | 26MAR2015 | ETOPOSIDE |
PT082388044 | 02FEB2016 | CARBOPLATIN |
PT082388044 | 02FEB2016 | ETOPOSIDE |
PT082388044 | 03FEB2016 | ETOPOSIDE |
PT082388044 | 04FEB2016 | ETOPOSIDE |
PT082388044 | 23FEB2016 | CARBOPLATIN |
PT082388044 | 23FEB2016 | ETOPOSIDE |
PT082388044 | 24FEB2016 | ETOPOSIDE |
PT082388044 | 25FEB2016 | ETOPOSIDE |
PT082388044 | 15MAR2016 | CARBOPLATIN |
PT082388044 | 15MAR2016 | ETOPOSIDE |
PT082388044 | 16MAR2016 | ETOPOSIDE |
PT082388044 | 17MAR2016 | ETOPOSIDE |
PT083585377 | 17APR2012 | CARBOPLATIN |
PT083585377 | 17APR2012 | ETOPOSIDE |
PT083585377 | 18APR2012 | ETOPOSIDE |
PT083585377 | 19APR2012 | ETOPOSIDE |
PT083585377 | 09MAY2012 | CARBOPLATIN |
PT083585377 | 09MAY2012 | ETOPOSIDE |
PT083585377 | 10MAY2012 | ETOPOSIDE |
PT083585377 | 11MAY2012 | ETOPOSIDE |
PT083585377 | 30MAY2012 | CARBOPLATIN |
PT083585377 | 30MAY2012 | ETOPOSIDE |
PT083585377 | 31MAY2012 | ETOPOSIDE |
PT083585377 | 01JUN2012 | ETOPOSIDE |
PT083585377 | 20JUN2012 | CARBOPLATIN |
PT083585377 | 20JUN2012 | ETOPOSIDE |
PT083585377 | 21JUN2012 | ETOPOSIDE |
PT083585377 | 22JUN2012 | ETOPOSIDE |
PT083585377 | 25JUL2012 | CARBOPLATIN |
PT083585377 | 25JUL2012 | ETOPOSIDE |
PT083585377 | 26JUL2012 | ETOPOSIDE |
PT083585377 | 27JUL2012 | ETOPOSIDE |
PT083585377 | 15AUG2012 | CARBOPLATIN |
PT083585377 | 15AUG2012 | ETOPOSIDE |
PT083585377 | 16AUG2012 | ETOPOSIDE |
PT083585377 | 17AUG2012 | ETOPOSIDE |
PT083585377 | 03JAN2013 | CARBOPLATIN |
PT083585377 | 03JAN2013 | ETOPOSIDE |
PT083585377 | 22JAN2013 | CARBOPLATIN |
PT083585377 | 22JAN2013 | IRINOTECAN |
PT083585377 | 18FEB2013 | CARBOPLATIN |
PT083585377 | 18FEB2013 | IRINOTECAN |
PT083585377 | 25FEB2013 | CARBOPLATIN |
PT083585377 | 25FEB2013 | IRINOTECAN |
PT083585377 | 04MAR2013 | CARBOPLATIN |
PT083585377 | 04MAR2013 | IRINOTECAN |
PT083585377 | 16APR2013 | CARBOPLATIN |
PT083585377 | 16APR2013 | IRINOTECAN |
PT083585377 | 23APR2013 | CARBOPLATIN |
PT083585377 | 23APR2013 | IRINOTECAN |
PT083585377 | 30APR2013 | CARBOPLATIN |
PT083585377 | 30APR2013 | IRINOTECAN |
PT083585377 | 31MAY2013 | CARBOPLATIN |
PT083585377 | 31MAY2013 | IRINOTECAN |
PT083585377 | 07JUN2013 | CARBOPLATIN |
PT083585377 | 07JUN2013 | IRINOTECAN |
PT083585377 | 24JUN2013 | TOPOTECAN |
PT083585377 | 25JUN2013 | TOPOTECAN |
PT083585377 | 26JUN2013 | TOPOTECAN |
PT083585377 | 27JUN2013 | TOPOTECAN |
PT083585377 | 28JUN2013 | TOPOTECAN |
PT083585377 | 22JUL2013 | CARBOPLATIN |
PT083585377 | 22JUL2013 | IRINOTECAN |
PT083585377 | 22JUL2013 | TOPOTECAN |
PT083585377 | 29JUL2013 | TOPOTECAN |
PT083585377 | 30JUL2013 | TOPOTECAN |
PT083585377 | 31JUL2013 | TOPOTECAN |
PT083585377 | 01AUG2013 | TOPOTECAN |
PT083585377 | 02AUG2013 | TOPOTECAN |
PT083585377 | 26AUG2013 | TOPOTECAN |
PT083585377 | 27AUG2013 | TOPOTECAN |
PT083585377 | 28AUG2013 | TOPOTECAN |
PT083585377 | 29AUG2013 | TOPOTECAN |
PT083585377 | 16SEP2013 | DOCETAXEL |
PT083585377 | 08OCT2013 | DOCETAXEL |
PT083585377 | 11NOV2013 | GEMCITABINE |
PT083585377 | 18NOV2013 | GEMCITABINE |
PT083585377 | 09DEC2013 | GEMCITABINE |
PT083585377 | 23DEC2013 | GEMCITABINE |
PT083585377 | 30DEC2013 | GEMCITABINE |
PT083585377 | 06JAN2014 | GEMCITABINE |
this is the dataset needed.
Obs PTID DRUG STDT ENDDT12345678910111213141516
PT078375333 | Etoposide | 31DEC2014 | 06MAR2015 |
PT078375333 | Cisplatin | 01JAN2015 | 04MAR2015 |
PT078837214 | Carboplatin | 13NOV2013 | 11DEC2013 |
PT078837214 | Etoposide | 13NOV2013 | 12DEC2013 |
PT082388044 | Carboplatin | 18MAR2013 | 22MAY2013 |
PT082388044 | Etoposide | 18MAR2013 | 24MAY2013 |
PT082388044 | Carboplatin | 19JAN2015 | 24MAR2015 |
PT082388044 | Etoposide | 19JAN2015 | 26MAR2015 |
PT083585377 | Carboplatin | 17APR2012 | 15AUG2012 |
PT083585377 | Etoposide | 17APR2012 | 17AUG2012 |
PT083585377 | Etoposide | 03JAN2013 | 03JAN2013 |
PT083585377 | Carboplatin | 03JAN2013 | 22JUL2013 |
PT083585377 | Irinotecan | 22JAN2013 | 22JUL2013 |
PT083585377 | Topotecan | 24JUN2013 | 29AUG2013 |
PT083585377 | Docetaxel | 16SEP2013 | 08OCT2013 |
PT083585377 | Gemcitabine | 11NOV2013 | 06JAN2014 |
the condition is -
A period of continuous chemo administration starts on the first date of use and ends when there is a gap of greater than 60 days between 2 consecutive chemotherapy (of the same drug) administrations.
Hi @saipriya92
I have modified the code as follows to take into account the condition of 60 days:
proc sort data=have;
by PTID DRUG DRUG_DT;
run;
/* Identify gaps > 60 for unique combination of PTID-DRUG */
data have2;
set have;
by PTID DRUG;
if first.DRUG then gap=0;
format _lag date9.;
_lag = lag(DRUG_DT);
if DRUG_DT - _lag >= 60 and first.CUSTOMER_NR=0 then gap + 1;
run;
/* Report */
proc sql;
select PTID,
min(DRUG_DT) as STDT format=date9.,
max(DRUG_DT) as ENDDT format=date9.,
DRUG
from have2 group by PTID, DRUG, gap;
quit;
Try next code:
proc sort data=have; by ptid drug drug_dt;
data want;
set have;
by ptid drug;
retain stdt;
if first.drug then stdt = drug_dt;
if last.drug then do;
enddt = drug_dt;
output;
end;
keep ptid stdt enddt;
run;
Hi @saipriya92
You can try this:
proc sql;
select PTID,
min(DRUG_DT) as STDT format=date9.,
max(DRUG_DT) as ENDDT format=date9.,
DRUG
from have group by PTID, DRUG;
quit;
Output:
HI this works thanks!
But also there is one more condition and that is-
. A period of continuous chemo administration starts on the first date of use and ends when there is a gap of greater than 60 days between 2 consecutive chemotherapy (of the same drug) administrations.
How do i code for this within the proc sql step ?
Hi @saipriya92,
Please either adjust your initial post if this is what you want or create a new post with this. Your initial post hints at what you want but the table you show as 'want' does not include the gap logic requirement.
This is not to be inflexible, but rather to match a solution to the actual ask. We want to be sure that if someone finds this post in the future, the solution will align with the initial request.
Thanks,
-unison
hi unison
Thanks for the suggestion. Please see the edited post
Thank you,
See my edited post below.
-unison
Hi @saipriya92
I have modified the code as follows to take into account the condition of 60 days:
proc sort data=have;
by PTID DRUG DRUG_DT;
run;
/* Identify gaps > 60 for unique combination of PTID-DRUG */
data have2;
set have;
by PTID DRUG;
if first.DRUG then gap=0;
format _lag date9.;
_lag = lag(DRUG_DT);
if DRUG_DT - _lag >= 60 and first.CUSTOMER_NR=0 then gap + 1;
run;
/* Report */
proc sql;
select PTID,
min(DRUG_DT) as STDT format=date9.,
max(DRUG_DT) as ENDDT format=date9.,
DRUG
from have2 group by PTID, DRUG, gap;
quit;
Also what is the meaning of first.customer_nr? I have no such variable in my dataset and neither did we create any
proc means would be the way to go if you're just interested in min/max dates.
data have;
length ptid $13. drug $11.;
input ptid $ drug_dt :date9. drug $;
format drug_dt date9.;
datalines;
PT078375333 31DEC2014 ETOPOSIDE
PT078375333 01JAN2015 CISPLATIN
PT078375333 01JAN2015 ETOPOSIDE
PT078375333 02JAN2015 ETOPOSIDE
PT078375333 21JAN2015 CISPLATIN
PT078375333 21JAN2015 ETOPOSIDE
PT078375333 22JAN2015 ETOPOSIDE
PT078375333 23JAN2015 ETOPOSIDE
PT078375333 11FEB2015 CISPLATIN
PT078375333 11FEB2015 ETOPOSIDE
PT078375333 12FEB2015 ETOPOSIDE
PT078375333 13FEB2015 ETOPOSIDE
PT078375333 04MAR2015 CISPLATIN
PT078375333 05MAR2015 ETOPOSIDE
PT078375333 06MAR2015 ETOPOSIDE
PT078837214 13NOV2013 CARBOPLATIN
PT078837214 13NOV2013 ETOPOSIDE
PT078837214 11DEC2013 CARBOPLATIN
PT078837214 11DEC2013 ETOPOSIDE
PT078837214 12DEC2013 ETOPOSIDE
PT082388044 18MAR2013 CARBOPLATIN
PT082388044 18MAR2013 ETOPOSIDE
PT082388044 19MAR2013 ETOPOSIDE
PT082388044 20MAR2013 ETOPOSIDE
PT082388044 08APR2013 CARBOPLATIN
PT082388044 08APR2013 ETOPOSIDE
PT082388044 09APR2013 ETOPOSIDE
PT082388044 10APR2013 ETOPOSIDE
PT082388044 01MAY2013 CARBOPLATIN
PT082388044 01MAY2013 ETOPOSIDE
PT082388044 02MAY2013 ETOPOSIDE
PT082388044 03MAY2013 ETOPOSIDE
PT082388044 22MAY2013 CARBOPLATIN
PT082388044 22MAY2013 ETOPOSIDE
PT082388044 23MAY2013 ETOPOSIDE
PT082388044 24MAY2013 ETOPOSIDE
PT082388044 19JAN2015 CARBOPLATIN
PT082388044 19JAN2015 ETOPOSIDE
PT082388044 20JAN2015 ETOPOSIDE
PT082388044 21JAN2015 ETOPOSIDE
PT082388044 09FEB2015 CARBOPLATIN
PT082388044 09FEB2015 ETOPOSIDE
PT082388044 10FEB2015 ETOPOSIDE
PT082388044 11FEB2015 ETOPOSIDE
PT082388044 03MAR2015 CARBOPLATIN
PT082388044 03MAR2015 ETOPOSIDE
PT082388044 04MAR2015 ETOPOSIDE
PT082388044 05MAR2015 ETOPOSIDE
PT082388044 24MAR2015 CARBOPLATIN
PT082388044 24MAR2015 ETOPOSIDE
PT082388044 25MAR2015 ETOPOSIDE
PT082388044 26MAR2015 ETOPOSIDE
PT082388044 02FEB2016 CARBOPLATIN
PT082388044 02FEB2016 ETOPOSIDE
PT082388044 03FEB2016 ETOPOSIDE
PT082388044 04FEB2016 ETOPOSIDE
PT082388044 23FEB2016 CARBOPLATIN
PT082388044 23FEB2016 ETOPOSIDE
PT082388044 24FEB2016 ETOPOSIDE
PT082388044 25FEB2016 ETOPOSIDE
PT082388044 15MAR2016 CARBOPLATIN
PT082388044 15MAR2016 ETOPOSIDE
PT082388044 16MAR2016 ETOPOSIDE
PT082388044 17MAR2016 ETOPOSIDE
PT083585377 17APR2012 CARBOPLATIN
PT083585377 17APR2012 ETOPOSIDE
PT083585377 18APR2012 ETOPOSIDE
PT083585377 19APR2012 ETOPOSIDE
PT083585377 09MAY2012 CARBOPLATIN
PT083585377 09MAY2012 ETOPOSIDE
PT083585377 10MAY2012 ETOPOSIDE
PT083585377 11MAY2012 ETOPOSIDE
PT083585377 30MAY2012 CARBOPLATIN
PT083585377 30MAY2012 ETOPOSIDE
PT083585377 31MAY2012 ETOPOSIDE
PT083585377 01JUN2012 ETOPOSIDE
PT083585377 20JUN2012 CARBOPLATIN
PT083585377 20JUN2012 ETOPOSIDE
PT083585377 21JUN2012 ETOPOSIDE
PT083585377 22JUN2012 ETOPOSIDE
PT083585377 25JUL2012 CARBOPLATIN
PT083585377 25JUL2012 ETOPOSIDE
PT083585377 26JUL2012 ETOPOSIDE
PT083585377 27JUL2012 ETOPOSIDE
PT083585377 15AUG2012 CARBOPLATIN
PT083585377 15AUG2012 ETOPOSIDE
PT083585377 16AUG2012 ETOPOSIDE
PT083585377 17AUG2012 ETOPOSIDE
PT083585377 03JAN2013 CARBOPLATIN
PT083585377 03JAN2013 ETOPOSIDE
PT083585377 22JAN2013 CARBOPLATIN
PT083585377 22JAN2013 IRINOTECAN
PT083585377 18FEB2013 CARBOPLATIN
PT083585377 18FEB2013 IRINOTECAN
PT083585377 25FEB2013 CARBOPLATIN
PT083585377 25FEB2013 IRINOTECAN
PT083585377 04MAR2013 CARBOPLATIN
PT083585377 04MAR2013 IRINOTECAN
PT083585377 16APR2013 CARBOPLATIN
PT083585377 16APR2013 IRINOTECAN
PT083585377 23APR2013 CARBOPLATIN
PT083585377 23APR2013 IRINOTECAN
PT083585377 30APR2013 CARBOPLATIN
PT083585377 30APR2013 IRINOTECAN
PT083585377 31MAY2013 CARBOPLATIN
PT083585377 31MAY2013 IRINOTECAN
PT083585377 07JUN2013 CARBOPLATIN
PT083585377 07JUN2013 IRINOTECAN
PT083585377 24JUN2013 TOPOTECAN
PT083585377 25JUN2013 TOPOTECAN
PT083585377 26JUN2013 TOPOTECAN
PT083585377 27JUN2013 TOPOTECAN
PT083585377 28JUN2013 TOPOTECAN
PT083585377 22JUL2013 CARBOPLATIN
PT083585377 22JUL2013 IRINOTECAN
PT083585377 22JUL2013 TOPOTECAN
PT083585377 29JUL2013 TOPOTECAN
PT083585377 30JUL2013 TOPOTECAN
PT083585377 31JUL2013 TOPOTECAN
PT083585377 01AUG2013 TOPOTECAN
PT083585377 02AUG2013 TOPOTECAN
PT083585377 26AUG2013 TOPOTECAN
PT083585377 27AUG2013 TOPOTECAN
PT083585377 28AUG2013 TOPOTECAN
PT083585377 29AUG2013 TOPOTECAN
PT083585377 16SEP2013 DOCETAXEL
PT083585377 08OCT2013 DOCETAXEL
PT083585377 11NOV2013 GEMCITABINE
PT083585377 18NOV2013 GEMCITABINE
PT083585377 09DEC2013 GEMCITABINE
PT083585377 23DEC2013 GEMCITABINE
PT083585377 30DEC2013 GEMCITABINE
PT083585377 06JAN2014 GEMCITABINE
;
run;
proc sort data=have; by ptid drug drug_dt; run;
data flag_data;
set have;
by ptid drug;
retain flag 0;
if first.drug or dif(drug_dt)>60 then flag=1;
else flag+1;
run;
data flag_data2;
set flag_data;
by ptid drug;
if first.drug or last.drug;
drop flag;
run;
proc means nway missing noprint data=flag_data2;
class ptid drug;
output out=want(drop=_type_ _freq_)
min(drug_dt)=start_dt max(drug_dt)=end_dt;
run;
-unison
Hi @unison Very neat!
Hi unison,
Can I change this code that you priovided here :
proc means nway missing noprint data=flag_data2; class ptid drug; output out=want(drop=_type_ _freq_) min(drug_dt)=start_dt max(drug_dt)=end_dt; run;
To using proc sql ?
proc sql; create table step1_final as select ptid, drug, min(drug_dt) as stdt format date9., max(drug_dt) as enddt format date9. from step1_1 group by ptid, drug ; quit ;
If no, what is the difference between these two ?
Thanks in advance
Hi @saipriya92,
Looks like they are identical!
proc means nway missing noprint data=flag_data2;
class ptid drug;
output out=opt1(drop=_type_ _freq_)
min(drug_dt)=stdt max(drug_dt)=enddt;
run;
proc sql;
create table opt2 as
select ptid, drug, min(drug_dt) as stdt format date9., max(drug_dt) as enddt format date9.
from flag_data2
group by ptid, drug ;
quit ;
proc compare base=opt1 compare=opt2; run;
-unison
I don't think SQL is well suited for this task. My take:
proc sort data=have; by ptid drug drug_dt; run;
data want;
do until(last.drug);
set have; by ptid drug;
if missing(startDt) then startDt = drug_dt;
else if intck("day", endDt, drug_Dt) > 60 then do;
output;
call missing(startDt);
end;
endDt = drug_Dt;
end;
output;
keep ptid drug startDt endDt;
run;
As @PGStats said, this is not a problem well-suited to an SQL solution. I would suggest code similar to @PGStats,s except this code uses a "look-ahead" technique to see if the upcoming gap is >60. It is what I would term a "SET/BY + MERGE/firstobs" solution:
data have;
length ptid $13. drug $11.;
input ptid $ drug_dt :date9. drug $;
format drug_dt date9.;
datalines;
PT078375333 31DEC2014 ETOPOSIDE
PT078375333 01JAN2015 CISPLATIN
PT078375333 01JAN2015 ETOPOSIDE
PT078375333 02JAN2015 ETOPOSIDE
PT078375333 21JAN2015 CISPLATIN
PT078375333 21JAN2015 ETOPOSIDE
PT078375333 22JAN2015 ETOPOSIDE
PT078375333 23JAN2015 ETOPOSIDE
PT078375333 11FEB2015 CISPLATIN
PT078375333 11FEB2015 ETOPOSIDE
PT078375333 12FEB2015 ETOPOSIDE
PT078375333 13FEB2015 ETOPOSIDE
PT078375333 04MAR2015 CISPLATIN
PT078375333 05MAR2015 ETOPOSIDE
PT078375333 06MAR2015 ETOPOSIDE
PT078837214 13NOV2013 CARBOPLATIN
PT078837214 13NOV2013 ETOPOSIDE
PT078837214 11DEC2013 CARBOPLATIN
PT078837214 11DEC2013 ETOPOSIDE
PT078837214 12DEC2013 ETOPOSIDE
PT082388044 18MAR2013 CARBOPLATIN
PT082388044 18MAR2013 ETOPOSIDE
PT082388044 19MAR2013 ETOPOSIDE
PT082388044 20MAR2013 ETOPOSIDE
PT082388044 08APR2013 CARBOPLATIN
PT082388044 08APR2013 ETOPOSIDE
PT082388044 09APR2013 ETOPOSIDE
PT082388044 10APR2013 ETOPOSIDE
PT082388044 01MAY2013 CARBOPLATIN
PT082388044 01MAY2013 ETOPOSIDE
PT082388044 02MAY2013 ETOPOSIDE
PT082388044 03MAY2013 ETOPOSIDE
PT082388044 22MAY2013 CARBOPLATIN
PT082388044 22MAY2013 ETOPOSIDE
PT082388044 23MAY2013 ETOPOSIDE
PT082388044 24MAY2013 ETOPOSIDE
PT082388044 19JAN2015 CARBOPLATIN
PT082388044 19JAN2015 ETOPOSIDE
PT082388044 20JAN2015 ETOPOSIDE
PT082388044 21JAN2015 ETOPOSIDE
PT082388044 09FEB2015 CARBOPLATIN
PT082388044 09FEB2015 ETOPOSIDE
PT082388044 10FEB2015 ETOPOSIDE
PT082388044 11FEB2015 ETOPOSIDE
PT082388044 03MAR2015 CARBOPLATIN
PT082388044 03MAR2015 ETOPOSIDE
PT082388044 04MAR2015 ETOPOSIDE
PT082388044 05MAR2015 ETOPOSIDE
PT082388044 24MAR2015 CARBOPLATIN
PT082388044 24MAR2015 ETOPOSIDE
PT082388044 25MAR2015 ETOPOSIDE
PT082388044 26MAR2015 ETOPOSIDE
PT082388044 02FEB2016 CARBOPLATIN
PT082388044 02FEB2016 ETOPOSIDE
PT082388044 03FEB2016 ETOPOSIDE
PT082388044 04FEB2016 ETOPOSIDE
PT082388044 23FEB2016 CARBOPLATIN
PT082388044 23FEB2016 ETOPOSIDE
PT082388044 24FEB2016 ETOPOSIDE
PT082388044 25FEB2016 ETOPOSIDE
PT082388044 15MAR2016 CARBOPLATIN
PT082388044 15MAR2016 ETOPOSIDE
PT082388044 16MAR2016 ETOPOSIDE
PT082388044 17MAR2016 ETOPOSIDE
PT083585377 17APR2012 CARBOPLATIN
PT083585377 17APR2012 ETOPOSIDE
PT083585377 18APR2012 ETOPOSIDE
PT083585377 19APR2012 ETOPOSIDE
PT083585377 09MAY2012 CARBOPLATIN
PT083585377 09MAY2012 ETOPOSIDE
PT083585377 10MAY2012 ETOPOSIDE
PT083585377 11MAY2012 ETOPOSIDE
PT083585377 30MAY2012 CARBOPLATIN
PT083585377 30MAY2012 ETOPOSIDE
PT083585377 31MAY2012 ETOPOSIDE
PT083585377 01JUN2012 ETOPOSIDE
PT083585377 20JUN2012 CARBOPLATIN
PT083585377 20JUN2012 ETOPOSIDE
PT083585377 21JUN2012 ETOPOSIDE
PT083585377 22JUN2012 ETOPOSIDE
PT083585377 25JUL2012 CARBOPLATIN
PT083585377 25JUL2012 ETOPOSIDE
PT083585377 26JUL2012 ETOPOSIDE
PT083585377 27JUL2012 ETOPOSIDE
PT083585377 15AUG2012 CARBOPLATIN
PT083585377 15AUG2012 ETOPOSIDE
PT083585377 16AUG2012 ETOPOSIDE
PT083585377 17AUG2012 ETOPOSIDE
PT083585377 03JAN2013 CARBOPLATIN
PT083585377 03JAN2013 ETOPOSIDE
PT083585377 22JAN2013 CARBOPLATIN
PT083585377 22JAN2013 IRINOTECAN
PT083585377 18FEB2013 CARBOPLATIN
PT083585377 18FEB2013 IRINOTECAN
PT083585377 25FEB2013 CARBOPLATIN
PT083585377 25FEB2013 IRINOTECAN
PT083585377 04MAR2013 CARBOPLATIN
PT083585377 04MAR2013 IRINOTECAN
PT083585377 16APR2013 CARBOPLATIN
PT083585377 16APR2013 IRINOTECAN
PT083585377 23APR2013 CARBOPLATIN
PT083585377 23APR2013 IRINOTECAN
PT083585377 30APR2013 CARBOPLATIN
PT083585377 30APR2013 IRINOTECAN
PT083585377 31MAY2013 CARBOPLATIN
PT083585377 31MAY2013 IRINOTECAN
PT083585377 07JUN2013 CARBOPLATIN
PT083585377 07JUN2013 IRINOTECAN
PT083585377 24JUN2013 TOPOTECAN
PT083585377 25JUN2013 TOPOTECAN
PT083585377 26JUN2013 TOPOTECAN
PT083585377 27JUN2013 TOPOTECAN
PT083585377 28JUN2013 TOPOTECAN
PT083585377 22JUL2013 CARBOPLATIN
PT083585377 22JUL2013 IRINOTECAN
PT083585377 22JUL2013 TOPOTECAN
PT083585377 29JUL2013 TOPOTECAN
PT083585377 30JUL2013 TOPOTECAN
PT083585377 31JUL2013 TOPOTECAN
PT083585377 01AUG2013 TOPOTECAN
PT083585377 02AUG2013 TOPOTECAN
PT083585377 26AUG2013 TOPOTECAN
PT083585377 27AUG2013 TOPOTECAN
PT083585377 28AUG2013 TOPOTECAN
PT083585377 29AUG2013 TOPOTECAN
PT083585377 16SEP2013 DOCETAXEL
PT083585377 08OCT2013 DOCETAXEL
PT083585377 11NOV2013 GEMCITABINE
PT083585377 18NOV2013 GEMCITABINE
PT083585377 09DEC2013 GEMCITABINE
PT083585377 23DEC2013 GEMCITABINE
PT083585377 30DEC2013 GEMCITABINE
PT083585377 06JAN2014 GEMCITABINE
;
run;
proc sort data=have; by ptid drug drug_dt; run;
data want (drop=nxt_: drug_dt);
do until (last.drug or nxt_drug_dt>drug_dt+60);
set have (keep=ptid drug);
by ptid drug ;
merge have
have (firstobs=2 keep=drug_dt rename=(drug_dt=nxt_drug_dt));
if startdt=. then startdt=drug_dt;
end;
enddt=drug_dt;
format startdt enddt date9. ;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.