im having a hard time dealing with duplicate observations. currently, i have this output:
however, i need this output (below) so i can have accurate end of year counts.
can someone please help me create code to collapse these rows without losing data. thaanks in advance.
For this kind of operation, I like to use one of my favorite SAS trick: the data step update statement.
Assumption is that the data is already sorted.
data have;
input id var1$ var2$ var3;
datalines;
1 . . 100
1 a . .
1 . b .
2 c . .
2 . d 200
;
run;
data want;
update have(obs=0) have;
by id;
run;
id var1 var2 var3
1 a b 100
2 c d 200