Thanks for you quick reply
Sorry that is was not clear. I have added visitno[_n] - that is
obtained from program statement
& visitno to indicate what Im after.
the date can be the same for different ids and the number of
observations for each date
with id can vary from 1-20+. The final aim is to generate summary data
(max value, means etc) for var* at each date within id
I have the following data structure
id date var1 var2 visitno visitno[_n]
1 16267 x 53 1 1
1 16267 y 106 1 2
1 16267 y 84 1 3
1 16267 y 90 1 4
1 16267 z 76 1 5
1 16267 z 65 1 6
1 16298 x 87 2 1
1 16298 y 76 2 2
2 15678 x 98 1 1
2 15678 y 98 1 2
2 16541 x 150 2 1
2 16541 x 76 2 2
2 16541 x 76 2 3
2 16541 y 56 2 4