the goal is to write a SAS program to make diagnosis on a disease. idno = id of patient, visit = visit number, test = result from test (can be A or B), to make a positive diagnosis, the patient have to have test=A in two consecutive visits. so if test=A in visit 1 and test=A in visit 2, then patient is positive. If A in visit 1 and B in visit 2, patient is negative. problem occurs when there's visits with missing data. For example, if patient 11 tested A in visit 3, did not get tested in visit 4, and tested again A in visit 5, he should be positive (because technically he was tested A 2 times consecutively). note, once a patient is labeled as positive, he remains positive forever, regardless of later results idno visit test 11 1 A 11 2 B 11 3 A 11 4 11 5 A = positive idno visit test 11 1 A 11 2 11 3 A 11 4 B 11 5 B = positive idno visit test 11 1 A 11 2 11 3 B 11 4 11 5 A = negative thank you for the help! here's the test code to start with: data test; input idno visit test $; datalines; 11 1 A 11 2 B 11 3 A 11 4 . 11 5 A ; run;
... View more