Here is an even easier option to clean the data of blank values and then transpose (that doesn't require the macro looping): DATA WORK.Have (DROP= Type2 Maturity2 Series2);
SET WORK.Have;
RETAIN Type2 Maturity2 Series2;
IF Type NE ' ' THEN Type2=Type;
ELSE IF Type = ' ' THEN Type=Type2;
IF Maturity NE . THEN Maturity2=Maturity;
ELSE IF Maturity = . THEN Maturity=Maturity2;
IF Series NE ' ' THEN Series2=Series;
ELSE IF Series = ' ' THEN Series=Series2;
RUN;
PROC SORT DATA=WORK.Have; BY Type Maturity Series ID; RUN;
PROC TRANSPOSE DATA=WORK.Have out=WORK.WANT (drop=_name_) prefix=ID_;
var ID;
by Type Maturity Series;
run;
... View more