05-16-2014 03:30 AM
I have three datasets, each containing the values of a variable for a different 6-month period, and I'm trying to use their values as the time-dependent explanatory variable, in a proportional hazards model (PROC PHREG). Basically, from time 1 to time 6, I want the value of the explanatory variable to be the value from table 1; from time 7 to 12 I want the value of the same explanatory variable to be the value from table 2, etc.
I know I will have to join all the datasets before I run PHREG, but my question is how do I flag them prior to that, to allow me to differentiate the values coming from each dataset?
(EDIT) To clarify what I mean:
Dataset 1 contains the values of variable "Measurement" for the period Jan 2010 - Jun 2010
Dataset 2 contains the values of variable "Measurement" for the period Jul 2011 - Dec 2011
Dataset 3 contains the values of variable "Measurement" for the period Jan 2011 - Jun 2011
I want to combine the values of "Measurement" from all 3 datasets into one single model for PHREG, that selects the value from Dataset 1 during time 1 to time 6, the value from Dataset 2 from time 7 to time 12, and the value from Dataset 3 from time 13 to time 18. What would be a good and clean way to do this?
Greatly appreciate any help.
05-18-2014 04:54 AM
Anyone? Is there any additional information I could provide that would be helpful? I don't need help with the specifics of PHREG per se, just how to copy over same-variable values from other datasets and handle the differentiation in the code.
05-18-2014 10:03 AM
If I understood your questions correctly. You are looking for combining 3 datasets and want to flag them. Please see the below
set dataset1(in=a) dataset2(in=b) dataset3(in=c);
if a then flag=1;
if b then flag=2;
if c then flag=3;
Make sure common variables must have the same attributes.
05-18-2014 10:21 AM
Thank you, yes, that is the gist of it. But in the PROC PHREG code I will need to specify that I want to choose the values with flag=1 if 0<time<6. I think I will not be able to incorporate the flags into the model, as they will be a separate variable from the value itself?
Need further help from the community? Please ask a new question.