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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.