Here is how my data are set up:
where date# is the date the lab result# was collected. I have tried to check if the dates are in asending order but cannot be certain (the real data can have up to 10 dates with 10 corresponding lab results). Where . are missing data. Where DATE# are dates mm/dd/yyyy, RESULT# are numeric, and ID is a string.
ID DATE1 RESULT1 DATE2 RESULT2 DATE3 RESULT3 DATE4 RESULT4
1 1/1/2000 200 3/1/2000 250 8/1/2000 100 9/1/2000 400
2 . . . . . . . .
3 2/1/2000 225 9/1/2000 100 . . . .
4 12/1/2000 300 . . . . . .
QUESTION 1: How do I identify/tag the earliest and oldest lab result per ID?
These here is the output I need:
ID FIRST LAST
1 200 400
2 . .
3 225 100
4 300 300
QUESTION2: any way to make the LAST output for ID 4 set to missing since there is only one result for this record?