Thanks. Though it looks like I have another issue with my data. I don't have the periods representing the empty values as below. Without those the col4 data gets shifted over to col1, so nothing gets output. Here I have removed the periods from a couple of the entries - data have;
infile cards missover;
input (col1-col4)(:$16.);
retain dummyby 1;
cards;
AAA FRED 123
. . . xxxx,15
. . . yyyy,15
. . . zzzz,15
BBB FRED 234
xxxx,15
zzzz,23
CCC FRED 123
. . . yyyy,11
. . . zzzz,15
AAA BARNEY 123
yyyy,07
zzzz,42
BBB BARNEY 123
. . . wwww,03
. . . zzzz,33
;;;;
run;
proc print;
run;
data want;
update have(keep=dummyby obs=0) have;
by dummyby;
if not missing(col4) then output;
call missing(col4);
drop dummyby;
run;
proc print;
run; This is what it now looks like - Obs col1 col2 col3 col4 dummyby
1 AAA FRED 123 1
2 xxxx,15 1
3 yyyy,15 1
4 zzzz,15 1
5 BBB FRED 234 1
6 xxxx,15 1
7 zzzz,23 1
8 CCC FRED 123 1
9 yyyy,11 1
10 zzzz,15 1
11 AAA BARNEY 123 1
12 yyyy,07 1
13 zzzz,42 1
14 BBB BARNEY 123 1
15 wwww,03 1
16 zzzz,33 1 which then doesn't return those entries(BBB FRED, AAA BARNEY) - Obs col1 col2 col3 col4
1 AAA FRED 123 xxxx,15
2 AAA FRED 123 yyyy,15
3 AAA FRED 123 zzzz,15
4 CCC FRED 123 yyyy,11
5 CCC FRED 123 zzzz,15
6 BBB BARNEY 123 wwww,03
7 BBB BARNEY 123 zzzz,33 Thanks
... View more