You can try the following code, hope it can help you. Assuming your datatset is called "a": data V1; set a; where V1 is not missing; keep ID V1; run; data V2; set a; where V2 is not missing; keep ID V2; run; data V3; set a; where V3 is not missing; keep ID V3; run; data a; merge V1 V2 V3; by ID; run; proc datasets nolist; delete V1 V2 V3; run; ------------------------------------------------------------------------------------- If you have more variables in the dataset similar to this pattern, just create more V<n> datasets in the same way, and then merging them in the data step. The proc dataset is used to delete those workings.
... View more