SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Repeated measure with duplicate observations

Accepted Solution Solved
Reply
Super Contributor
Posts: 324
Accepted Solution

Repeated measure with duplicate observations

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

Accepted Solutions
Solution
‎03-27-2018 12:37 PM
PROC Star
Posts: 1,288

Re: Repeated measure with duplicate observations

Posted in reply to desireatem

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;

View solution in original post


All Replies
Solution
‎03-27-2018 12:37 PM
PROC Star
Posts: 1,288

Re: Repeated measure with duplicate observations

Posted in reply to desireatem

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;
Occasional Contributor
Posts: 6

Re: Repeated measure with duplicate observations

Posted in reply to desireatem

proc sort data = dataset1 nodupkey;

by timepoint;

run;

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 101 views
  • 0 likes
  • 3 in conversation