Revision: 5737
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 31, 2008 13:50 by webonomic
Initial Code
/*pull out all comments with specific words*/ data commentsdata;set surveydata; if _n_=1 then do; retain re; re = prxparse(’/words|to|match/i’); /* the /i here means Case insensitive match */ if missing(re) then do; putlog ‘ERROR: regex is malformed’; stop; end; end; if prxmatch(re,Comments); /* Comments is the name of the variable with the comments text */ run; /*Regular Expressions*/ /* ^ start of field s* (maybe with whitespace at the front) [A-Z] a letter from A to Z d a digit [A-Z] A to Z again a space d a digit [A-Z] A to Z again d a digit s* possible whitespace $ end of field */ data new; set YourData; if _n_=1 then do; re = prxparse(’/^s*[A-Z]d[A-Z] d[A-Z]ds*$/’); if missing (re) then stop; end; if prxmatch(re,YourNameField); run;
Initial URL
http://jaredprins.squarespace.com/blog/2008/3/31/string-matching.html
Initial Description
Initial Title
String Matching
Initial Tags
Initial Language
SAS