Posted By

webonomic on 03/31/08


Tagged

count word


Versions (?)

Word Count 2


 / Published in: SAS
 

URL: http://jaredprins.squarespace.com/blog/2008/3/31/sas-word-count-program.html

  1. %macro nwords(s);
  2. (compress(&s) ne ' ') *
  3. (length(left(compbl(&s)))-length(compress(&s))+1)
  4. %mend nwords;
  5.  
  6. data _null_;
  7. string = "dasj h 07y lk0 - ldsmv";
  8. nwords = %nwords(string);
  9. put nwords=;
  10. run;
  11.  
  12. /*NWORDS=6*/

Report this snippet  

You need to login to post a comment.