Hello there,
I have data of when hypothetical patients received a certain type of surgery. The type of surgery is denoted by the variable 'condx'. The data states what date the patient received the surgery and how old the they were on that date. Some patients had more than one procedure and on different days, but the patients' ages on those following dates are missing. I would like to know how to use AGE and EVENT_DATE on the first patient record in order to calculate AGE on later dates by comparing EVENT_DATEs. I am trying to put those missing ages in a new column I named "DIFF". I used the following code:
.
RETAIN AGE;
IF LAST.AGE= . THEN AGE=DIFF;
DIFF= LAST.EVENT_DATE-FIRST.EVENT_DATE
RUN;
PROC PRINT DATA=PROJECT.COMPLETE;
RUN;
My initial assumption was to find the difference in the dates which would give me the amount of days between dates, however I don't believe this is correct. Thanks in advance for any input.