@PGStats Thanks for your solutions it seem to be close to handle the issue. I release that I have a information's for my variable named as "Number" as character and not numeric. Any idea how overpass this error "Invalid numeric data, Number='1132A'" ? data Current; input ID name $ Number $ Street $ City $; datalines; 101 Riley 1132A . . 101 Riley . MappleAve . 101 Riley . . Downtown 101 Riley . . Dream 101 Riley . 5thStreet . 101 Riley 1012A . . 101 Riley . . Dreams 101 Riley . 4thStreet . 101 Riley 1013B . . 101 Riley 1014CB . . 101 Riley . . Life 101 Riley . 3thStreet . 222 Apple B132 . . 222 Apple . . . 222 Apple . . Greenville 222 Apple . . York 222 Apple . ElevenAve . 222 Apple A112 . . ; run; data want2; set current; by id name; length _N 8 _S _C $24; retain _N _S _C; if not missing(_N) and not missing(Number) or not missing(_S) and not missing(Street) or not missing(_C) and not missing(City) then do; output; call missing(_N, _S, _C); end; _N = coalesce(_N, Number); _S = coalescec(_S, Street); _C = coalescec(_C, City); if last.name then do; output; call missing(_N, _S, _C); end; keep ID name _N _S _C; rename _N=Number _S=Street _C=City; run;
... View more