mercredi 13 avril 2016

SAS, replace missing column values with the column values from right

I have a dataset which has 100 columns. Every time it will have some missing values for some columns (the whole column values missing). The locations are fixed so I cannot specify them by columnA=ColumnB.

What I want to do is to replace the whole missing columns values with the column values from the column on its right side (see test data). Thank you.

DATA have ;
LENGTH make $ 20 ;
INPUT make $ 1-17 a b c d m h u;
CARDS;
AMC Concord        4099 22 . 2  1   . 22 
AMC Pacer          4749 17 . 2  1   . 17
Audi 5000          9690 17 . 3  23  . 17
Audi Fox           6295 23 . 1  32  . 23
;
RUN;

DATA want;
LENGTH make $ 20 ;
INPUT make $ 1-17 a b c d m h u;
CARDS;
AMC Concord        4099 22 2 2  1  22 22  
AMC Pacer          4749 17 2 2  1  17 17
Audi 5000          9690 17 3 3  23 17 17
Audi Fox           6295 23 1 1  32 23 23;
RUN;

Aucun commentaire:

Enregistrer un commentaire