I have this repeated measure with varying duplicate observation. I wish to make sure for each id, there is just one timepoint. Below is the data and corrected version (bold). I just one observation for each timepoint by sid
| SID | NPiL | SizeL | timepoint |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | 4.99 | 1 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 2.8 | 6.08 | 17 |
| 200001 | 2.8 | 6.08 | 17 |
| 200001 | 2.8 | 6.08 | 17 |
| 200001 | 2.8 | 6.08 | 17 |
| 200001 | 2.8 | 6.08 | 17 |
| corrected data | |||
| SID | NPiL | SizeL | timepoint |
| 200001 | 3.8 | . | 1 |
| 200001 | 3.8 | 4.89 | 2 |
| 200001 | 4.3 | 4.22 | 3 |
| 200001 | 4.2 | 4.25 | 4 |
| 200001 | 4.1 | 5.71 | 5 |
| 200001 | 3.9 | 4.96 | 6 |
| 200001 | 4.1 | 5.17 | 7 |
| 200001 | 3.5 | 4.71 | 8 |
| 200001 | 3.1 | 5.36 | 9 |
| 200001 | 2.4 | 5.81 | 10 |
| 200001 | 3.1 | 5.78 | 11 |
| 200001 | 2.9 | 5.5 | 12 |
| 200001 | 2.4 | 6.04 | 13 |
| 200001 | 2.6 | 6.24 | 14 |
| 200001 | 3 | 5.42 | 15 |
| 200001 | 4.2 | 3.58 | 16 |
| 200001 | 2.8 | 6.08 | 17 |
Assuming your observations are sorted by SID and timepoint, and that you always want the first observation of the group, this should do it.
Tom
data want;
set have;
by SID timepoint;
if first.timepoint;
run;
Assuming your observations are sorted by SID and timepoint, and that you always want the first observation of the group, this should do it.
Tom
data want;
set have;
by SID timepoint;
if first.timepoint;
run;
proc sort data = dataset1 nodupkey;
by timepoint;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.