Two things come to mind when looking at your code:
1) Your input statement defines WORD as numeric. Use a dollar sign to indicate a character.
2) Your file seems to have multiple valiues for WORD in a single line. Your code however reads just the first word in every line. Use a double trailing at sign to retain the record in the buffer until all words are collected:
filename t temp;
data _null_;
file t;
put 'random, words, coming, up, right, now, here, random, words, here, coming, down, up, word, coming, random, way';
run;
%macro wordfreq(x);
data wrd;
infile t DLM=',';
input words $ @@;
run;
%mend;
%wordfreq(wrd);
(I have put your data into a temp file for easier testing)
Hope this helps,
- Jan.
... View more