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!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.