Because each variable contains only one word, in a DATA step you could concatenate them and count the number of words like this:
data have;
infile datalines dsd dlm='|' truncover;
input D1_1:$10. D1_2:$10. D1_3:$10. D1_4:$10. D1_5:$10.;
datalines;
yellow|blue|
pink|yellow|magenta||black
magenta|orange|green
green|magenta|pink|white
;
For the frequency count by word, it's easiest to transpose with a DATA step first and then use good old PROC FREQ:
data forFreq (keep=word);
set have;
array w[*] D:;
do i=1 to dim(w);
word=w[i];
if not cmiss(word) then output;
end;
run;
proc freq data=forFreq;
tables word/nocum nopercent;
run;