In reply to Anthony de Fex.

Or you can use the COUNTW function to get the number of words and use the SCAN function to iterate over the words in each line. See "Break a sentence into words in SAS."