Hi All, I need some help..I have some sample data below: First Scenario: If the result is missing I need to look back to get the result from the previous visit within each test. So for example subjid 1 for test ABC has missing result for DAY3 and WEEK1 then we get the result from DAY2 for both DAY3 and WEEK1. So basically we just have to keep looking back all the visits until we get the result. I did obtain the results by using Proc sql coalesce when I had few visits but now I have like 80 visits and I cant program it using sql coalesce. I am looking for a macro to obtain the result. Second Scenario: The looking back of visits can be from another study too...as different studies are combined here. If suppose for a subject, result of one of the visit is missing from study XYZ(which is third study) then we go back to the study RWA(second study) to look for the result and if its still missing then we look into ABC(first study) to get the results. I don't have an example of sample data here. For example, DATA HAVE; infile datalines dlm=','; INPUT SUBJID $ TEST $ TESTCD VISIT $ VISITN RESULT ; DATALINES; 1,ABC,1,DAY1,1,12345 1,ABC,1,DAY2,2,32457 1,ABC,1,DAY3,3,. 1,ABC,1,WEEK1,4,. 1,ABC,1,WEEK2,5,13845 1,ABC,1,WEEK3,6,. 1,ABC,1,WEEK4,7,. 1,ABC,1,EW,8,45890 1,DEF,2,DAY1,1,145 1,DEF,2,DAY2,2,. 1,DEF,2,DAY3,3,13085 1,DEF,2,WEEK1,4,. 1,DEF,2,WEEK2,5,1.45 1,DEF,2,WEEK3,6,12.34 1,DEF,2,WEEK4,7,0 1,DEF,2,EW,8,. ; RUN; Any help would be greatly appreciated. Thanks...
... View more