As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:Reg Exp Substitution in Proc Format

From sasCommunity
Revision as of 10:46, 2 April 2013 by Chang y chung (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Did you know that PROC FORMAT in 9.3 allows regular expressions in INFORMAT and (user-written) function calls in FORMAT? Read Rick's SGF2012 paper and try to complete the chain reaction!

proc format;
   invalue $final 's/final/four/' (regexpe) = [$four.];
   invalue $four  's/four/square/' (regexpe) = [$square.];
   invalue $square 's/square/dance/' (regexpe) = [$dance.];
   /* your code here */
   invalue $travel 's/travel/guide/' (regexpe) = _same_;
run; quit;
 
data _null_;
   var = input("final", $final.);
   put var=;
run;
/* on log
var=guide
*/
Submitted By chang_y_chung