Hi All, I am trying to do survival analysis, where my outcome is "outcome=1". What I want to ultimately have happen is to have a time variable created, as defined by the time (I have a seperate time variable for each participant follow-up) that they develop "outcome=1". I already transposed the data into wide format and the maximum number of timepoints is 14 for any subject. Thus, there are 14 outcome variables (outcome1-outcome14). I dropped participants who had an outcome1=1. The hard part here is that just because outcome2=1, outcome3 could also be equal to 1, as could outcome4 for the same participant. But, I only want the first occurence and to basically delete the rest of the data as it becomes useless. The code that I am using to try to accomplish this won't work. This code is only the first step, but if I get this to work, the rest should be pretty simple Any help would be much appreciated. data ad47; set ad46; if outcome2=1 then outcomefinal2=1; if outcomefinal2=1 then drop outcome3-outcome14; if outcome3=1 then outcomefinal3=1; if outcomefinal3=1 then drop outcome4-outcome14; if outcome4=1 then outcomefinal4=1; if outcomefinal4=1 then drop outcome5-outcome14; if outcome5=1 then outcomefinal5=1; if outcomefinal5=1 then drop outcome6-outcome14; if outcome6=1 then outcomefinal6=1; if outcomefinal6=1 then drop outcome7-outcome14; if outcome7=1 then outcomefinal7=1; if outcomefinal7=1 then drop outcome8-outcome14; if outcome8=1 then outcomefinal8=1; if outcomefinal8=1 then drop outcome9-outcome14; if outcome9=1 then outcomefinal9=1; if outcomefinal9=1 then drop outcome10-outcome14; if outcome10=1 then outcomefinal10=1; if outcomefinal10=1 then drop outcome11-outcome14; if outcome11=1 then outcomefinal11=1; if outcomefinal11=1 then drop outcome12-outcome14; if outcome12=1 then outcomefinal2=1; if outcomefinal12=1 then drop outcome13-outcome14; if outcome13=1 then outcomefinal13=1; if outcomefinal13=1 then drop outcome14; if outcome14=1 then outcomefinal14=1; /*time=max(of MosLater1 - MosLater14);*/ run; This is an example of the error that I am getting... 1350 if outcome13=1 then outcomefinal13=1; 1351 if outcomefinal13=1 then drop outcome14; ---- 180 ERROR 180-322: Statement is not valid or it is used out of proper order. Thanks, chavens
... View more