Hi.
Assuming, VAR1, VAR2, VAR3 are numeric and will hold only one value per group being the other equal to MISSING value (.), you could output a single obs for each group, retaining the values of VAR1, VAR2, VAR3.
Something like this:
[pre]
data OUTDATA;
set INDATA (rename = (VAR1=_VAR1 VAR2=_VAR2 VAR3=_VAR3))
by ID V1;
retain VAR1 VAR2 VAR3 .; * retain new variables;
drop _:; * drop old variables;
VAR1=MAX(VAR1,_VAR1); VAR2=MAX(VAR2,_VAR2); VAR3=MAX(VAR3,_VAR3);
if last.VI; * output last obs of group;
output;
VAR1=.; VAR2=.; VAR3=.; * reinit;
run;
[/pre]
Or
Simply group data and calculate max for VAR1, VAR2, VAR3,
[pre]
proc sql noprint;
create table OUTDATA as
select ID, VI, max(VAR1) as VAR1, max(VAR2) as VAR2, max(VAR3) as VAR3 from INDATA group bt ID, VI;
quit;
[/pre]
Or.
Transpose the table through PROC TRANSPOSE.
Code above was not tested.
Cheers from Portugal.
Daniel Santos @
www.cgd.pt