Load this data into SAS:

data labs;

     input id date mmddyy10. score;

     format date mmddyy10.;

     datalines;

1 10/19/2011 99

1 10/01/2011 14

1 10/01/2012 56

2 06/06/2011 23

2 08/15/2010 56

2 04/16/2010 87

;

run;

 

Sort the data by subject and date and save the results into a dataset called sorted.

Add the visit number for each subject and save the dataset as visits.

Calculate the mean score on the 2nd and 3rd visit for each person.