Reputation: 65
Name Apr14 May14 Jun14 Aug14
John R
Peter G
Peter G
Peter G
Louis R
Louis G
Carl R
Dany R
Dany G
I need unique values but keep the values not missing like this.
Name Apr14 May14 Jun14 Aug14
John R
Peter G G G
Louis R G
Carl R
Dany R G
How i can do this?
Upvotes: 1
Views: 148
Reputation: 63434
Easiest way to do this is the update statement. It only updates missing values with nonmissing. We initialize it with (obs=0) since the 'base' dataset isn't actually relevant here - we're just using this to collapse things.
data have;
infile datalines truncover;
input (Name Apr14 May14 Jun14 Aug14) ($);
datalines;
John R
Peter G
Peter . G
Peter . . G
Louis . . R
Louis . . . G
Carl . . R
Dany R
Dany . . G
;;;;
run;
proc sort data=have;
by name;
run;
data want;
update have(obs=0) have;
by name;
run;
Upvotes: 4