hello,
I am trying to definte a new variable as "Death within 1 year after chemo therapy" using the following dataset...
Both patient_ID 10001 and 10002 has death_dates, but only patient_ID 10001 should be marked dead within 1 year because the death_date falls within 1 year after First_Chemo_Date whereas patient ID 10002 does not.
-----------------------------------------------------------------------
Patient_ID First_Chemo_Date Death_Date
10001 2010-05-01 2010-08-01
10002 2010-07-01 2012-05-01
------------------------------------------------------------------------
using previous help from generous members of this community, I tried the following.
data w.cancer;
set w.cancer;
IF (FIRST_CHEMO_DATE<DEATH_DATE<FIRST_CHEMO_DATE+365) THEN DEATH_WITHIN_1YR_AFTER_CHEMO=1; ELSE IF
DEATH_WITHIN_1YR_AFTER_CHEMO=0;
run;
However, it is not giving me the result that I want...what am I doing wrong here?
Any help or advice will be appreciated so much..,
SAS treats dates as numbers so if you subtract the dates that should be the number of days between chemo and death.
SAS treats dates as numbers so if you subtract the dates that should be the number of days between chemo and death.
I reformatted my dates and it works now. Thank you for your advice!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.