My data is scattered over several columns. I want to shift the non-missing values from the nearest right side columns to the corresponding rows of left side columns. I have been doing this with simple replace commands or using concat command:
egen B_new = concat(C D E F G)
replace B = B_new if B == ""
drop B_new
drop C D E F G
However, I have such problem in all columns and I need to shift the values to the left side columns till there is no missing values. I have many such files to work on, please help with a loop. The variables name are A,B,C,D,E,F......so on
egen B_new = concat(C D E F G)
replace B = B_new if B == ""
drop B_new
drop C D E F G
However, I have such problem in all columns and I need to shift the values to the left side columns till there is no missing values. I have many such files to work on, please help with a loop. The variables name are A,B,C,D,E,F......so on
Comment